Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ skip = '.git,*.lock,tests,docs/cli-reference,CHANGELOG.md,docs/changelog.md'
filterwarnings = [
"error",
"ignore:^.*Pydantic v1 runtime support is deprecated.*:DeprecationWarning",
"ignore:^.*No --output-model-type specified.*:DeprecationWarning",
"ignore:^.*`--validation` option is deprecated.*",
"ignore:^.*--parent-scoped-naming is deprecated.*",
"ignore:^.*Field name `name` is duplicated on Pet.*",
Expand Down
16 changes: 16 additions & 0 deletions src/datamodel_code_generator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,22 @@ def main(args: Sequence[str] | None = None) -> Exit: # noqa: PLR0911, PLR0912,
if config.disable_warnings:
warnings.simplefilter("ignore")

if (
namespace.output_model_type is None
and pyproject_config.get("output_model_type") is None
and config.output_model_type == DataModelType.PydanticBaseModel
):
warnings.warn(
"No --output-model-type specified. "
"The current default (pydantic.BaseModel, Pydantic v1) is deprecated "
"and will be removed in a future version. "
"Please explicitly specify --output-model-type. "
"Example: --output-model-type pydantic_v2.BaseModel. "
"See https://github.com/koxudaxi/datamodel-code-generator/issues/2466",
DeprecationWarning,
stacklevel=1,
)

if not is_pydantic_v2():
warnings.warn(
"Pydantic v1 runtime support is deprecated and will be removed in a future version. "
Expand Down
Loading