-
-
Notifications
You must be signed in to change notification settings - Fork 136
Closed
Labels
Description
Hi,
According to the spec, "format" should accept any value:
However, to support documentation needs, the format property is an open string-valued property, and can have any value. Formats such as "email", "uuid", and so on, MAY be used even though undefined by this specification. Types that are not accompanied by a format property follow the type definition in the JSON Schema. Tools that do not recognize a specific format MAY default back to the type alone, as if the format is not specified.
However, this will raise: ValueError: 'custom' is not a valid SchemaFormat
from openapi_core import create_spec
schema = {
"components": {
"schemas": {
"Foo": {
"type": "object",
"properties": {
"propname": {
"type": "string",
"format": "custom"
}
}
}
}
},
"info": {
"title": "xxx",
"version": "1.0.0"
},
"openapi": "3.0.0",
"paths": {
"/simulate": {
"get": {
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Foo"
}
}
},
"description": "OK"
}
}
}
}
}
}
spec = create_spec(schema)
Am I missing something?
Thanks! :)