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
manager.add_types(self.user, self.photo) | |
manager.add_types(snake_case_fallback_resolvers) | |
return manager.get_schema() |
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
@dataclass | |
class BoundaryGeneric: | |
def __init__(self, child_name, kwargs=None): | |
self.typename = child_name | |
if kwargs: | |
self.update_class(kwargs) | |
self.get_updated() |
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
@self.user.resolve_references | |
def resolve_user_references(representations): | |
results = [] | |
for req in representations: | |
kwargs = { | |
"id": req.get('id') | |
} | |
data = self.ds.getUser(**kwargs)[0] |
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
@self.query.field("users") | |
def resolve_users(*_, **kwargs): | |
return self.ds.getUser(**kwargs) |
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
manager = FederatedManager( | |
schema_sdl_file='schema/schema.graphql', | |
query=self.query, | |
) |
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
query = QueryType() | |
user = FederatedObjectType("User") |
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
directive @external on FIELD_DEFINITION | |
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION | |
directive @provides(fields: _FieldSet!) on FIELD_DEFINITION | |
directive @key(fields: _FieldSet!) on OBJECT | INTERFACE | |
directive @extends on OBJECT | |
scalar _Any | |
union _Entity = User |
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
type Photo { | |
id: ID! | |
url: String! | |
reviews: [Review] | |
} | |
type Query { | |
users(id: ID, first_name: String, last_name: String): [User] | |
photo(id: ID): [Photo] | |
review(id: ID): [Review] |
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
type Query { | |
users(id: ID, first_name: String, last_name: String): [User] | |
} | |
""" | |
User | |
The `User` type | |
""" | |
type User @key(fields: "id"){ | |
id: ID! |
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
query{ | |
users(first_name:"Han"){ | |
id | |
first_name | |
last_name | |
photos{ | |
id | |
url | |
reviews{ | |
id |
NewerOlder