swagger-codegen-generators icon indicating copy to clipboard operation
swagger-codegen-generators copied to clipboard

[go-server] How to generate type:string format:uuid as uuid.UUID?

Open Pe-te opened this issue 4 years ago • 0 comments

Hi folks, is there any way to generate a (type:string,format:uuid) as go-type "uuid.UUID"?

Yaml-Definition:

thing_id:
  type: string
  format: uuid

Generated code:

ThingId string `json:"thing_id"`

Expected code:

import (
	"github.com/google/uuid"
)

ThingId uuid.UUID `json:"thing_id"`

Used latest generator V3.0.29:

java -jar jars/swagger-codegen-cli-3.0.29.jar generate -l go-server -i "openapi.yaml" -o swagger

Pe-te avatar Oct 21 '21 11:10 Pe-te