user14401217
user14401217

Reputation: 11

How to use the same method name with different tags in an OpenAPI file?

I have a scenario where I have two different tags with same method name. But it's throwing a syntax error in Swagger Editor saying "duplicated mapping key".

What is the correct way to write this in OpenAPI?

   /get_property:
     post:
       tags:
         - Car
   /get_property:
     post:
       tags:
        - Bike

Upvotes: 1

Views: 756

Answers (1)

Helen
Helen

Reputation: 97717

tags can be a list of tags, not just a single tag. You should use a single operation and put all applicable tags in the tags list:

paths:
  /get_property:
    post:
      tags:
        - Car
        - Bike

Upvotes: 1

Related Questions