Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
00a3dff
Add multiple --input-model support with inheritance preservation
koxudaxi Dec 31, 2025
fd34ae2
Fix lint and coverage issues
koxudaxi Dec 31, 2025
38c777a
Simplify code to improve branch coverage
koxudaxi Dec 31, 2025
fe421ce
Extract input-model processing to separate module
koxudaxi Dec 31, 2025
2be74fd
Fix PEP8 naming violations and unused parameter
koxudaxi Dec 31, 2025
22df169
Fix lint error for multi-line import
koxudaxi Dec 31, 2025
1901f86
Add expected_output_not_contains parameter to test helper
koxudaxi Dec 31, 2025
1660177
Achieve 100% test coverage for input_model feature
koxudaxi Dec 31, 2025
2962e97
Mark pydantic v1 coercion code with pragma no cover
koxudaxi Dec 31, 2025
23eee28
Refactor input_model tests to use expected files with assert_output
koxudaxi Dec 31, 2025
9da503d
Fix expected files for Python version compatibility
koxudaxi Dec 31, 2025
f39a2d1
Fix import order
koxudaxi Dec 31, 2025
4afe19e
Fix PR review issues: duplicate imports, duplicate test, and duplicat…
koxudaxi Dec 31, 2025
ded2d40
Fix union type override for anyOf schemas and remove duplicate test
koxudaxi Dec 31, 2025
853a02d
Clarify test docstrings: input model type tests all output to default…
koxudaxi Dec 31, 2025
fae1e1d
Remove line comments
koxudaxi Dec 31, 2025
273c4e1
Add test for x-python-type with union in anyOf schema
koxudaxi Dec 31, 2025
963cac6
Remove line comments except ignore comments
koxudaxi Dec 31, 2025
6804416
Remove SKIP_PYTHON_314 and fix Union serialization for Python 3.14
koxudaxi Dec 31, 2025
0de02c0
Refactor duplicate tests using pytest.mark.parametrize
koxudaxi Dec 31, 2025
3fb45dc
Fix lint and type errors
koxudaxi Dec 31, 2025
6ab699c
Regenerate config-types
koxudaxi Dec 31, 2025
325ed3c
Fix StrictTypes import in config-types with reuse-foreign strategy
koxudaxi Dec 31, 2025
c0c7633
Use FQN for type arguments in x-python-type serialization
koxudaxi Dec 31, 2025
e45af85
Fix pyright type error in _full_type_name
koxudaxi Dec 31, 2025
12d9d82
Add unit tests for 100% patch coverage
koxudaxi Dec 31, 2025
b36b6d5
Fix lint error and improve test for generic type without args
koxudaxi Dec 31, 2025
c604da0
Fix variable naming: use 'spec' for find_spec result
koxudaxi Dec 31, 2025
28418ea
Add tests for _full_type_name branch coverage
koxudaxi Dec 31, 2025
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
746 changes: 31 additions & 715 deletions src/datamodel_code_generator/__main__.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from datamodel_code_generator.types import DataTypeManager


class GraphQLParserConfigDict(TypedDict):
class ParserConfig(TypedDict):
data_model_type: NotRequired[type[DataModel]]
data_model_root_type: NotRequired[type[DataModel]]
data_type_manager_type: NotRequired[type[DataTypeManager]]
Expand Down Expand Up @@ -142,5 +142,8 @@ class GraphQLParserConfigDict(TypedDict):
read_only_write_only_model_type: NotRequired[ReadOnlyWriteOnlyModelType | None]
field_type_collision_strategy: NotRequired[FieldTypeCollisionStrategy | None]
target_pydantic_version: NotRequired[TargetPydanticVersion | None]


class GraphQLParserConfigDict(ParserConfig):
data_model_scalar_type: NotRequired[type[DataModel]]
data_model_union_type: NotRequired[type[DataModel]]
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from datamodel_code_generator.types import DataTypeManager


class JSONSchemaParserConfigDict(TypedDict):
class ParserConfig(TypedDict):
data_model_type: NotRequired[type[DataModel]]
data_model_root_type: NotRequired[type[DataModel]]
data_type_manager_type: NotRequired[type[DataTypeManager]]
Expand Down Expand Up @@ -142,3 +142,7 @@ class JSONSchemaParserConfigDict(TypedDict):
read_only_write_only_model_type: NotRequired[ReadOnlyWriteOnlyModelType | None]
field_type_collision_strategy: NotRequired[FieldTypeCollisionStrategy | None]
target_pydantic_version: NotRequired[TargetPydanticVersion | None]


class JSONSchemaParserConfigDict(ParserConfig):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from datamodel_code_generator.types import DataTypeManager


class OpenAPIParserConfigDict(TypedDict):
class ParserConfig(TypedDict):
data_model_type: NotRequired[type[DataModel]]
data_model_root_type: NotRequired[type[DataModel]]
data_type_manager_type: NotRequired[type[DataTypeManager]]
Expand Down Expand Up @@ -143,6 +143,13 @@ class OpenAPIParserConfigDict(TypedDict):
read_only_write_only_model_type: NotRequired[ReadOnlyWriteOnlyModelType | None]
field_type_collision_strategy: NotRequired[FieldTypeCollisionStrategy | None]
target_pydantic_version: NotRequired[TargetPydanticVersion | None]


class JSONSchemaParserConfig(ParserConfig):
pass


class OpenAPIParserConfigDict(JSONSchemaParserConfig):
openapi_scopes: NotRequired[list[OpenAPIScope] | None]
include_path_parameters: NotRequired[bool]
use_status_code_in_response_name: NotRequired[bool]
2 changes: 2 additions & 0 deletions src/datamodel_code_generator/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@ def start_section(self, heading: str | None) -> None:
)
base_options.add_argument(
"--input-model",
action="append",
help="Python import path to a Pydantic v2 model or schema dict "
"(e.g., 'mypackage.module:ClassName' or 'mypackage.schemas:SCHEMA_DICT'). "
"Can be specified multiple times for related models with inheritance. "
"For dict input, --input-file-type is required. "
"Cannot be used with --input or --url.",
metavar="MODULE:NAME",
Expand Down
Loading
Loading