-
-
Notifications
You must be signed in to change notification settings - Fork 437
Add multiple --input-model support with inheritance preservation #2881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
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 fd34ae2
Fix lint and coverage issues
koxudaxi 38c777a
Simplify code to improve branch coverage
koxudaxi fe421ce
Extract input-model processing to separate module
koxudaxi 2be74fd
Fix PEP8 naming violations and unused parameter
koxudaxi 22df169
Fix lint error for multi-line import
koxudaxi 1901f86
Add expected_output_not_contains parameter to test helper
koxudaxi 1660177
Achieve 100% test coverage for input_model feature
koxudaxi 2962e97
Mark pydantic v1 coercion code with pragma no cover
koxudaxi 23eee28
Refactor input_model tests to use expected files with assert_output
koxudaxi 9da503d
Fix expected files for Python version compatibility
koxudaxi f39a2d1
Fix import order
koxudaxi 4afe19e
Fix PR review issues: duplicate imports, duplicate test, and duplicat…
koxudaxi ded2d40
Fix union type override for anyOf schemas and remove duplicate test
koxudaxi 853a02d
Clarify test docstrings: input model type tests all output to default…
koxudaxi fae1e1d
Remove line comments
koxudaxi 273c4e1
Add test for x-python-type with union in anyOf schema
koxudaxi 963cac6
Remove line comments except ignore comments
koxudaxi 6804416
Remove SKIP_PYTHON_314 and fix Union serialization for Python 3.14
koxudaxi 0de02c0
Refactor duplicate tests using pytest.mark.parametrize
koxudaxi 3fb45dc
Fix lint and type errors
koxudaxi 6ab699c
Regenerate config-types
koxudaxi 325ed3c
Fix StrictTypes import in config-types with reuse-foreign strategy
koxudaxi c0c7633
Use FQN for type arguments in x-python-type serialization
koxudaxi e45af85
Fix pyright type error in _full_type_name
koxudaxi 12d9d82
Add unit tests for 100% patch coverage
koxudaxi b36b6d5
Fix lint error and improve test for generic type without args
koxudaxi c604da0
Fix variable naming: use 'spec' for find_spec result
koxudaxi 28418ea
Add tests for _full_type_name branch coverage
koxudaxi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
tests/data/expected/main/input_model/forked_inheritance.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # generated by datamodel-codegen: | ||
| # filename: <stdin> | ||
| # timestamp: 1985-10-26T08:21:00+00:00 | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import TypeAlias, TypedDict | ||
|
|
||
|
|
||
| class GrandParent(TypedDict): | ||
| grand_field: str | ||
|
|
||
|
|
||
| class Parent(GrandParent): | ||
| parent_field: int | ||
|
|
||
|
|
||
| class ChildA(Parent): | ||
| child_a_field: float | ||
|
|
||
|
|
||
| class ChildB(Parent): | ||
| child_b_field: bool | ||
|
|
||
|
|
||
| Model: TypeAlias = ChildA | ChildB | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.