Schema error Specs : body not accepted

Hi

I am writing a "Spec" on an existing APIProxy and I have the following error :

Schema error at paths['/user'].post.parameters[0].in
should be equal to one of the allowed values
allowedValues: path, query, header, cookie
Jump to line 36

Schema error at paths['/user'].post.parameters[0]
should match exactly one schema in oneOf
Jump to line 36

Spec :

paths:
  /user:
    post:
      tags:
        - user
      summary: Create user
      description: This can only be done by the logged in user.
      operationId: createUser
      parameters:
        - in: body
          name: message
          description: Created user object
          required: true
          schema:
            $ref: '#/components/schemas/MessagePost'
      responses:
        default:
          description: successful operation
          
components:
  schemas:
    MessagePost:
      type: object
      properties:
        dataType:
          type: string
        subscription:
          type: object
          properties:
            id:
              type: string
            status:
              type : string
            url:
              type: string
        general_information:
          type: object
          properties:
            client_booking_number:
              type : string
            client_reference:
              type: string
            shipment_reference:
              type: string
            consignor :
              type: string
            consignee:
              type: string
            flow_type:
              type: string
        products:
          type : object
          properties:
            volume :
              type: number
            gross_weight: 
              type: number
            package_number: 
              type: number
            description:
              type: boolean
        bookings:
          type: object
          properties:
            data_type:
              type: string
            transports_type:
              type: string
            carrier:
              type: string
            event_date:
              type: string
            planned_departure_time:
              type: string
            planned_arrival_time:
              type: string
            origin_location:
              type: object
            destination_location:
              type: object
            forwarder:
              type: string
            forwarder-reference:
              type: string
            master_awb:
              type: string
            house_awb:
              type: string
            flight_number:
              type: string
        last_position:
          type: object
          properties:
            latitude:
              type: number
            longitude:
              type: number
            timestamp:
              type: string


Where does it come from please?

Thank you

0 4 824
4 REPLIES 4

@Jordan Argento - Can you share the full specs

10000

Ensure you're specifying in your API Spec the correct version

swagger: "2.0"

Then you also need to update the components to follow openapi 2.0

Otherwise you need to follow the openapi 3.0 conventions in your path. You can follow the details here

For example

openapi: 3.0.3

...

paths:
  /user:
    post:
      tags:
        - user
      summary: Create user
      description: This can only be done by the logged in user.
      operationId: createUser
      requestBody:
          description: Created user object
          required: true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessagePost'

Sure, this was almost the whole thing

openapi: 3.0.3



info:
  version: 0.0.1
  title: gm-wakep-v1
  description: |
    A brief description of the API.
    It can be multiple lines.


    This API follows the recommendations of the
    [API Improvement Proposals](https://google.aip.dev/).


servers: 
  - url: https://myURL
  
paths:
  /user:
    post:
      tags:
        - user
      summary: Create user
      description: This can only be done by the logged in user.
      operationId: createUser
      parameters:
        - in: body
          name: message
          description: Created user object
          required: true
          schema:
            $ref: '#/components/schemas/MessagePost'
      responses:
        default:
          description: successful operation
components:
  schemas:
    MessagePost:
      type: object
      properties:
        dataType:
          type: string
        subscription:
          type: object
          properties:
            id:
              type: string
            status:
              type : string
            url:
              type: string
        general_information:
          type: object
          properties:
            client_booking_number:
              type : string
            client_reference:
              type: string
            shipment_reference:
              type: string
            consignor :
              type: string
            consignee:
              type: string
            flow_type:
              type: string
        products:
          type : object
          properties:
            volume :
              type: number
            gross_weight: 
              type: number
            package_number: 
              type: number
            description:
              type: boolean
        bookings:
          type: object
          properties:
            data_type:
              type: string
            transports_type:
              type: string
            carrier:
              type: string
            event_date:
              type: string
            planned_departure_time:
              type: string
            planned_arrival_time:
              type: string
            origin_location:
              type: object
            destination_location:
              type: object
            forwarder:
              type: string
            forwarder-reference:
              type: string
            master_awb:
              type: string
            house_awb:
              type: string
            flight_number:
              type: string
        last_position:
          type: object
          properties:
            latitude:
              type: number
            longitude:
              type: number
            timestamp:
              type: string