Great idea. I just opened a PR. Cheers.
On Tue, Sep 27, 2016 at 2:28 AM, tony tam <feh...@gmail.com> wrote: > Thanks for sharing this, James. Perhaps you can send a PR to the > swagger.io site so we can add it in the OSS tools section? > > On Sep 25, 2016, at 5:08 PM, James Navin <jfna...@gmail.com> wrote: > > You could look at https://bitbucket.org/atlassian/swagger-request- > validator (disclaimer - I wrote it) > > It uses the JSON Schema validator to handle the schema validation, and has > adapters for some common libraries. If there's something missing that you > need feel free to raise a PR or a ticket in the issue tracker. > > On Friday, September 16, 2016 at 12:54:21 PM UTC+10, Max Goldstein wrote: >> >> I want my server (written in Java) to validate that the bodies of >> incoming POST and PUT requests matches the Schema Object for that >> operation's body parameter defined in my Swagger spec. I'd also like to >> validate that outgoing response bodies conform to the schema defined in the >> response object. >> >> I'm aware of swagger-inflector but it doesn't seem particularly >> well-maintained. It validates query parameters (and presumably URL ones as >> well) but it doesn't validate the body, at least in my testing. Some of my >> other concerns is that it doesn't appear to validate the multipleOf >> property (source >> <https://github.com/swagger-api/swagger-inflector/blob/master/src/main/java/io/swagger/inflector/validators/NumericValidator.java>) >> or enforce the discriminator property. >> >> My current best idea is to use the JSON Schema validator >> <https://github.com/daveclayton/json-schema-validator> (27 hundred >> commits) and follow up with custom code to validate the discriminator and >> readOnly properties (which Swagger adds to JSON Schema). Is there a better >> library that I'm unaware of? Is there some other solution that I should >> know about? >> > > -- > You received this message because you are subscribed to the Google Groups > "Swagger" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to swagger-swaggersocket+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Swagger" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/swagger-swaggersocket/5VozQjzCjz0/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > swagger-swaggersocket+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- *James Navin* Email: jfna...@gmail.com Web: www.jamesnavin.net -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.