question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'duplicated mapping key' error occurred, if set same paths with different method (OAS3)

See original GitHub issue

‘duplicated mapping key’ error occurred, if set same paths with different method (OAS3)

Steps to reproduce the behavior:

  1. Docker Run swagger-ui with yaml file below
  2. Then See errors ‘duplicated mapping key’

Q&A

  • OS: OSX High Sierra
  • Browser: Safari
  • Version: 13.1
  • Method of installation: docker run
  • Swagger-UI version: 3.18.3
  • Swagger/OpenAPI version: OpenAPI 3.0

Example Swagger/OpenAPI definition:

openapi: 3.0.0
info:
  description: bug test
  version: "1.0"
  title: sample
tags:
  - name: user
    description: user
paths:
  /user:
    post:
      tags:
        - user
      summary: User Register
      description: ""
      operationId: UserPost
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                password:
                  type: string
        required: true
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
        "400":
          description: エラー
          content:
            application/json:
              schema:
                type: object
                properties:
                    message:
                        type: string
  /user:
    delete:
      tags:
        - user
      summary: User Deletion
      description: ""
      operationId: UserDelete
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
        required: true
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
        "400":
          description: エラー
          content:
            application/json:
              schema:
                type: object
                properties:
                    message:
                        type: string

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

56reactions
hkosovacommented, May 4, 2020

This is not a valid API definition.

Each path must be listed only once, and all HTTP methods applicable to that path must be listed under that path, as follows:

paths:
  /user:
    post:
      ...
    delete:
       ...
1reaction
8ivekcommented, May 23, 2021

This is not a valid API definition.

Each path must be listed only once, and all HTTP methods applicable to that path must be listed under that path, as follows:

paths:
  /user:
    post:
      ...
    delete:
       ...

Thanks for this

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swagger Parser error duplicated mapping key - Stack Overflow
Hi friends, I have an error during yaml API testing in Swagger editor. I have duplicate mapping key error in line no 98 ......
Read more >
How to use a same method name with different tags?
But its throwing compilation error in swagger editor saying that "duplicated mapping key". /get_property: post: tags: - Car /get_property: post: ...
Read more >
Swagger giving Duplicate key class parameter error
When I erase the controller having same endpoints name, everything just works fine. So is there any way out of it without changing...
Read more >
OpenAPI Specification - Version 3.0.3 - Swagger
This includes all fields that are used as keys in a map, except where explicitly noted ... Holds a set of reusable objects...
Read more >
Step 4: The paths object (OpenAPI tutorial) | Documenting APIs
The paths object has several sub-objects: a path items object, ... POST, PUT, and DELETE methods we explored in the Endpoints section of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found