Strawberry-graphql

Latest version: v0.235.0

Safety actively analyzes 638437 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 108 of 122

0.30.0

Not secure
-------------------

Add functions `get_root_value` and `get_context` to views for Django, Flask and
ASGI. They can be overridden to provide custom values per request.

Django example:

python
views.py
from strawberry.django.views import GraphQLView as BaseGraphQLView


class GraphQLView(BaseGraphQLView):
def get_context(self, request):
return {
"request": request,
"custom_context_value": "Hi!",
}

def get_root_value(self, request):
return {
"custom_root_value": "🍓",
}


urls.py
from django.urls import path

from .views import GraphQLView
from .schema import schema

urlpatterns = [
path("graphql/", GraphQLView.as_view(schema=schema)),
]


Flask example:

python
views.py
from strawberry.flask.views import GraphQLView as BaseGraphQLView


class GraphQLView(BaseGraphQLView):
def get_context(self, request):
return {
"request": request,
"custom_context_value": "Hi!",
}

def get_root_value(self, request):
return {
"custom_root_value": "🍓",
}


app.py
from flask import Flask

from .views import GraphQLView
from .schema import schema

app = Flask(__name__)

app.add_url_rule(
"/graphql",
view_func=GraphQLView.as_view("graphql_view", schema=schema),
)



ASGI example:

python
app.py
from strawberry.asgi import GraphQL as BaseGraphQL

from .schema import schema


class GraphQL(BaseGraphQLView):
async def get_context(self, request):
return {
"request": request,
"custom_context_value": "Hi!",
}

async def get_root_value(self, request):
return {
"custom_root_value": "🍓",
}


app = GraphQL(schema)

0.29.1

Not secure
-------------------

Support for `default_value` on inputs.

Usage:
python
class MyInput:
s: Optional[str] = None
i: int = 0

graphql
input MyInput {
s: String = null
i: Int! = 0
}

0.29.0

Not secure
-------------------

This release adds support for file uploads within Django.

We follow the following spec: https://github.com/jaydenseric/graphql-multipart-request-spec


Example:

python
import strawberry
from strawberry.file_uploads import Upload


strawberry.type
class Mutation:
strawberry.mutation
def read_text(self, text_file: Upload) -> str:
return text_file.read().decode()

0.28.5

Not secure
-------------------

Fix issue when reusing an interface

0.28.4

Not secure
-------------------

Fix issue when using generic types with federation

0.28.3

Not secure
-------------------

Add support for using lazy types inside generics.

Page 108 of 122

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.