cancel
Showing results for 
Search instead for 
Did you mean: 

2 exact paths that produce different Media Types in the Specification

SOLVED
Highlighted
New Contributor

2 exact paths that produce different Media Types in the Specification

We have a current 2 GET endpoints with same path but produces different media type. How can I add them to the openAPI specification yaml ?

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator

Re: 2 exact paths that produce different Media Types in the Specification

That is supported in OpenAPI 3.0 only.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

3 REPLIES 3
Highlighted
Moderator

Re: 2 exact paths that produce different Media Types in the Specification

In OpenAPI 2.0:

 

swagger: "2.0"
...

paths:
  /something:
    get:
      produces:
        - application/json
        - application/xml
      responses:
        200:
          description: OK
          schema:
            ...

 

 

In OpenAPI 3.0:

 

openapi: 3.0.0
...

paths:
  /something:
    get:
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                ...
            application/xml:
              schema:
                ...

 


Helen Kosova
SmartBear Documentation Team Lead
________________________
Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
New Contributor

Re: 2 exact paths that produce different Media Types in the Specification

@HKosova Thanks for the reply. I forgot to mention that both responses also have different schemas. I see that we have the possibility in 3.0 but not in 2.0. Or do I miss something ?

Moderator

Re: 2 exact paths that produce different Media Types in the Specification

That is supported in OpenAPI 3.0 only.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors