-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Sets response headers in the OpenAPI spec #258
Conversation
27255f5
to
0628dc5
Compare
I'm unsure about the need here, also I'm not a guru in fuego, just a random Gopher reviewing some PRs. I played with OpenAPI enough to know it can be fun. OpenAPI allows you to define multiple response for the same http code. Think about different validation error messages. Also, the format could be totally different between a 403, 404, 500, 503, 429, 200, 201, 204 So is your request about dealing with the non-200 replies? Does it takes into account the fact the OpenAPI reply can be totally different? If not, it means it has to include an allOf or anyOf in the definition (I'm unsure about the exact term sorry). Because for me, if you plan to support different code, the logic of handling different replies should be also considered |
I'm not sure that's true, that's what OpenAPI 4.0 "moonwalk" is mostly about. But you can answer different schemas for the same response, with oneOf/anyOf/allOf properties for example, as you said.
And yes you're right, and it's a big issue. I think what Fuego is doing right now is a really nice sweet spot between usability and design.
I know it's not perfect, we might want to support other architecture, but that's not the scope of this PR. That said, this PR aims to represent response header.
|
d81783e
to
cff041c
Compare
That's why I talked about the examples sections. The examples will be simple, but the spec would have to use anyOf and define each type. |
cff041c
to
daa11b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thought about this MR though. Whenever i get around to working on #247.
In the struct
type Response struct{
ContentTypes []string
Type any
}
Do we want to add Headers to that input struct?
Yeah probably, depends on how you'll be structuring that |
daa11b8
to
c9ee16d
Compare
Yeah, I'm not sure either. I'm sure I'll find reason to do it or not once i'm in the code. |
Thanks again for proofreading this @dylanhitt ! We passed the 500 tests milestone 🥳 ![]() |
As per the title.
A few questions @dylanhitt @rizerkrof @ccoVeille:
nil
== 200 should handle most of the casesparam.StatusCode(200, 201, 404)
: why not, but will pollute the OpenAPIParam which are for request and thus don't care about status code. if not specified, for 200 onlyOption A (implemented here ✅) : Clean usage, pollutes internals (acceptable?)
Option B : Ugly (acceptable?) usage, clean internals