-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
I want to generate a struct without sorting fields, in the order listed in the OpenAPI doc.
I wrote my OpenAPI component schema so that the fields that are important to the user are at the top
And I want to return JSON fields on my server response in the same order.
However, for now, generated fields are sorted in increasing order.
So I want an option to generate a struct without sorting field.
openapi.yml
components:
schemas:
Pet:
properties:
id:
type: integer
format: int64
description: Unique id of the pet
name:
type: string
description: Name of the pet
age:
type: integer
format: int64
description: Age of the petCurrent
// Pet defines model for Pet.
type Pet struct {
// Age of the pet
Age *int64 `json:"age,omitempty"`
// Unique id of the pet
Id *int64 `json:"id,omitempty"`
// Name of the pet
Name *string `json:"name,omitempty"`
}What I want
// Pet defines model for Pet.
type Pet struct {
// Unique id of the pet
Id *int64 `json:"id,omitempty"`
// Name of the pet
Name *string `json:"name,omitempty"`
// Age of the pet
Age *int64 `json:"age,omitempty"`
}robotomize, pantafive, vaetas, btibor91, serejja and 26 more
Metadata
Metadata
Assignees
Labels
No labels