Skip to content

Generate "deprecated" notations for JSON schemas and dataclass output #2543

@shuyangli

Description

@shuyangli

Is your feature request related to a problem? Please describe.
JSON schema spec supports "deprecated" metadata, but datamodel-code-generator doesn't respect it and doesn't generate any dataclass code with deprecated annotations.

Describe the solution you'd like

from typing_extensions import deprecated

# dataclass-level deprecation
@deprecated("comment")
@dataclass
class DataclassType:
    field: Type

There are no Python support for marking a dataclass field as deprecated natively, so that might need a custom solution (lower priority).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions