Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting object property as "required" causes error #34

Open
nakamorichi opened this issue Mar 6, 2017 · 2 comments
Open

Setting object property as "required" causes error #34

nakamorichi opened this issue Mar 6, 2017 · 2 comments

Comments

@nakamorichi
Copy link
Contributor

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)
@briananderson1222
Copy link
Collaborator

I'm looking into this. This seems to already be supported in some of the test examples

@kellertk
Copy link

This only occurs on object types, but I've run into this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants