swagger - Data does not match any schemas from 'oneOf' - Error -
am hitting following error swagger online editor data not match schemas 'oneof'
'/tenants/tenant_id/groups/group_id': get: description: 'returns group specific id ( id, name, description, tenant_id... ) along end point pools ( id, name, description, source, tenant_id... ) associated particular groups' operationid: getgroupwithkey consumes: - application/json - text/plain, */* produces: - text/xml parameters: - in: header name: 'x-authtoken' description: authentication token obtained during login required: true schema: $ref: '#/definitions/token_string' responses: '200': description: ok (group provided id received) schema: $ref: '#/definitions/getgroupwithkey' default: description: error schema: $ref: '#/definitions/errormodel' definitions: ### login definitions ### token_string: type: object required: - 'x-authtoken' properties: x-authtoken: type: string
error bellow points line 206 line starting "parameters"
✖ swagger error data not match schemas 'oneof' jump line 206 details object code: "one_of_missing" message: "data not match schemas 'oneof'" path: array [5] 0: "paths" 1: "/tenants/tenant_id/groups/group_id" 2: "get" 3: "parameters" 4: "0" inner: array [2] 0: object code: "one_of_missing" message: "data not match schemas 'oneof'" path: array [5] inner: array [2] 1: object code: "object_missing_required_property" message: "missing required property: $ref" path: array [5] level: 900 type: "swagger error" description: "data not match schemas 'oneof'" linenumber: 206
i tried changing type: string under definition, still no luck. pretty sure missing proper type value here, appreciate help
thanks you
when defining header parameter cannot use schema
, it's allowed when in: body
is used. therefore header parameter can atomic property (string, number, ...).
it seems want define reusable header parameter, way:
- define token_string in parameters section
- then use
$ref
in operation's parameters
(i add dummy getgroupwithkey
, errormodel
make definition valid):
swagger: '2.0' info: version: 1.0.0 title: header api description: simple api learn how can define headers paths: '/tenants/tenant_id/groups/group_id': get: description: 'returns group specific id ( id, name, description, tenant_id... ) along end point pools ( id, name, description, source, tenant_id... ) associated particular groups' operationid: getgroupwithkey consumes: - application/json - text/plain, */* produces: - text/xml parameters: - $ref: '#/parameters/token_string' responses: '200': description: ok (group provided id received) schema: $ref: '#/definitions/getgroupwithkey' default: description: error schema: $ref: '#/definitions/errormodel' parameters: token_string: in: header name: x-authtoken type: string description: authentication token obtained during login required: true definitions: ### login definitions ### errormodel: type: string getgroupwithkey: type: string
you can of course define parameter inline if want. suggest take @ question on same topic define global parameters
Comments
Post a Comment