-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
118 additions
and
3 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
File renamed without changes.
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,9 @@ | ||
query IssuesDate { | ||
repository(name: "qenerate", owner: "app-sre") { | ||
issues(first: 10) { | ||
nodes { | ||
createdAt | ||
} | ||
} | ||
} | ||
} |
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
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
83 changes: 83 additions & 0 deletions
83
tests/generator/expected/pydantic_v1/github/issues_datetime.py.txt
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,83 @@ | ||
""" | ||
Generated by qenerate plugin=pydantic_v1. DO NOT MODIFY MANUALLY! | ||
""" | ||
from collections.abc import Callable # noqa: F401 # pylint: disable=W0611 | ||
from datetime import datetime # noqa: F401 # pylint: disable=W0611 | ||
from enum import Enum # noqa: F401 # pylint: disable=W0611 | ||
from typing import ( # noqa: F401 # pylint: disable=W0611 | ||
Any, | ||
Optional, | ||
Union, | ||
) | ||
|
||
from pydantic import ( # noqa: F401 # pylint: disable=W0611 | ||
BaseModel, | ||
Extra, | ||
Field, | ||
Json, | ||
) | ||
|
||
|
||
DEFINITION = """ | ||
query IssuesDate { | ||
repository(name: "qenerate", owner: "app-sre") { | ||
issues(first: 10) { | ||
nodes { | ||
createdAt | ||
} | ||
} | ||
} | ||
} | ||
|
||
""" | ||
|
||
|
||
class Issue(BaseModel): | ||
created_at: datetime = Field(..., alias="createdAt") | ||
|
||
class Config: | ||
smart_union = True | ||
extra = Extra.forbid | ||
|
||
|
||
class IssueConnection(BaseModel): | ||
nodes: Optional[list[Optional[Issue]]] = Field(..., alias="nodes") | ||
|
||
class Config: | ||
smart_union = True | ||
extra = Extra.forbid | ||
|
||
|
||
class Repository(BaseModel): | ||
issues: IssueConnection = Field(..., alias="issues") | ||
|
||
class Config: | ||
smart_union = True | ||
extra = Extra.forbid | ||
|
||
|
||
class IssuesDateQueryData(BaseModel): | ||
repository: Optional[Repository] = Field(..., alias="repository") | ||
|
||
class Config: | ||
smart_union = True | ||
extra = Extra.forbid | ||
|
||
|
||
def query(query_func: Callable, **kwargs: Any) -> IssuesDateQueryData: | ||
""" | ||
This is a convenience function which queries and parses the data into | ||
concrete types. It should be compatible with most GQL clients. | ||
You do not have to use it to consume the generated data classes. | ||
Alternatively, you can also mime and alternate the behavior | ||
of this function in the caller. | ||
|
||
Parameters: | ||
query_func (Callable): Function which queries your GQL Server | ||
kwargs: optional arguments that will be passed to the query function | ||
|
||
Returns: | ||
IssuesDateQueryData: queried data parsed into generated classes | ||
""" | ||
raw_data: dict[Any, Any] = query_func(DEFINITION, **kwargs) | ||
return IssuesDateQueryData(**raw_data) |
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
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