-
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.
Merge pull request #11 from rmyers/refactor-schema-extensions
Refactoring schema extension to work with upstream changes
- Loading branch information
Showing
5 changed files
with
91 additions
and
189 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import cannula | ||
from graphql import GraphQLObjectType, GraphQLString, GraphQLSchema | ||
|
||
schema = cannula.gql( | ||
""" | ||
type Brocoli { | ||
taste: String | ||
} | ||
type Message { | ||
text: String | ||
number: Int | ||
float: Float | ||
isOn: Boolean | ||
id: ID | ||
brocoli: Brocoli | ||
} | ||
type Query { | ||
mockity: [Message] | ||
boo: String | ||
} | ||
""" | ||
) | ||
|
||
extensions = cannula.gql( | ||
""" | ||
extend type Brocoli { | ||
color: String | ||
} | ||
extend type Query { | ||
fancy: [Message] | ||
} | ||
""" | ||
) | ||
|
||
# schema = cannula.build_and_extend_schema([schema, extensions]) | ||
|
||
api = cannula.API( | ||
__name__, | ||
schema=[schema, extensions], | ||
) | ||
|
||
SAMPLE_QUERY = cannula.gql( | ||
""" | ||
query HelloWorld { | ||
fancy { | ||
text | ||
} | ||
} | ||
""" | ||
) | ||
|
||
|
||
print(api.call_sync(SAMPLE_QUERY)) |
Oops, something went wrong.