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
I always get the cast Error, the schema compiled but it is not working.
This is when trying to save a sub array which its items are $ref...
error ValidationError: children: Cast to Array failed for value "[ { firstName: 'Sagi' }, { firstName: 'Tamir' } ]" at path "children"
and this is when saving a sub document which is from type object
error ValidationError: child1: Cast to ObjectID failed for value "{ firstName: 'Sagi' }" at path "child1"
Here is the JSON:
`{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "accounts",
"contact": {
"name": "",
"email": "test@gmail.com"
},
"license": {
"name": "The MIT License (MIT)",
"url": "https://opensource.org/licenses/MIT"
}
},
"basePath": "/database/schemes",
"schemes": [
"http"
],
"x-swagger-mongoose": {
"validators": "./api/system/database/schemas/validators",
"description": "The relative path to validators library from process.cwd()"
},
"paths": {
"/parents": {
"get": {
"tags": [
"parents Operations"
],
"summary": "finds parents in the system",
"responses": {
"200": {
"description": "parents response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/parent"
}
},
"headers": {
"x-expires": {
"type": "string"
}
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
}
},
"definitions": {
"parent": {
"required": [
"firstName",
"lastName"
],
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"child1": {
"type": "object",
"x-swagger-mongoose": {
"$ref": "#/definitions/child"
}},
"child2": {
"type": "object",
"properties":{
"firstName":{
"type": "string"
}
}
},
I always get the cast Error, the schema compiled but it is not working.
This is when trying to save a sub array which its items are $ref...
error ValidationError: children: Cast to Array failed for value "[ { firstName: 'Sagi' }, { firstName: 'Tamir' } ]" at path "children"
and this is when saving a sub document which is from type object
error ValidationError: child1: Cast to ObjectID failed for value "{ firstName: 'Sagi' }" at path "child1"
Here is the JSON:
`{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "accounts",
"contact": {
"name": "",
"email": "test@gmail.com"
},
"license": {
"name": "The MIT License (MIT)",
"url": "https://opensource.org/licenses/MIT"
}
},
"basePath": "/database/schemes",
"schemes": [
"http"
],
"x-swagger-mongoose": {
"validators": "./api/system/database/schemas/validators",
"description": "The relative path to validators library from process.cwd()"
},
"paths": {
"/parents": {
"get": {
"tags": [
"parents Operations"
],
"summary": "finds parents in the system",
"responses": {
"200": {
"description": "parents response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/parent"
}
},
"headers": {
"x-expires": {
"type": "string"
}
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
}
},
"definitions": {
"parent": {
"required": [
"firstName",
"lastName"
],
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"child1": {
"type": "object",
"x-swagger-mongoose": {
"$ref": "#/definitions/child"
}},
"child2": {
"type": "object",
"properties":{
"firstName":{
"type": "string"
}
}
},
}
}`
The text was updated successfully, but these errors were encountered: