Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Automatic conversion into uuid.UUID? #2721

Open
yktoo opened this issue Feb 18, 2022 · 2 comments
Open

[Question] Automatic conversion into uuid.UUID? #2721

yktoo opened this issue Feb 18, 2022 · 2 comments
Labels
model Related to swagger generate model command question

Comments

@yktoo
Copy link

yktoo commented Feb 18, 2022

Environment

swagger version: 0.29.0
go version: 1.17.6

Question

I am generating server code from swagger.yaml. The code makes intensive use of uuid.UUID (github.com/google/uuid), which is declared as [16]byte.

In the spec I use:

type: string
format: uuid

Which produces models with strfmt.UUID. This one is, however, essentially a string, which needs to be converted (parsed) into a proper UUID every time, with error handling and all the related ado.

Question: can this be somehow facilitated with a custom type or custom format or anything else, so that the generated models/endpoints use uuid.UUID (or a derived type) directly? Is there any example on how to do that? (I searched a lot but failed to find any.)

@yktoo
Copy link
Author

yktoo commented Jun 24, 2022

Anyone?

@fredbi fredbi added question model Related to swagger generate model command labels Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
model Related to swagger generate model command question
Projects
None yet
Development

No branches or pull requests

3 participants