Skip to content

Clarify Graphene v3 upgrade with an example #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions docs/flask.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,19 @@ This will add `/graphql` endpoint to your app and enable the GraphiQL IDE.

### Special Note for Graphene v3

If you are using the `Schema` type of [Graphene](https://github.com/graphql-python/graphene) library, be sure to use the `graphql_schema` attribute to pass as schema on the `GraphQLView` view. Otherwise, the `GraphQLSchema` from `graphql-core` is the way to go.
If you are using the `Schema` type of [Graphene](https://github.com/graphql-python/graphene) library, be sure to use the `graphql_schema` attribute to pass as schema on the `GraphQLView` view. For example:
```diff
app.add_url_rule(
'/graphql',
view_func=GraphQLView.as_view(
'graphql',
- schema=graphene_schema,
+ schema=graphene_schema.graphql_schema,
)
)
```

If you aren't using Graphene's `Schema`, `GraphQLSchema` from `graphql-core` is the way to go.

More info at [Graphene v3 release notes](https://github.com/graphql-python/graphene/wiki/v3-release-notes#graphene-schema-no-longer-subclasses-graphqlschema-type) and [GraphQL-core 3 usage](https://github.com/graphql-python/graphql-core#usage).

Expand Down Expand Up @@ -79,4 +91,4 @@ class UserRootValue(GraphQLView):
```

## Contributing
See [CONTRIBUTING.md](../CONTRIBUTING.md)
See [CONTRIBUTING.md](../CONTRIBUTING.md)