Go support for JSON Schema and OpenAPI string formats
open sourceApache-2.0free
strfmt is the go-openapi toolkit's Go package for the string formats JSON Schema and OpenAPI define: date-time, email, hostname, IPv4 and IPv6, URI, date, byte and the rest, plus extensions such as UUID (v3, v4, v5 and v7), ULID, CIDR, MAC address, ISBN, credit card, hex and RGB colors, and both human-readable and ISO 8601 durations. It keeps a registry of format types that serialize to and from JSON and SQL databases, with BSON support for MongoDB through an optional import. Its API is stable.
Problems it solves
- parse and validate OpenAPI string formats like date-time and uuid in Go
- use typed date, email and UUID fields in Go structs generated from an OpenAPI spec
- store OpenAPI format types in a SQL database from Go
Features
- JSON Schema draft 4 and 2020 string formats
- Swagger 2.0 format extensions
- UUID, ULID, CIDR, MAC, ISBN and color formats
- human-readable and ISO 8601 durations
- JSON and SQL serialization
- optional BSON support for MongoDB
Limitations
- Supports string formats only: it doesn't validate number or integer formats such as float, double or int321
