Closed infinitewarp closed 7 years ago
Your required
section needs to be within the object definition that defines that field. Check your linked example again, that's how they do it as well. Please reopen the issue if you're still encountering problems after doing the change.
Thanks for the advice, @sjaensch ! Your are correct, and when we adjusted our swagger.json-generator to move the required
section as you described, I was successfully able to validate it.
I'm trying to use connexion which wraps and adds functionality over swagger-spec-validator, but the schema definition I'm trying to use fails to validate. I've narrowed the problem to a specific scenario. Whenever a definition has a
required
list but defines its properties nested inallOf
instead on the peer-levelproperties
, schema validation raises aSwaggerValidationError
.For example, using this schema:
I get
SwaggerValidationError: Required list has properties not defined: [u'id']
.The schema appears to be valid (it was actually generated by another swagger framework in an unrelated system). Or am I misunderstanding something about the expected behavior?
I think I've fixed it in https://github.com/Yelp/swagger_spec_validator/pull/65, but I'm not intimately familiar with the internals of this particular module and would gladly welcome some feedback.