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.

Add support for different response content types

See original GitHub issue

Swagger supports different content types in the response like this:

/health:
  get:
    responses:
      '200':
        description: Successful response
        content:
          text/plain:
            schema:
              type: string
              enum: ['UP','DOWN']

Currently it is not possible to define a response like this with fastify-swagger.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
mcollinacommented, Oct 20, 2018

Currently we don’t. I think we should enable this, but I’m not exactly seeing how. Would you mind to do a proposal? A PR would even be better.

We might even be lacking support for this in fastify itself.

Il giorno mer 17 ott 2018 alle 10:22 Gyula Szalai notifications@github.com ha scritto:

Swagger supports different content types in the response like this:

/health: get: responses: ‘200’: description: Successful response content: text/plain: schema: type: string enum: [‘UP’,‘DOWN’]

Currently it is not possible to define a response like this with fastify-swagger.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fastify/fastify-swagger/issues/117, or mute the thread https://github.com/notifications/unsubscribe-auth/AADL41g_ezDOCGdyy3eVon1ICna3R4Jkks5ulujYgaJpZM4XjYWt .

0reactions
climba03003commented, Feb 25, 2022

Where can the response type be configured so it appears in swagger ?

produces for response.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add support for different content-type response #3902 - GitHub
With OAS3 is possible to answer with multiple content types with the same status code, but the field produces of Swagger 2 does...
Read more >
Content-Type - HTTP - MDN Web Docs - Mozilla
In responses, a Content-Type header provides the client with the actual content type of the returned content. This header's value may be ...
Read more >
Does the HTTP Protocol support multiple content types in ...
I'm wondering if I can return the response header. Content-Type: application/json text/ ...
Read more >
Using content negotiation to serve multiple content types ... - IBM
Content negotiation is the method in which the client and server agree on the response content type to use. There are three types...
Read more >
HTTP Content Negotiation in REST APIs
Another way to pass content type information to the server, the client may use the specific extension in resource URIs.
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