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.

Reply via email to