-
-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for different response content types #117
Comments
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
<#117>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AADL41g_ezDOCGdyy3eVon1ICna3R4Jkks5ulujYgaJpZM4XjYWt>
.
|
OpenAPIv2 (aka Swagger) do not support this format. but OpenAPIv3 does. |
@climba03003 Something like this (I just translated the OAS3 YAML example to JSON):
Not totally sure, but after looking at the fastify-swagger/lib/spec/openapi/utils.js Line 148 in 36bf409
For the sake of completeness, just an example of the origin OAS3 docs which is about different
Thanks! |
This packages is not independent from If you need to do it. Please use For the question about |
Thank you for this clear answer and sorry for beeing not so clear... I hope I didn't waste too much of your time ;-) If it makes sense, one last question: Beside all that it looks like that it's easier and more pragmatic to split the different media types across different routes, something like this:
|
Forget about this question, it makes sense ;-) |
You can achieve it by not passing
No, we current do not allow to pass If you have any more question. Please open a new Issue. |
Got it, thank you for your detailed explanation! |
So right now there is no way to change a response type in the swagger documentation generated? |
You can specify the response type, but you cannot have different type with different response schema. If you have further question, please raise an issue. |
Where can the response type be configured so it appears in swagger ? |
|
Swagger supports different content types in the response like this:
Currently it is not possible to define a response like this with fastify-swagger.
The text was updated successfully, but these errors were encountered: