-
-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* sanitize dots in path names * add flag that sanitizes dots in filenames as modules * add missing __init__.py files when creating submodules. * add test * fix and extend tests * remove unnecessary list comprehension * remove unnecessary list comprehension * fix set comprehension * remove unrelated change * extract inner function for testing * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * extract classmethods to try and fix tests * Revert "extract classmethods to try and fix tests" This reverts commit bdbfec7. * Revert "extract inner function for testing" This reverts commit 20b694e. * write functional test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * increase test coverage * fix test --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koudai Aono <koxudaxi@gmail.com>
- Loading branch information
1 parent
c197b8f
commit 8b7b93f
Showing
23 changed files
with
271 additions
and
2 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
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
3 changes: 3 additions & 0 deletions
3
tests/data/expected/main/treat_dot_as_module/complex/__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: treat_dot_as_module | ||
# timestamp: 2019-07-26T00:00:00+00:00 |
3 changes: 3 additions & 0 deletions
3
tests/data/expected/main/treat_dot_as_module/complex/directory/__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: treat_dot_as_module | ||
# timestamp: 2019-07-26T00:00:00+00:00 |
3 changes: 3 additions & 0 deletions
3
tests/data/expected/main/treat_dot_as_module/complex/directory/api/__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: treat_dot_as_module | ||
# timestamp: 2019-07-26T00:00:00+00:00 |
3 changes: 3 additions & 0 deletions
3
tests/data/expected/main/treat_dot_as_module/complex/directory/api/path/__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: treat_dot_as_module | ||
# timestamp: 2019-07-26T00:00:00+00:00 |
16 changes: 16 additions & 0 deletions
16
tests/data/expected/main/treat_dot_as_module/complex/directory/api/path/input.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,16 @@ | ||
# generated by datamodel-codegen: | ||
# filename: complex.directory/api.path.input.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any, Optional | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
from ... import schema | ||
|
||
|
||
class Input(BaseModel): | ||
input: Optional[Any] = Field('input', title='Input') | ||
extType: Optional[schema.ExtType] = None |
13 changes: 13 additions & 0 deletions
13
tests/data/expected/main/treat_dot_as_module/complex/directory/api/path/output.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,13 @@ | ||
# generated by datamodel-codegen: | ||
# filename: complex.directory/api.path.output.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any, Optional | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
|
||
class Output(BaseModel): | ||
output: Optional[Any] = Field('output', title='Output') |
13 changes: 13 additions & 0 deletions
13
tests/data/expected/main/treat_dot_as_module/complex/directory/schema.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,13 @@ | ||
# generated by datamodel-codegen: | ||
# filename: complex.directory/schema.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any, Optional | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
|
||
class ExtType(BaseModel): | ||
ExtType: Optional[Any] = Field(None, title='ExtType') |
3 changes: 3 additions & 0 deletions
3
tests/data/expected/main/treat_dot_not_as_module/complex.directory/__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: treat_dot_as_module | ||
# timestamp: 2019-07-26T00:00:00+00:00 |
16 changes: 16 additions & 0 deletions
16
tests/data/expected/main/treat_dot_not_as_module/complex.directory/api_path_input.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,16 @@ | ||
# generated by datamodel-codegen: | ||
# filename: complex.directory/api.path.input.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any, Optional | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
from . import schema | ||
|
||
|
||
class Input(BaseModel): | ||
input: Optional[Any] = Field('input', title='Input') | ||
extType: Optional[schema.ExtType] = None |
13 changes: 13 additions & 0 deletions
13
tests/data/expected/main/treat_dot_not_as_module/complex.directory/api_path_output.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,13 @@ | ||
# generated by datamodel-codegen: | ||
# filename: complex.directory/api.path.output.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any, Optional | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
|
||
class Output(BaseModel): | ||
output: Optional[Any] = Field('output', title='Output') |
13 changes: 13 additions & 0 deletions
13
tests/data/expected/main/treat_dot_not_as_module/complex.directory/schema.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,13 @@ | ||
# generated by datamodel-codegen: | ||
# filename: complex.directory/schema.json | ||
# timestamp: 2019-07-26T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any, Optional | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
|
||
class ExtType(BaseModel): | ||
ExtType: Optional[Any] = Field(None, title='ExtType') |
13 changes: 13 additions & 0 deletions
13
tests/data/jsonschema/treat_dot_as_module/complex.directory/api.path.input.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,13 @@ | ||
{ | ||
"properties": { | ||
"input": { | ||
"default": "input", | ||
"title": "Input" | ||
}, | ||
"extType": { | ||
"$ref": "schema.json" | ||
} | ||
}, | ||
"title": "Input", | ||
"type": "object" | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/data/jsonschema/treat_dot_as_module/complex.directory/api.path.output.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 @@ | ||
{ | ||
"properties": { | ||
"output": { | ||
"default": "output", | ||
"title": "Output" | ||
} | ||
}, | ||
"title": "Output", | ||
"type": "object" | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/data/jsonschema/treat_dot_as_module/complex.directory/schema.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 @@ | ||
{ | ||
"properties": { | ||
"ExtType": { | ||
"type": "a", | ||
"title": "ExtType" | ||
} | ||
}, | ||
"title": "ExtType", | ||
"type": "object" | ||
} |
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
Oops, something went wrong.