-
-
Notifications
You must be signed in to change notification settings - Fork 483
Description
Two use cases:
- use openapi3 to load a document and ensure some data unarmshaled from a file complies with one of the schema (using VisitJSON)
- use openapi3.filter to validate a request complies with a loaded openapi document
In both use cases, if a schema references a type integer and data was unmarshaled from YAML, we end up with " unhandled value of type int" error. If file or request is using JSON, no error is reported.
=> for a file, one can workaround the issue by marshaling the read YAML to JSON and unmarshal it back from JSON
=> for openapi3filter, no workaround found as of today.
I believe this is due to the wrong assumption that all numbers will be using float type as this is the case for JSON (no integers, only floats => json unmarshaling returns float only)
=> https://github.com/getkin/kin-openapi/blob/master/openapi3/schema.go#L795 only references float
=> https://github.com/getkin/kin-openapi/blob/master/openapi3/schema.go#L998 checks for integers but not its format (int32/64)
Support for integers type and its associated formats (int32/int64) is required for non-JSON content-types.