wI2L / fizz

:lemon: Gin wrapper with OpenAPI 3 spec generation
https://pkg.go.dev/github.com/wI2L/fizz
MIT License
214 stars 52 forks source link

feat: expose sortParams as a config #82

Closed biblion84 closed 2 years ago

biblion84 commented 2 years ago

Hi,

I've needed to expose the sortParam so that I could disable it The use case is as follow : I have a struct as input for an handler with a lot of fields I'd like the fields to appear in the same order on the openapi.json as declared on the struct That allow to display field that are related close to each other, via a swagger ui for example

This PR do not change the default that was to sort the params but it allow user to disable it

wI2L commented 2 years ago

Hello

Nothing against the feature itself, but please follow/replicate the implementation that exists for the sortTags equivalent: https://github.com/wI2L/fizz/commit/a3d0f2ed2a975d117dba6e3a8f3ccc0f30a303c9

It uses a Generator method instead of a static config constant publicly exposed.

biblion84 commented 2 years ago

Thanks ! I didn't see the generator, and there's already a SetSortParams that implement this functionality, closing the PR