Skip to content

[go-server] Support go custom tags #1145

@andrewkav

Description

@andrewkav
Description

Sometimes there is a necessity to add extra tags to generated models. For example when using validators based on go tags.
Example of generated code:

type SomeStruct struct {
	ID string `json:"id,omitempty" validate:"required"`
}
openapi-generator version

3.3.0

OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

Suggesting to use vendor extension x-go-custom-tag to include the tag into generated model
example of YAML

    SomeStruct:
      type: object
      properties:
        id:
          type: string
          x-go-custom-tag: validate:"required"

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