-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Consider an example where we add some fields programmatically (after #121 is fixed):
from pydantic import Field
from pydantic.dataclasses import dataclass
def _add_type_field(cls):
cls.__annotations__['type'] = str
cls.type = Field(cls.__name__, description='The type of the class')
return cls
@dataclass
@_add_type_field
class DataclassWithAddedField:
"""Dataclass with added field"""
field: str = Field(description='The field')
If we ask autodoc_pydantic to document this class with "bysource" it won't be able to order the "type" field and will fail with ValueError("Field type in DataclassWithAddedField not found in tagorder")
.
I would prefer the field to be added at the end.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request