swagger-mongoose icon indicating copy to clipboard operation
swagger-mongoose copied to clipboard

Support for polymorphism missing ("allOf")?

Open nakamorichi opened this issue 9 years ago • 2 comments

Getting "Error: Unrecognized schema type: undefined" when OpenAPI definition contains "allOf"-type polymorphism.

Can be reproduced with the polymorphism example at http://swagger.io/specification.

How about using a parser such as swagger-parser for validating the spec file and resolving the definitions?

nakamorichi avatar Oct 18 '16 13:10 nakamorichi

@Kitanotori PRs are welcome.

briananderson1222 avatar Oct 18 '16 17:10 briananderson1222

Thanks so much for the work on this! I've just added in a single comment as we need to move one line of code and then it works perfectly!

On PR but I'll put it here anyway:

Line 247 (var required = fullObject.required || [];) should be moved to line 251 (i.e. after processPolymorphic runs if the definition is polymorphic) otherwise we're not adding in the merged required fields.

LGLC avatar Dec 20 '17 11:12 LGLC