Forum Discussion

Gbemiga's avatar
Gbemiga
New Contributor
10 months ago

My code in Swagger ui editor has Errors Parser error duplicated mapping key

I've read the docs numerous times but I can't get rid of the error. Id's are supposed to be able to be passed as parameters to the routes but the error doesn't let this happen. What can be done to make it function as it should and allow id's to be passed the routes where it's needed? The error I get is Errors Parser error duplicated mapping key.

 

 

 

openapi: 3.0.0
info:
  title: CAR-RENTAL
  description: ''
  contact:
    name: Gbemiga
    url: https://gbemolio.netlify.app/
    email: gbae@gmail.com
  version: '1.0'
servers:
- url: https://brainy-clothes-fish.cyclic.app/api/v1
  variables: {}
paths:
  /auth/register:
    post:
      tags:
      - Auth
      summary: Register User
      operationId: RegisterUser
      parameters: []
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/RegisterUserRequest'
              - example:
                  email: test@gmail.com
                  password: secret
            example:
              email: test@gmail.com
              password: secret
        required: true
      responses:
        '200':
          description: ''
          headers: {}
      deprecated: false
      security: []
  /auth/login:
    post:
      tags:
      - Auth
      summary: Login User
      operationId: LoginUser
      parameters: []
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/LoginUserRequest'
              - example:
                  email: hh@gmail.com
                  password: secret
            example:
              email: hh@gmail.com
              password: secret
        required: true
      responses:
        '200':
          description: ''
          headers: {}
      deprecated: false
      security: []
  /vehicles:
    get:
      tags:
      - Vehicles
      summary: Get All Vehicles
      operationId: GetAllVehicles
      parameters: []
      responses:
        '200':
          description: ''
          headers: {}
      deprecated: false
      security: []
    post:
      tags:
      - Vehicles
      summary: Add Vehicle
      operationId: AddVehicle
      parameters: []
      requestBody:
        content:
          multipart/form-data:
            encoding: {}
            schema:
              required:
              - pictures
              - name
              - transmission
              - colour
              - description
              - seat
              - price
              - type
              type: object
              properties:
                pictures:
                  type: string
                  format: binary
                name:
                  type: string
                  example: fine carh
                transmission:
                  type: string
                  example: Manual
                colour:
                  type: string
                  example: uhhf
                description:
                  type: string
                  example: jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj sssssssssssssssssssssssssssss aaaaaaaaaaaaaaaaaaaaaa wwwwwwwwwwwwwwwwwwwww
                seat:
                  type: integer
                  format: int32
                  example: 4
                price:
                  type: integer
                  format: int32
                  example: 278
                type:
                  type: string
                  example: Suv
        required: false
      responses:
        '200':
          description: ''
          headers: {}
      deprecated: false
    patch:
      tags:
      - Vehicles
      summary: Update Vehicle
      operationId: UpdateVehicle
      parameters: []
      requestBody:
        content:
          multipart/form-data:
            encoding: {}
            schema:
              required:
              - pictures
              - description
              - colour
              - transmission
              - seat
              - price
              - name
              - type
              type: object
              properties:
                pictures:
                  type: string
                  format: binary
                description:
                  type: string
                  example: good bcbcnc dnddddddddddddddddddddddddddb fjfjjjjjjjjjjjjjjjjjjjjv shhdhdhhdhdh eiiririririri fffffffffffffffffffffffffffff
                colour:
                  type: string
                  example: blue
                transmission:
                  type: string
                  example: Manual
                seat:
                  type: integer
                  format: int32
                  example: 2
                price:
                  type: integer
                  format: int32
                  example: 40
                name:
                  type: string
                  example: aak
                type:
                  type: string
                  example: Suv
        required: false
      responses:
        '200':
          description: ''
          headers: {}
      deprecated: false
      /vehicles/{id}:
    get:
      parameters:
        - in: path
          name: id   # Note the name is the same as in the path
          required: true
          schema:
            type: string
            minimum: 1
          description: The vehicle ID
    delete:
      tags:
      - Vehicles
      summary: Delete Vehicle
      operationId: DeleteVehicle
      parameters: []
      responses:
        '200':
          description: ''
          headers: {}
      deprecated: false
      /vehicles/{id}:
    get:
      parameters:
        - in: path
          name: id   # Note the name is the same as in the path
          required: true
          schema:
            type: string
            minimum: 1
          description: The vehicle ID
  /profile:
    post:
      tags:
      - Profile
      summary: Create Profile
      operationId: CreateProfile
      parameters: []
      requestBody:
        content:
          multipart/form-data:
            encoding: {}
            schema:
              type: object
              properties:
                picture:
                  type: string
                  format: binary
                description:
                  type: string
                  example: link check
                name:
                  type: string
        required: false
      responses:
        '200':
          description: ''
          headers: {}
      deprecated: false
    patch:
      tags:
      - Profile
      summary: Update Profile
      operationId: UpdateProfile
      parameters: []
      requestBody:
        content:
          multipart/form-data:
            encoding: {}
            schema:
              required:
              - picture
              - name
              type: object
              properties:
                picture:
                  type: string
                  format: binary
                name:
                  type: string
                  example: usid
        required: false
      responses:
        '200':
          description: ''
          headers: {}
      deprecated: false
      /profile/{id}:
    get:
      parameters:
        - in: path
          name: id   # Note the name is the same as in the path
          required: true
          schema:
            type: string
            minimum: 1
          description: The string ID
    get:
      tags:
      - Profile
      summary: Get Single Profile
      operationId: GetSingleProfile
      parameters: []
      responses:
        '200':
          description: ''
          headers: {}
      deprecated: false
      get:
      parameters:
        - in: path
          name: id   # Note the name is the same as in the path
          required: true
          schema:
            type: string
            minimum: 1
          description: The string ID
  /auth/logout:
    post:
      tags:
      - Profile
      summary: Logout Profile
      operationId: LogoutProfile
      parameters: []
      responses:
        '200':
          description: ''
          headers: {}
      deprecated: false
  /search:
    get:
      tags:
      - Search
      summary: Search
      operationId: Search
      parameters:
      - name: name
        in: header
        description: ''
        required: true
        style: simple
        schema:
          type: string
          example: newest
      responses:
        '200':
          description: ''
          headers: {}
      deprecated: false
      security: []
