-
-
Notifications
You must be signed in to change notification settings - Fork 537
Open
Description
I have a Django model
class Assembly:
id = models.UUIDField(default=uuid4, primary_key=True, editable=False)
and I have defined a ModelSchema like this:
class AssemblyAttributes(ModelSchema):
class Meta:
model = Assembly
fields = ['id']
This will now use the help_text attribute of the id field as descriptions in the OpenAPI schema at /openapi.json, which is not set and therefore no description is set:
"id": {"format": "uuid", "nullable": true, "title": "Id", "type": "string"}
I however want to override/set the description of that field in the OpenAPI schema.
I tried the following without success:
class AssemblyAttributes(ModelSchema):
id: str = Field(description='The ID')
class Meta:
model = Assembly
fields = ['id']
Any way to achieve this? All I want to change is the description (and ideally the example) attribute of the Assembly.id field so the OpenAPI schema and the Django model can use different values.
Metadata
Metadata
Assignees
Labels
No labels