Open dtyree-spyderbat opened 2 years ago
I ran into this problem today and it doesn't look possible with tonic.
https://github.com/loopfz/gadgeto/blob/ecd126f80b95fae7372be52e0e0f119d4e46f5d2/tonic/handler.go#L37-L65 The options function appears useless because the tonic.Route struct is mostly private.
The media type of the operations' response is defined by the media type that Tonic uses to encode responses, and it is limited to json
and xml
.
It think we should allow to override the media type per operation for the response using a fizz.Option
, when the route is declared.
Does any one of you wish to send a PR ? Otherwise I'll look into it when I have the time.
Does any one of you wish to send a PR ? Otherwise I'll look into it when I have the time.
I did it in https://github.com/loopfz/gadgeto/pull/87 a while ago on Tonic, and https://github.com/mcorbin/fizz/commit/1b8b7d7d09bce0d18be37fe4156e888ae8c612aa on Fizz to generate the proper OpenAPI doc based on routes media types.
@mcorbin Reviewed the PR on tonic, waiting for another approval/check. Once its ok, send the PR on fizz to close this issue, and I'll review it.
Thank you @wI2L . There is a lot of interesting MR on Tonic which should be interesting to merge (for now I forked both repositories and merged everything on my side). Do you know what is Tonic status regarding maintenance ?
Hi,
We're returning a large ndjson stream on some calls, and the problem we have is that we can't figure out how to get fizz go generate an openapi spec that indicates that ndjson is returned as the output, so instead the spec indicates nothing is returned.
We're essentially writing x-ndjson directly to the Writer on the context.
We tried using a fizz.Response(200...) but we can't override that.