swagger - Validation error: Data does not match any schemas from 'oneOf' -
i'm getting error data not match schemas 'oneof'
following spec:
{ "info": { "version": "1.0.0", "title": "rest api" }, "paths": { "/doit": { "post": { "responses": { "200": { "description": "successful response" } }, "parameters": [ { "type": "object", "schema": { "$ref": "#/definitions/responsedefinition" }, "required": "true", "name": "docs", "in": "body" } ] } } }, "swagger": "2.0", "definitions": { "responsedefinition": { "type": "object", "properties": { "text": { "type": "string", "description": "" } } } } }
this full errorfrom swagger-tools validator:
#/paths/~1doit/post/parameters/0: data not match schemas 'oneof' #/paths/~1doit/post/parameters/0: data not match schemas 'oneof' #/required: expected type boolean found type string #/: missing required property: type #/paths/~1doit/post/parameters/0: additional properties not allowed: in,name,required,schema
i don't understand error or how resolve.
you can't include type
in body
parameter. that's why there's schema
. try this:
{ "info": { "version": "1.0.0", "title": "rest api" }, "paths": { "/doit": { "post": { "responses": { "200": { "description": "successful response" } }, "parameters": [ { "schema": { "$ref": "#/definitions/responsedefinition" }, "required": "true", "name": "docs", "in": "body" } ] } } }, "swagger": "2.0", "definitions": { "responsedefinition": { "type": "object", "properties": { "text": { "type": "string", "description": "" } } } } }
Comments
Post a Comment