swagger-mongoose
swagger-mongoose copied to clipboard
Setting object property as "required" causes error
Reproducable e.g. by adding property
"test": {
"type": "object",
"required": ["x"],
"properties": {
"x": { "type": "string" }
}
}
into Pet definition and "test" into its "required" array in petstore.json and running the tests. This causes following error:
TypeError: Undefined type `undefined` at `test.required`
Did you try nesting Schemas? You can only nest using refs or arrays.
at Function.Schema.interpretAsType (node_modules/mongoose/lib/schema.js:674:11)
at Schema.path (node_modules/mongoose/lib/schema.js:549:29)
at Schema.add (node_modules/mongoose/lib/schema.js:431:12)
at Schema.add (node_modules/mongoose/lib/schema.js:420:14)
at new Schema (node_modules/mongoose/lib/schema.js:102:10)
at lib/index.js:330:20
at node_modules/lodash/lodash.js:4944:15
at baseForOwn (node_modules/lodash/lodash.js:3001:24)
at node_modules/lodash/lodash.js:4913:18
at Function.forEach (node_modules/lodash/lodash.js:9359:14)
at Object.module.exports.compile (lib/index.js:307:5)
at Context.<anonymous> (test/index.js:408:31)
I'm looking into this. This seems to already be supported in some of the test examples
This only occurs on object types, but I've run into this as well.