Data does not match any schemas from 'oneOf' - Error

Invoking the following error using the swagger online editor. Data does not match any schemes from 'oneOf'

'/tenants/tenant_id/groups/group_id':
get:
  description: 'Returns the group with specific id ( id, name, description, tenant_id... ) along with end point pools ( id, name, description, source, tenant_id... ) associated with this 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 with 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

The error is shown below on line 206, which is a line starting with "parameters"

✖ Swagger Error

Data does not match any schemas from 'oneOf'   
Jump to line 206
Details
Object
code: "ONE_OF_MISSING"   
message: "Data does not match any schemas from '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 does not match any schemas from '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 does not match any schemas from 'oneOf'"
lineNumber: 206

I tried changing the type: the line under the definition is still out of luck. I am sure I am missing the correct type value here, appreciate any help

thank you

+4
source share
1 answer

schema, in: body. (, ,...).

, , :

  • token_string
  • $ref

( getGroupWithKey errorModel, ):

swagger: '2.0'
info:
  version: 1.0.0
  title: Header API
  description: A simple API to learn how you can define headers

paths:
  '/tenants/tenant_id/groups/group_id':
    get:
      description: 'Returns the group with specific id ( id, name, description, tenant_id... ) along with end point pools ( id, name, description, source, tenant_id... ) associated with this particular groups'
      operationId: getGroupWithKey
      consumes:
        - application/json
        - text/plain, */*
      produces:
        - text/xml
      parameters:
        - $ref: '#/parameters/token_string'
      responses:
        '200':
          description: OK (group with 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

, , inline, .

+2

Source: https://habr.com/ru/post/1609685/


All Articles