Closed ghost closed 4 years ago
I don't understand the question, could you please elaborate on the subject ?
Ok. For example:
type Foo struct {
name int `query:"name"`
id int `query:"id"`
}
// ....
tonic.Handler(func (/*...*/, *Foo) error {}, 200)
Fizz generate params in specification:
// ....
"parameters": [
{
"name": "id",
// ....
},
{
"name": "name",
// ....
}
],
// ....
It sort struct fields by name. I want to keep sorting by it position in Go struct.
Some situation in tags. For example:
fizz.Group("/b", "b", "First group")
fizz.Group("/a", "a", "Second group")
generate:
"tags": [
{"name":"a", "description":"Second group"},
{"name":"b", "description":"First group"}
]
Yup, that's an opt-in you can deactivate with the following method.
https://github.com/wI2L/fizz/blob/bbaa01a9f70702e7c16baa507eefe416faaf67cb/openapi/generator.go#L130
To access the openapi.Generator
instance of the Fizz
object, use the following.
https://github.com/wI2L/fizz/blob/bbaa01a9f70702e7c16baa507eefe416faaf67cb/fizz.go#L92
EDIT: Please close the issue if it solves the need.
For tags sort executed without any conditions https://github.com/wI2L/fizz/blob/bbaa01a9f70702e7c16baa507eefe416faaf67cb/openapi/generator.go#L203
Sorry, I didn't read properly all the way through your first comment. The OpenAPI spec says that the ordering of the global tags section controls de default ordering in the UI, so yes, we should also provide a method to disable the auto sort, the same way we do it for parameters. Again, feel free to submit a PR for this, or I'll look at it when I have some time.
How to keep sorting for tags, operations, struct fields?