-
-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* reorder required to resolve it's imports * add tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: fft001 <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
365c231
commit e1c795e
Showing
8 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
15 changes: 15 additions & 0 deletions
15
tests/data/expected/main/main_require_referenced_field/referenced.py
This file contains 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,15 @@ | ||
# generated by datamodel-codegen: | ||
# filename: referenced.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from datetime import datetime | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class Model(BaseModel): | ||
some_optional_property: Optional[str] = None | ||
some_optional_typed_property: Optional[datetime] = None |
14 changes: 14 additions & 0 deletions
14
tests/data/expected/main/main_require_referenced_field/required.py
This file contains 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,14 @@ | ||
# generated by datamodel-codegen: | ||
# filename: required.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from datetime import datetime | ||
|
||
from .referenced import Model as Model_1 | ||
|
||
|
||
class Model(Model_1.Model): | ||
some_optional_property: str | ||
some_optional_typed_property: datetime |
14 changes: 14 additions & 0 deletions
14
tests/data/expected/main/main_require_referenced_field_pydantic_v2/referenced.py
This file contains 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,14 @@ | ||
# generated by datamodel-codegen: | ||
# filename: referenced.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Optional | ||
|
||
from pydantic import AwareDatetime, BaseModel | ||
|
||
|
||
class Model(BaseModel): | ||
some_optional_property: Optional[str] = None | ||
some_optional_typed_property: Optional[AwareDatetime] = None |
14 changes: 14 additions & 0 deletions
14
tests/data/expected/main/main_require_referenced_field_pydantic_v2/required.py
This file contains 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,14 @@ | ||
# generated by datamodel-codegen: | ||
# filename: required.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from pydantic import AwareDatetime | ||
|
||
from .referenced import Model as Model_1 | ||
|
||
|
||
class Model(Model_1.Model): | ||
some_optional_property: str | ||
some_optional_typed_property: AwareDatetime |
15 changes: 15 additions & 0 deletions
15
tests/data/jsonschema/require_referenced_field/referenced.json
This file contains 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,15 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "test", | ||
"description": "test", | ||
"type": "object", | ||
"properties": { | ||
"some_optional_property": { | ||
"type": "string" | ||
}, | ||
"some_optional_typed_property": { | ||
"type": "string", | ||
"format":"date-time" | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/data/jsonschema/require_referenced_field/required.json
This file contains 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,12 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "test", | ||
"description": "test", | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"$ref": "referenced.json" | ||
} | ||
], | ||
"required" : ["some_optional_property", "some_optional_typed_property"] | ||
} |
This file contains 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