Skip to content
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

Add support for enabling subscriptions in GraphiQL on Django through a flag on the BaseView class #1215

Merged
merged 1 commit into from
Sep 6, 2021

Conversation

lijok
Copy link
Member

@lijok lijok commented Sep 6, 2021

Description

Following on from this change #344 (thanks @jkimbo for the reference), I would like to propose allowing subscriptions to be enabled in GraphiQL for Django through a flag.
Without this, as a user I have to define a new AsyncGraphQLView as seen in the example here https://github.com/strawberry-graphql/examples/blob/main/django-subscriptions/api/views.py, to enable subscriptions, where as I would otherwise not need to do so.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@botberry
Copy link
Member

botberry commented Sep 6, 2021

Thanks for adding the RELEASE.md file!

Here's a preview of the changelog:


This release adds support for enabling subscriptions in GraphiQL
on Django by setting a flag subscriptions_enabled on the BaseView class.

from strawberry.django.views import AsyncGraphQLView

from .schema import schema

urlpatterns = [path("graphql", AsyncGraphQLView.as_view(schema=schema, graphiql=True, subscriptions_enabled=True))]

Here's the preview release card for twitter:

Here's the tweet text:

🆕 Release (next) is out! Thanks to lijok for the PR 👏

Get it here 👉 https://github.com/strawberry-graphql/strawberry/releases/tag/(next)

@codecov
Copy link

codecov bot commented Sep 6, 2021

Codecov Report

Merging #1215 (a41ebb2) into main (503d906) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1215   +/-   ##
=======================================
  Coverage   97.55%   97.56%           
=======================================
  Files          88       88           
  Lines        3319     3321    +2     
  Branches      477      477           
=======================================
+ Hits         3238     3240    +2     
  Misses         45       45           
  Partials       36       36           

Copy link
Member

@jkimbo jkimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants