From 83e1bc787783fac860c57c90d3f0db33054b3736 Mon Sep 17 00:00:00 2001 From: Albert Zhang Date: Tue, 18 Nov 2025 20:25:51 -0500 Subject: [PATCH] Allow const to be Any type Trying to create a schema that uses `const` with a non-string value crashes Per the specification: > The value of this keyword MAY be of any type, including null. https://json-schema.org/draft/2020-12/json-schema-validation#section-6.1.3 --- flask_openapi3/models/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_openapi3/models/schema.py b/flask_openapi3/models/schema.py index 912b0165..51996bef 100644 --- a/flask_openapi3/models/schema.py +++ b/flask_openapi3/models/schema.py @@ -54,6 +54,6 @@ class Schema(BaseModel): externalDocs: ExternalDocumentation | None = None example: Any | None = None deprecated: bool | None = None - const: str | None = None + const: Any | None = None model_config = {"populate_by_name": True}