Skip to content

Not possible to generate a struct with attributes in the same order as the API specs #105

@yeforriak

Description

@yeforriak

I want to generate a struct with attributes ordered as defined in the OpenAPI specification doc.

Api specification:

    Settings:
      type: object
      required:
        - name
        - enabled
      properties:
        name:
          type: string
          enum: [ setting-a, setting-b, setting-c, setting-d ]
        enabled:
          type: boolean

The generated struct attributes are sorted alphabetically:

type Setting struct {
	Enabled bool        `json:"enabled"`
	Name    SettingName `json:"name"`
}

but I would like the struct to be defined as

type Setting struct {
        Name    SettingName `json:"name"`
	Enabled bool        `json:"enabled"`
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions