forked from edgedb/edgedb-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix 4 issues in codegen (edgedb#387)
* Add missing std::json * Support optional argument * Fix camelcase generation * Allow symlinks in project dir
- Loading branch information
Showing
14 changed files
with
278 additions
and
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
select 42 |
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 @@ | ||
# AUTOGENERATED FROM 'linked/test_linked.edgeql' WITH: | ||
# $ edgedb-py | ||
|
||
|
||
from __future__ import annotations | ||
import edgedb | ||
|
||
|
||
async def test_linked( | ||
client: edgedb.AsyncIOClient, | ||
) -> int: | ||
return await client.query_single( | ||
"""\ | ||
select 42\ | ||
""", | ||
) |
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 @@ | ||
# AUTOGENERATED FROM 'linked/test_linked.edgeql' WITH: | ||
# $ edgedb-py --target blocking --no-skip-pydantic-validation | ||
|
||
|
||
from __future__ import annotations | ||
import edgedb | ||
|
||
|
||
def test_linked( | ||
client: edgedb.Client, | ||
) -> int: | ||
return client.query_single( | ||
"""\ | ||
select 42\ | ||
""", | ||
) |
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 @@ | ||
../linked/ |
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,5 @@ | ||
create type TestCase { | ||
create link snake_case -> TestCase; | ||
}; | ||
|
||
select (<optional json>$0, TestCase {snake_case}); |
45 changes: 45 additions & 0 deletions
45
tests/codegen/test-project1/select_optional_json_async_edgeql.py.assert
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,45 @@ | ||
# AUTOGENERATED FROM 'select_optional_json.edgeql' WITH: | ||
# $ edgedb-py | ||
|
||
|
||
from __future__ import annotations | ||
import dataclasses | ||
import edgedb | ||
import typing | ||
import uuid | ||
|
||
|
||
class NoPydanticValidation: | ||
@classmethod | ||
def __get_validators__(cls): | ||
from pydantic.dataclasses import dataclass as pydantic_dataclass | ||
pydantic_dataclass(cls) | ||
cls.__pydantic_model__.__get_validators__ = lambda: [] | ||
return [] | ||
|
||
|
||
@dataclasses.dataclass | ||
class SelectOptionalJsonResultItem(NoPydanticValidation): | ||
id: uuid.UUID | ||
snake_case: typing.Optional[SelectOptionalJsonResultItemSnakeCase] | ||
|
||
|
||
@dataclasses.dataclass | ||
class SelectOptionalJsonResultItemSnakeCase(NoPydanticValidation): | ||
id: uuid.UUID | ||
|
||
|
||
async def select_optional_json( | ||
client: edgedb.AsyncIOClient, | ||
arg0: typing.Optional[str], | ||
) -> typing.List[typing.Tuple[str, SelectOptionalJsonResultItem]]: | ||
return await client.query( | ||
"""\ | ||
create type TestCase { | ||
create link snake_case -> TestCase; | ||
}; | ||
|
||
select (<optional json>$0, TestCase {snake_case});\ | ||
""", | ||
arg0, | ||
) |
36 changes: 36 additions & 0 deletions
36
tests/codegen/test-project1/select_optional_json_edgeql.py.assert
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,36 @@ | ||
# AUTOGENERATED FROM 'select_optional_json.edgeql' WITH: | ||
# $ edgedb-py --target blocking --no-skip-pydantic-validation | ||
|
||
|
||
from __future__ import annotations | ||
import dataclasses | ||
import edgedb | ||
import typing | ||
import uuid | ||
|
||
|
||
@dataclasses.dataclass | ||
class SelectOptionalJsonResultItem: | ||
id: uuid.UUID | ||
snake_case: typing.Optional[SelectOptionalJsonResultItemSnakeCase] | ||
|
||
|
||
@dataclasses.dataclass | ||
class SelectOptionalJsonResultItemSnakeCase: | ||
id: uuid.UUID | ||
|
||
|
||
def select_optional_json( | ||
client: edgedb.Client, | ||
arg0: typing.Optional[str], | ||
) -> list[tuple[str, SelectOptionalJsonResultItem]]: | ||
return client.query( | ||
"""\ | ||
create type TestCase { | ||
create link snake_case -> TestCase; | ||
}; | ||
|
||
select (<optional json>$0, TestCase {snake_case});\ | ||
""", | ||
arg0, | ||
) |
Oops, something went wrong.