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: bodyis 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 $refin 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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -