OpenAPITools / OpenAPITools/openapi-generator

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

Open
#10,655 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

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"`

Describe the solution you'd like

Expected code:

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

ThingId uuid.UUID `json:"thing_id"`

Describe alternatives you've considered

For now we are converting the fields manually.

Additional context

Used latest generator V5.2.1:

java -jar jars/openapi-generator-cli-5.2.1.jar generate -g go-server -i "openapi.yaml" -o openapi

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the go-server generator entry point shown in the java -jar ... generate command and trace how the OpenAPI type: string, format: uuid schema is mapped. Compare the generated output with the issue's expected uuid.UUID field and import; done means the generator produces that type for the YAML example without manual conversion.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, java
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.