go-openapi/strfmt ? reverse-engineered prompt

Reverse engineered prompt

Build me a Go library for handling the common string formats used in OpenAPI and JSON Schema.

I want it to include the usual things like email, hostname, IPv4, IPv6, URI, date, date time, UUIDs, ULID, CIDR, MAC addresses, color formats, ISBNs, SSN, credit card, base64, and the different duration styles. It should be easy to register formats, parse and validate values, and convert them back to strings cleanly. Please make the types work with JSON marshaling and unmarshaling, and also support database sql scanning and valuing. BSON support for MongoDB would be great too.

Make the duration handling clear, with both the human readable version and the ISO 8601 version, since those are different. If needed, look up current docs online so the behavior matches modern OpenAPI expectations. Keep the API simple and stable, with good tests and examples for the main formats.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab