goadesign / goadesign/goa

question: how to have uuid.UUID as type but still specify `format: uuid` in openapi spec?

Open
#3,754 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
6.1k
Forks
583
Avg merge
2d 10h
Merged PRs (30d)
15

Description

We have this UUID field:

```go
dsl.Field(0, "id", dsl.String, func() {
// Serialize it with `uuid.UUID`.
dsl.Meta("struct:field:type", "uuid.UUID", "github.com/google/uuid")

// Some other stuff, for tags in GO...
dsl.Meta("struct:tag:yaml", "id")
})
```
instead of

```go
dsl.Field(0, "id", dsl.String, func() {
// Use the string formatting checks.
dsl.Format(dsl.FormatUUID)

// Some other stuff, for tags in GO...
dsl.Meta("struct:tag:yaml", "id")
})
```

The latter however nicely puts the **`format: uuid`** on the openapi spec.

Is there a way to hack that in as well for the first use case which is much more nice to use in Go?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.