components:
  schemas:
    RegisterUserRequest:
      title: RegisterUserRequest
      required:
      - email
      - password
      type: object
      properties:
        email:
          type: string
        password:
          type: string
      example:
        email: test@gmail.com
        password: secret
    LoginUserRequest:
      title: LoginUserRequest
      required:
      - email
      - password
      type: object
      properties:
        email:
          type: string
        password:
          type: string
      example:
        email: hh@gmail.com
        password: secret
  securitySchemes:
    httpBearer:
      type: http
      scheme: bearer
security:
- httpBearer: []
tags:
- name: Misc
  description: ''
- name: Auth
  description: ''
- name: Vehicles
  description: ''
- name: Profile
  description: ''
- name: Search
  description: ''

 

 

5 Replies

    • Gbemiga's avatar
      Gbemiga
      New Contributor

      Hello chichepo 
      That error is gone. I get this error 
      Errors
      Structural error at paths./vehicles.patch
      should NOT have additional properties
      additionalProperty: paths
      Jump to line 135
      Structural error at paths./vehicles.delete
      should NOT have additional properties
      additionalProperty: paths
      Jump to line 200
      Structural error at paths./profile.patch
      should NOT have additional properties
      additionalProperty: paths
      Jump to line 250
      Structural error at paths./profile.get
      should NOT have additional properties
      additionalProperty: paths
      Jump to line 289

      This is the original code without the Path Parameters. I want to allow id's to be passed as params to the following routes. Update Vehicle, Delete Vehicle, Update Profile, Get Single Profile.

      openapi: 3.0.0
      info:
        title: CAR-RENTAL
        description: ''
        contact:
          name: Gbemiga
          url: https://gbemolio.netlify.app/
          email: gbae@gmail.com
        version: '1.0'
      servers:
      - url: https://brainy-clothes-fish.cyclic.app/api/v1
        variables: {}
      paths:
        /auth/register:
          post:
            tags:
            - Auth
            summary: Register User
            operationId: RegisterUser
            parameters: []
            requestBody:
              description: ''
              content:
                application/json:
                  schema:
                    allOf:
                    - $ref: '#/components/schemas/RegisterUserRequest'
                    - example:
                        email: test@gmail.com
                        password: secret
                  example:
                    email: test@gmail.com
                    password: secret
              required: true
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
            security: []
        /auth/login:
          post:
            tags:
            - Auth
            summary: Login User
            operationId: LoginUser
            parameters: []
            requestBody:
              description: ''
              content:
                application/json:
                  schema:
                    allOf:
                    - $ref: '#/components/schemas/LoginUserRequest'
                    - example:
                        email: hh@gmail.com
                        password: secret
                  example:
                    email: hh@gmail.com
                    password: secret
              required: true
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
            security: []
        /vehicles:
          get:
            tags:
            - Vehicles
            summary: Get All Vehicles
            operationId: GetAllVehicles
            parameters: []
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
            security: []
          post:
            tags:
            - Vehicles
            summary: Add Vehicle
            operationId: AddVehicle
            parameters: []
            requestBody:
              content:
                multipart/form-data:
                  encoding: {}
                  schema:
                    required:
                    - pictures
                    - name
                    - transmission
                    - colour
                    - description
                    - seat
                    - price
                    - type
                    type: object
                    properties:
                      pictures:
                        type: string
                        format: binary
                      name:
                        type: string
                        example: fine carh
                      transmission:
                        type: string
                        example: Manual
                      colour:
                        type: string
                        example: uhhf
                      description:
                        type: string
                        example: jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj sssssssssssssssssssssssssssss aaaaaaaaaaaaaaaaaaaaaa wwwwwwwwwwwwwwwwwwwww
                      seat:
                        type: integer
                        format: int32
                        example: 4
                      price:
                        type: integer
                        format: int32
                        example: 278
                      type:
                        type: string
                        example: Suv
              required: false
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
          patch:
            tags:
            - Vehicles
            summary: Update Vehicle
            operationId: UpdateVehicle
            parameters: []
            requestBody:
              content:
                multipart/form-data:
                  encoding: {}
                  schema:
                    required:
                    - pictures
                    - description
                    - colour
                    - transmission
                    - seat
                    - price
                    - name
                    - type
                    type: object
                    properties:
                      pictures:
                        type: string
                        format: binary
                      description:
                        type: string
                        example: good bcbcnc dnddddddddddddddddddddddddddb fjfjjjjjjjjjjjjjjjjjjjjv shhdhdhhdhdh eiiririririri fffffffffffffffffffffffffffff
                      colour:
                        type: string
                        example: blue
                      transmission:
                        type: string
                        example: Manual
                      seat:
                        type: integer
                        format: int32
                        example: 2
                      price:
                        type: integer
                        format: int32
                        example: 40
                      name:
                        type: string
                        example: aak
                      type:
                        type: string
                        example: Suv
              required: false
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
          delete:
            tags:
            - Vehicles
            summary: Delete Vehicle
            operationId: DeleteVehicle
            parameters: []
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
        /profile:
          post:
            tags:
            - Profile
            summary: Create Profile
            operationId: CreateProfile
            parameters: []
            requestBody:
              content:
                multipart/form-data:
                  encoding: {}
                  schema:
                    type: object
                    properties:
                      picture:
                        type: string
                        format: binary
                      description:
                        type: string
                        example: link check
                      name:
                        type: string
              required: false
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
          patch:
            tags:
            - Profile
            summary: Update Profile
            operationId: UpdateProfile
            parameters: []
            requestBody:
              content:
                multipart/form-data:
                  encoding: {}
                  schema:
                    required:
                    - picture
                    - name
                    type: object
                    properties:
                      picture:
                        type: string
                        format: binary
                      name:
                        type: string
                        example: usid
              required: false
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
          get:
            tags:
            - Profile
            summary: Get Single Profile
            operationId: GetSingleProfile
            parameters: []
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
        /auth/logout:
          post:
            tags:
            - Profile
            summary: Logout Profile
            operationId: LogoutProfile
            parameters: []
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
        /search:
          get:
            tags:
            - Search
            summary: Search
            operationId: Search
            parameters:
            - name: name
              in: header
              description: ''
              required: true
              style: simple
              schema:
                type: string
                example: newest
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
            security: []
      components:
        schemas:
          RegisterUserRequest:
            title: RegisterUserRequest
            required:
            - email
            - password
            type: object
            properties:
              email:
                type: string
              password:
                type: string
            example:
              email: test@gmail.com
              password: secret
          LoginUserRequest:
            title: LoginUserRequest
            required:
            - email
            - password
            type: object
            properties:
              email:
                type: string
              password:
                type: string
            example:
              email: hh@gmail.com
              password: secret
        securitySchemes:
          httpBearer:
            type: http
            scheme: bearer
      security:
      - httpBearer: []
      tags:
      - name: Misc
        description: ''
      - name: Auth
        description: ''
      - name: Vehicles
        description: ''
      - name: Profile
        description: ''
      - name: Search
        description: ''


      Error code. This is what I have done that gives me the errors at the top

      openapi: 3.0.0
      info:
        title: CAR-RENTAL
        description: ''
        contact:
          name: Gbemiga
          url: https://gbemolio.netlify.app/
          email: gbae@gmail.com
        version: '1.0'
      servers:
      - url: https://brainy-clothes-fish.cyclic.app/api/v1
        variables: {}
      paths:
        /auth/register:
          post:
            tags:
            - Auth
            summary: Register User
            operationId: RegisterUser
            parameters: []
            requestBody:
              description: ''
              content:
                application/json:
                  schema:
                    allOf:
                    - $ref: '#/components/schemas/RegisterUserRequest'
                    - example:
                        email: test@gmail.com
                        password: secret
                  example:
                    email: test@gmail.com
                    password: secret
              required: true
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
            security: []
        /auth/login:
          post:
            tags:
            - Auth
            summary: Login User
            operationId: LoginUser
            parameters: []
            requestBody:
              description: ''
              content:
                application/json:
                  schema:
                    allOf:
                    - $ref: '#/components/schemas/LoginUserRequest'
                    - example:
                        email: hh@gmail.com
                        password: secret
                  example:
                    email: hh@gmail.com
                    password: secret
              required: true
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
            security: []
        /vehicles:
          get:
            tags:
            - Vehicles
            summary: Get All Vehicles
            operationId: GetAllVehicles
            parameters: []
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
            security: []
          post:
            tags:
            - Vehicles
            summary: Add Vehicle
            operationId: AddVehicle
            parameters: []
            requestBody:
              content:
                multipart/form-data:
                  encoding: {}
                  schema:
                    required:
                    - pictures
                    - name
                    - transmission
                    - colour
                    - description
                    - seat
                    - price
                    - type
                    type: object
                    properties:
                      pictures:
                        type: string
                        format: binary
                      name:
                        type: string
                        example: fine carh
                      transmission:
                        type: string
                        example: Manual
                      colour:
                        type: string
                        example: uhhf
                      description:
                        type: string
                        example: jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj sssssssssssssssssssssssssssss aaaaaaaaaaaaaaaaaaaaaa wwwwwwwwwwwwwwwwwwwww
                      seat:
                        type: integer
                        format: int32
                        example: 4
                      price:
                        type: integer
                        format: int32
                        example: 278
                      type:
                        type: string
                        example: Suv
              required: false
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
          patch:
            tags:
            - Vehicles
            summary: Update Vehicle
            operationId: UpdateVehicle
            parameters: []
            requestBody:
              content:
                multipart/form-data:
                  encoding: {}
                  schema:
                    required:
                    - pictures
                    - description
                    - colour
                    - transmission
                    - seat
                    - price
                    - name
                    - type
                    type: object
                    properties:
                      pictures:
                        type: string
                        format: binary
                      description:
                        type: string
                        example: good bcbcnc dnddddddddddddddddddddddddddb fjfjjjjjjjjjjjjjjjjjjjjv shhdhdhhdhdh eiiririririri fffffffffffffffffffffffffffff
                      colour:
                        type: string
                        example: blue
                      transmission:
                        type: string
                        example: Manual
                      seat:
                        type: integer
                        format: int32
                        example: 2
                      price:
                        type: integer
                        format: int32
                        example: 40
                      name:
                        type: string
                        example: aak
                      type:
                        type: string
                        example: Suv
              required: false
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
            paths:
              /vehicle/{id}:
                get:
                  parameters:
                    - in: path
                      name: id   # Note the name is the same as in the path
                      required: true
                      schema:
                        type: string
                        minimum: 1
                      description: The vehicle ID
          delete:
            tags:
            - Vehicles
            summary: Delete Vehicle
            operationId: DeleteVehicle
            parameters: []
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
            paths:
              /vehicle/{id}:
                get:
                  parameters:
                    - in: path
                      name: id   # Note the name is the same as in the path
                      required: true
                      schema:
                        type: string
                        minimum: 1
                      description: The vehicle ID
        /profile:
          post:
            tags:
            - Profile
            summary: Create Profile
            operationId: CreateProfile
            parameters: []
            requestBody:
              content:
                multipart/form-data:
                  encoding: {}
                  schema:
                    type: object
                    properties:
                      picture:
                        type: string
                        format: binary
                      description:
                        type: string
                        example: link check
                      name:
                        type: string
              required: false
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
          patch:
            tags:
            - Profile
            summary: Update Profile
            operationId: UpdateProfile
            parameters: []
            requestBody:
              content:
                multipart/form-data:
                  encoding: {}
                  schema:
                    required:
                    - picture
                    - name
                    type: object
                    properties:
                      picture:
                        type: string
                        format: binary
                      name:
                        type: string
                        example: usid
              required: false
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
            paths:
              /profile/{id}:
                get:
                  parameters:
                    - in: path
                      name: id   # Note the name is the same as in the path
                      required: true
                      schema:
                        type: string
                        minimum: 1
                      description: The profile ID
          get:
            tags:
            - Profile
            summary: Get Single Profile
            operationId: GetSingleProfile
            parameters: []
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
            paths:
              /profile/{id}:
                get:
                  parameters:
                    - in: path
                      name: id   # Note the name is the same as in the path
                      required: true
                      schema:
                        type: string
                        minimum: 1
                      description: The profile ID
        /auth/logout:
          post:
            tags:
            - Profile
            summary: Logout Profile
            operationId: LogoutProfile
            parameters: []
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
        /search:
          get:
            tags:
            - Search
            summary: Search
            operationId: Search
            parameters:
            - name: name
              in: header
              description: ''
              required: true
              style: simple
              schema:
                type: string
                example: newest
            responses:
              '200':
                description: ''
                headers: {}
            deprecated: false
            security: []
      components:
        schemas:
          RegisterUserRequest:
            title: RegisterUserRequest
            required:
            - email
            - password
            type: object
            properties:
              email:
                type: string
              password:
                type: string
            example:
              email: test@gmail.com
              password: secret
          LoginUserRequest:
            title: LoginUserRequest
            required:
            - email
            - password
            type: object
            properties:
              email:
                type: string
              password:
                type: string
            example:
              email: hh@gmail.com
              password: secret
        securitySchemes:
          httpBearer:
            type: http
            scheme: bearer
      security:
      - httpBearer: []
      tags:
      - name: Misc
        description: ''
      - name: Auth
        description: ''
      - name: Vehicles
        description: ''
      - name: Profile
        description: ''
      - name: Search
        description: ''



      • chichepo's avatar
        chichepo
        Champion Level 3

        You obviously have trouble to write correct syntax in your file

        I suggest you to use a kind of swagger generator.
        You can also submit your code on ChatGPT for debugging