openapi-validator: type+format error on allowable combination (format: uuid)
Because the validator allows only the formats that are listed in the specification table, it produces an error for some that are usable. For example, "format": "uuid".
However, format is an open value, so you can use any formats, even not those defined by the OpenAPI Specification, such as: • email • uuid • uri • hostname • ipv4 • ipv6 and others
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types https://swagger.io/docs/specification/data-models/data-types/
error
Message : Property type+format is not well-defined.
Path : definitions.ErrorResponse.properties.trace.type
source
"trace": {
"type": "string",
"format": "uuid",
"description": "A unique identifier of the request."
}
The trace use case is from our API Implementation Handbook about errors.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (10 by maintainers)
@bartkummel I think we’d be open to a configuration option for this. That might be tricky to design in a general manner, but we could start with something that enables your use case and grow it from there as needed.
Maybe a configuration like:
Another option is to disable the
invalid_type_format_pairrule altogether, but I’m guessing you want to keep that rule on for its benefits in catching other issues.You could use a
pattern. This StackOverflow post recommends a number of different regex’s that describe UUIDs.@apestov Sure, that’s how I interpreted it.