README.md
1# Strfmt [![Build Status](https://travis-ci.org/go-openapi/strfmt.svg?branch=master)](https://travis-ci.org/go-openapi/strfmt) [![codecov](https://codecov.io/gh/go-openapi/strfmt/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/strfmt) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io)
2
3[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/strfmt/master/LICENSE)
4[![GoDoc](https://godoc.org/github.com/go-openapi/strfmt?status.svg)](http://godoc.org/github.com/go-openapi/strfmt)
5[![GolangCI](https://golangci.com/badges/github.com/go-openapi/strfmt.svg)](https://golangci.com)
6[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/strfmt)](https://goreportcard.com/report/github.com/go-openapi/strfmt)
7
8This package exposes a registry of data types to support string formats in the go-openapi toolkit.
9
10strfmt represents a well known string format such as credit card or email. The go toolkit for OpenAPI specifications knows how to deal with those.
11
12## Supported data formats
13go-openapi/strfmt follows the swagger 2.0 specification with the following formats
14defined [here](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types).
15
16It also provides convenient extensions to go-openapi users.
17
18- [x] JSON-schema draft 4 formats
19 - date-time
20 - email
21 - hostname
22 - ipv4
23 - ipv6
24 - uri
25- [x] swagger 2.0 format extensions
26 - binary
27 - byte (e.g. base64 encoded string)
28 - date (e.g. "1970-01-01")
29 - password
30- [x] go-openapi custom format extensions
31 - bsonobjectid (BSON objectID)
32 - creditcard
33 - duration (e.g. "3 weeks", "1ms")
34 - hexcolor (e.g. "#FFFFFF")
35 - isbn, isbn10, isbn13
36 - mac (e.g "01:02:03:04:05:06")
37 - rgbcolor (e.g. "rgb(100,100,100)")
38 - ssn
39 - uuid, uuid3, uuid4, uuid5
40 - cidr (e.g. "192.0.2.1/24", "2001:db8:a0b:12f0::1/32")
41
42> NOTE: as the name stands for, this package is intended to support string formatting only.
43> It does not provide validation for numerical values with swagger format extension for JSON types "number" or
44> "integer" (e.g. float, double, int32...).
45
46## Format types
47Types defined in strfmt expose marshaling and validation capabilities.
48
49List of defined types:
50- Base64
51- CreditCard
52- Date
53- DateTime
54- Duration
55- Email
56- HexColor
57- Hostname
58- IPv4
59- IPv6
60- CIDR
61- ISBN
62- ISBN10
63- ISBN13
64- MAC
65- ObjectId
66- Password
67- RGBColor
68- SSN
69- URI
70- UUID
71- UUID3
72- UUID4
73- UUID5
74