strawberry-graphql / strawberry

A GraphQL library for Python that leverages type annotations 🍓
https://strawberry.rocks
MIT License
4k stars 530 forks source link

GraohiQL is not disabled by None type #3681

Open ldynia opened 1 week ago

ldynia commented 1 week ago

Describe the Bug

Seeting graphiq=None doesn't disable GraphiQL view.

Upvote & Fund

Fund with Polar

erikwrede commented 1 week ago

Hey @ldynia, can you please provide a minimal reproduction for this behavior, including the strawberry version you're using? 😊

ldynia commented 2 days ago

Example using Django framework

# urls.py
urlpatterns = [
    ...
    path("graphiql", AsyncGraphQLView.as_view(schema=schema, graphiql=None)),
    ...
]

Image

$  pip show strawberry-graphql-django
Name: strawberry-graphql-django
Version: 0.49.1
Summary: Strawberry GraphQL Django extension
Home-page: https://github.com/strawberry-graphql/strawberry-django
Author: Lauri Hintsala
Author-email: lauri.hintsala@verkkopaja.fi
License: MIT
Location: /home/nonroot/.local/lib/python3.11/site-packages
Requires: asgiref, django, strawberry-graphql
Required-by: strawberry-django-auth

$ pip show strawberry-graphql
Name: strawberry-graphql
Version: 0.247.0
Summary: A library for creating GraphQL APIs
Home-page: https://strawberry.rocks/
Author: Patrick Arminio
Author-email: patrick.arminio@gmail.com
License: MIT
Location: /home/nonroot/.local/lib/python3.11/site-packages
Requires: graphql-core, python-dateutil, typing-extensions
Required-by: strawberry-graphql-django