-
-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Support nested directory * improve test pattern * fix expected code
- Loading branch information
Showing
17 changed files
with
183 additions
and
8 deletions.
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
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
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
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
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
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,3 @@ | ||
# generated by datamodel-codegen: | ||
# filename: external_files_in_directory | ||
# timestamp: 2019-07-26T00:00:00+00:00 |
3 changes: 3 additions & 0 deletions
3
tests/data/expected/main/main_nested_directory/definitions/__init__.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,3 @@ | ||
# generated by datamodel-codegen: | ||
# filename: external_files_in_directory | ||
# timestamp: 2019-07-26T00:00:00+00:00 |
3 changes: 3 additions & 0 deletions
3
tests/data/expected/main/main_nested_directory/definitions/drink/__init__.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,3 @@ | ||
# generated by datamodel-codegen: | ||
# filename: external_files_in_directory | ||
# timestamp: 2019-07-26T00:00:00+00:00 |
12 changes: 12 additions & 0 deletions
12
tests/data/expected/main/main_nested_directory/definitions/drink/coffee.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,12 @@ | ||
# generated by datamodel-codegen: | ||
# filename: definitions/drink/coffee.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from enum import Enum | ||
|
||
|
||
class Coffee(Enum): | ||
Black = 'Black' | ||
Espresso = 'Espresso' |
12 changes: 12 additions & 0 deletions
12
tests/data/expected/main/main_nested_directory/definitions/drink/tea.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,12 @@ | ||
# generated by datamodel-codegen: | ||
# filename: definitions/drink/tea.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from enum import Enum | ||
|
||
|
||
class Tea(Enum): | ||
Oolong = 'Oolong' | ||
Green = 'Green' |
12 changes: 12 additions & 0 deletions
12
tests/data/expected/main/main_nested_directory/definitions/fur.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,12 @@ | ||
# generated by datamodel-codegen: | ||
# filename: definitions/fur.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from enum import Enum | ||
|
||
|
||
class Fur(Enum): | ||
Short_hair = 'Short hair' | ||
Long_hair = 'Long hair' |
17 changes: 17 additions & 0 deletions
17
tests/data/expected/main/main_nested_directory/definitions/pet.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,17 @@ | ||
# generated by datamodel-codegen: | ||
# filename: definitions/pet.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Optional | ||
|
||
from pydantic import BaseModel | ||
|
||
from . import fur | ||
|
||
|
||
class Pet(BaseModel): | ||
name: Optional[str] = None | ||
age: Optional[int] = None | ||
fur: Optional[fur.Fur] = None |
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,21 @@ | ||
# generated by datamodel-codegen: | ||
# filename: person.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any, List, Optional, Union | ||
|
||
from pydantic import BaseModel, Field, conint | ||
|
||
from .definitions import pet | ||
from .definitions.drink import coffee, tea | ||
|
||
|
||
class Person(BaseModel): | ||
first_name: str = Field(..., description="The person's first name.") | ||
last_name: str = Field(..., description="The person's last name.") | ||
age: Optional[conint(ge=0)] = Field(None, description='Age in years.') | ||
pets: Optional[List[pet.Pet]] = None | ||
comment: Optional[Any] = None | ||
drink: Optional[List[Union[coffee.Coffee, tea.Tea]]] = None |
10 changes: 10 additions & 0 deletions
10
tests/data/jsonschema/external_files_in_directory/definitions/drink/coffee.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,10 @@ | ||
{ | ||
"$id": "coffee.json", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Coffee", | ||
"type": "string", | ||
"enum": [ | ||
"Black", | ||
"Espresso" | ||
] | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/data/jsonschema/external_files_in_directory/definitions/drink/tea.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,10 @@ | ||
{ | ||
"$id": "tea.json", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Tea", | ||
"type": "string", | ||
"enum": [ | ||
"Oolong", | ||
"Green" | ||
] | ||
} |
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
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