-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
option.RequestContentType including application/json on responses #247
Comments
The response types are hardcoded currently responseSchema := SchemaTagFromType(s, *new(T))
content := openapi3.NewContentWithSchemaRef(&responseSchema.SchemaRef, []string{"application/json", "application/xml"})
response := openapi3.NewResponse().WithDescription("OK").WithContent(content)
route.Operation.AddResponse(200, response) This issue wouldn't be a bug. More a feature request I believe. |
IIRC the reasoning for why we elected to not make response types configurable is that fuego is opinionated on what is returned. I believe there is a thread somewhere about this. |
Ah here it is #159 |
I am unable to change the tag to "Feature-request." Currently, I am working on updating the OpenAPI structure, but I hope that "fuego" can eventually provide a way to specify it directly. Thank you! |
Would you mind editing your issue to better reflecting the request. Basically stating you want response type to be configurable. At the very least we should update errors to also have an xml response. I assume the API you're working on here doesn't support json at all? |
Sure, I updated the the first comment. I am working on an API that defaults to responding with XML. However, it will optionally support responding in JSON if explicitly requested via the But now it selects JSON by default when trying in the documentation, because "application/json" es the first option. |
I would like the response type to be configurable.
schema:
It inserts "application/json" and it is before "application/xml", this caused it to be selected as default Content-type on documentation.
Also, all errors use "application/json" because there is no way to specify other content-type for them.
(
fuego.WithGlobalResponseTypes
do not change it)The text was updated successfully, but these errors were encountered: