You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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: stringformat: 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.)
The text was updated successfully, but these errors were encountered:
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 ofuuid.UUID
(github.com/google/uuid
), which is declared as[16]byte
.In the spec I use:
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.)The text was updated successfully, but these errors were encountered: