swagger-api / swagger-api/swagger-codegen-generators
[go-server] How to generate type:string format:uuid as uuid.UUID?
Open
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the go-server generator and the generation command shown in the issue, then trace how OpenAPI string fields with format uuid are mapped to Go types. Compare the generated ThingId with the expected uuid.UUID form; done means the mapping and required import are generated correctly without changing unrelated fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100