You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: Unrecognized schema type: undefined
at propertyMap (node_modules\swagger-mongoose\lib\index.js:48:13)
at getSchemaProperty (node_modules\swagger-mongoose\lib\index.js:240:16)
at node_modules\swagger-mongoose\lib\index.js:217:26
at node_modules\swagger-mongoose\node_modules\lodash\lodash.js:4944:15
at baseForOwn (node_modules\swagger-mongoose\node_modules\lodash\lodash.js:3001:24)
at node_modules\swagger-mongoose\node_modules\lodash\lodash.js:4913:18
at Function.forEach (node_modules\swagger-mongoose\node_modules\lodash\lodash.js:9359:14)
at getSchema (node_modules\swagger-mongoose\lib\index.js:216:5)
at node_modules\swagger-mongoose\lib\index.js:319:14
at node_modules\swagger-mongoose\node_modules\lodash\lodash.js:4944:15
at baseForOwn (node_modules\swagger-mongoose\node_modules\lodash\lodash.js:3001:24)
at node_modules\swagger-mongoose\node_modules\lodash\lodash.js:4913:18
at Function.forEach (node_modules\swagger-mongoose\node_modules\lodash\lodash.js:9359:14)
at Object.module.exports.compile (node_modules\swagger-mongoose\lib\index.js:307:5)
at Object.<anonymous> (api\models\db.js:11:31)
at Module._compile (module.js:570:32)
However, encapsulating the array in an object works properly:
definitions:
Servers:
description: Many Servers
type: object
properties:
servers:
type: array
items:
$ref: "#/definitions/Server"
Server:
type: object
properties:
uid:
type: string
description: Unique server ID
name:
type: string
description: FQDN
The text was updated successfully, but these errors were encountered:
What is the desired functionality for a top level array? What would you expect it to do on the mongo side as the object is the essence of the database collection that gets created? If you do:
Just had a similar problem. Yes, it fails, probably because getSchema is called before checking for exclude-schema.
Upd: this is resloved in the repository but not in the files pulled from npm registry (even though the version matches). Could be something with my npm cache but it's the first version I installed.
Anyway, doing something with arrays like that is probably a good idea. Even as simple as ignoring them and mentioning it in the docs.
I've given the swagger definitions in YAML, but I'm converting it to JSON before compilation.
This returns:
However, encapsulating the
array
in anobject
works properly:The text was updated successfully, but these errors were encountered: