-
Notifications
You must be signed in to change notification settings - Fork 44
Closed
Description
OpenAPI supports a const property to indicate that an attribute has exactly one possible value.
Pydantic model_json_schema automatically generates this from Literal fields that define a single value.
class MyResponseModel(BaseModel):
foobar: Literal["baz"]
Flask-OpenApi3 should produce the following schema:
components:
schemas:
MyResponseModel:
properties:
foobar:
const: baz
title: Foobar
type: string
I am using Flask-OpenApi3 to generate Typescript types from the API spec, and it would be great to have const so that the Typescript type could be a string literal instead of just a string.
Metadata
Metadata
Assignees
Labels
No labels