-
Notifications
You must be signed in to change notification settings - Fork 120
Description
OpenAPI defines some additional formats over the JSON schema validation spec:
https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#dataTypes
Would there be interest in adding support for those int32
/int64
/float
/double
formats ones built in in this project? I have some half done implementations that I could complete and submit.
Aside, implementing those exposes a small problem with the way formats are mapped currently: for example the int32
and int64
formats cannot be restricted to apply only to integer
types. The format validator function cannot decide that based on the value type alone, thus those functions will be available and executed for number
types as well; the type of the received value will be e.g. json.Number
or float64
for both, and it might be valid for both as far as the type goes. Not that big of a problem, avoidable by simply not writing schemas that would use these formats for number
s, but I thought I'd mention it. Changing the format validator registration to also consider the type instead of just the format name would be a fix, if deemed worth fixing.