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

embedded objects in a schema are not appearing in the swagger Model Schema #63

Open
robblovell opened this issue Jan 18, 2017 · 0 comments

Comments

@robblovell
Copy link
Contributor

In both of the ways of specifying an embedded object below, the field in the parent of the embedded object does not appear in the Model Schema:

Schema = require('mongoose').Schema
case1 = new Schema(
  {
    field1: String
    field2: String
  }
)
case2 = {
  field3: String
  field4: String
}
root = {
  case1: case1
  case2: case2
}
object = new Schema(root, {strict: false})

Resulting Model Schema is missing case1 and doesn't show case2 the way I would expect.

{
  "case2.field3": "string",
  "case2.field4": "string",
  "_id": "string"
}

Expected:

{
  "case1": {"field1": "string", "field2": "string"}
  "case2": {"field3": "string", "field4": "string"}
  "_id": "string"
}

Note, that if the field is an array, it does show up correctly:

{
  "case3": [{"field5": "string", "field6": "string"}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant