-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,29 +19,31 @@ String is byte sequence primitive type represent by Go `string` or `[]byte`. | |
| Format | Type | Description | | ||
|-----------|---------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| byte | `[]byte` | Base64-encoded string as defined in [RFC4648](https://www.rfc-editor.org/rfc/rfc4648.html) | | ||
| date-time | [`time.Time`](https://pkg.go.dev/time#Time) | Date and time notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), for example, `2022-02-22T11:22:33Z` | | ||
| date | [`time.Time`](https://pkg.go.dev/time#Time) | Date only notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), for example, `2022-02-22` | | ||
| time | [`time.Time`](https://pkg.go.dev/time#Time) | Time only notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), for example, `11:22:33` | | ||
| date-time | [`time.Time`][time.Time] | Date and time notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), for example, `2022-02-22T11:22:33Z` | | ||
| date | [`time.Time`][time.Time] | Date only notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), for example, `2022-02-22` | | ||
| time | [`time.Time`][time.Time] | Time only notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), for example, `11:22:33` | | ||
| duration | [`time.Duration`](https://pkg.go.dev/time#Duration) | Go duration format | | ||
| uuid | [`uuid.UUID`](https://pkg.go.dev/github.com/google/uuid#UUID) | UUID | | ||
| ip | [`net.IP`](https://pkg.go.dev/net#IP) | Any IP (IPv4, IPv6) | | ||
| ipv4 | [`net.IP`](https://pkg.go.dev/net#IP) | IPv4, for example, `1.1.1.1` | | ||
| ipv6 | [`net.IP`](https://pkg.go.dev/net#IP) | IPv6, for example, `2001:db8:85a3::8a2e:370:7334` | | ||
| ip | [`netip.Addr`][netip.Addr] | Any IP (IPv4, IPv6) | | ||
| ipv4 | [`netip.Addr`][netip.Addr] | IPv4, for example, `1.1.1.1` | | ||
| ipv6 | [`netip.Addr`][netip.Addr] | IPv6, for example, `2001:db8:85a3::8a2e:370:7334` | | ||
| uri | [`url.URL`](https://pkg.go.dev/net/url#URL) | URL as defined by [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986) | | ||
| email | `string` | Email, for example, `[email protected]` | | ||
| binary | `string` | Binary string | | ||
| hostname | `string` | Hostname as defined by [RFC 1034, section 3.1](https://datatracker.ietf.org/doc/html/rfc1034#section-3.1) | | ||
|
||
#### Non-standard formats | ||
|
||
| Format | Type | Description | | ||
|-------------------|------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------| | ||
| unix/unix-seconds | [`time.Time`](https://pkg.go.dev/time#Time) | [`Time.Unix()`](https://pkg.go.dev/time#Time.Unix), encoded as string. See [issue #307](https://github.com/ogen-go/ogen/issues/306) | | ||
| unix-nano | [`time.Time`](https://pkg.go.dev/time#Time) | [`Time.UnixNano()`](https://pkg.go.dev/time#Time.UnixNano), encoded as string. See [issue #307](https://github.com/ogen-go/ogen/issues/306) | | ||
| unix-micro | [`time.Time`](https://pkg.go.dev/time#Time) | [`Time.UnixMicro()`](https://pkg.go.dev/time#Time.UnixMicro), encoded as string. See [issue #307](https://github.com/ogen-go/ogen/issues/306) | | ||
| unix-milli | [`time.Time`](https://pkg.go.dev/time#Time) | [`Time.UnixMilli()`](https://pkg.go.dev/time#Time.UnixMilli), encoded as string. See [issue #307](https://github.com/ogen-go/ogen/issues/306) | | ||
| int32 | `int32` | 32-bit signed integer, encoded as string. See [issue #307](https://github.com/ogen-go/ogen/issues/307) | | ||
| int64 | `int64` | 64-bit signed integer, encoded as string. See [issue #307](https://github.com/ogen-go/ogen/issues/307) | | ||
| Format | Type | Description | | ||
|-------------------|--------------------------|---------------------------------------------------------------------------------| | ||
| unix/unix-seconds | [`time.Time`][time.Time] | [`Time.Unix()`](https://pkg.go.dev/time#Time.Unix), encoded as string | | ||
| unix-nano | [`time.Time`][time.Time] | [`Time.UnixNano()`](https://pkg.go.dev/time#Time.UnixNano), encoded as string | | ||
| unix-micro | [`time.Time`][time.Time] | [`Time.UnixMicro()`](https://pkg.go.dev/time#Time.UnixMicro), encoded as string | | ||
| unix-milli | [`time.Time`][time.Time] | [`Time.UnixMilli()`](https://pkg.go.dev/time#Time.UnixMilli), encoded as string | | ||
| int32 | `int32` | 32-bit signed integer | | ||
| int64 | `int64` | 64-bit signed integer | | ||
|
||
See [issue #307](https://github.com/ogen-go/ogen/issues/307) for more information about these formats. | ||
|
||
### Validation | ||
|
||
|
@@ -72,3 +74,7 @@ floating-point numbers. | |
| integer | – | `int` | Integer numbers | | ||
| integer | int32 | `int32` | Signed 32-bit integers | | ||
| integer | int64 | `int64` | Signed 64-bit integers | | ||
|
||
|
||
[time.Time]: https://pkg.go.dev/time#Time | ||
[netip.Addr]: https://pkg.go.dev/net/netip#Addr |