Strawberry-graphql

Latest version: v0.235.0

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

Scan your dependencies

Page 38 of 122

0.154.0

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

Support constrained float field types in Pydantic models.

i.e.

python
import pydantic


class Model(pydantic.BaseModel):
field: pydantic.confloat(le=100.0)
equivalent_field: float = pydantic.Field(le=100.0)


Contributed by [Etienne Wodey](https://github.com/airwoodix) via [PR #2455](https://github.com/strawberry-graphql/strawberry/pull/2455/)

0.153.0

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

This change allows clients to define connectionParams when making Subscription requests similar to the way [Apollo-Server](https://www.apollographql.com/docs/apollo-server/data/subscriptions/#operation-context) does it.

With [Apollo-Client (React)](https://www.apollographql.com/docs/react/data/subscriptions/#5-authenticate-over-websocket-optional) as an example, define a Websocket Link:

import { GraphQLWsLink } from 'apollo/client/link/subscriptions';
import { createClient } from 'graphql-ws';

const wsLink = new GraphQLWsLink(createClient({
url: 'ws://localhost:4000/subscriptions',
connectionParams: {
authToken: user.authToken,
},
}));

and the JSON passed to `connectionParams` here will appear within Strawberry's context as the `connection_params` attribute when accessing `info.context` within a Subscription resolver.

Contributed by [Tommy Smith](https://github.com/tsmith023) via [PR #2380](https://github.com/strawberry-graphql/strawberry/pull/2380/)

0.152.0

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

This release adds support for updating (or adding) the query document inside an
extension's `on_request_start` method.

This can be useful for implementing persisted queries. The old behavior of
returning a 400 error if no query is present in the request is still supported.

Example usage:

python
from strawberry.extensions import Extension


def get_doc_id(request) -> str:
"""Implement this to get the document ID using your framework's request object"""
...


def load_persisted_query(doc_id: str) -> str:
"""Implement this load a query by document ID. For example, from a database."""
...


class PersistedQuery(Extension):
def on_request_start(self):
request = self.execution_context.context.request

doc_id = get_doc_id(request)

self.execution_context.query = load_persisted_query(doc_id)


Contributed by [James Thorniley](https://github.com/jthorniley) via [PR #2431](https://github.com/strawberry-graphql/strawberry/pull/2431/)

0.151.3

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

0.151.2

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

This release fixes `strawberry.experimental.pydantic.type` and adds support for the metadata attribute on fields.

Example:
python
strawberry.experimental.pydantic.type(model=User)
class UserType:
private: strawberry.auto = strawberry.field(metadata={"admin_only": True})
public: strawberry.auto


Contributed by [Huy Z](https://github.com/huyz) via [PR #2415](https://github.com/strawberry-graphql/strawberry/pull/2415/)

0.151.1

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

This release fixes an issue that prevented using generic
that had a field of type enum. The following works now:

python
strawberry.enum
class EstimatedValueEnum(Enum):
test = "test"
testtest = "testtest"


strawberry.type
class EstimatedValue(Generic[T]):
value: T
type: EstimatedValueEnum


strawberry.type
class Query:
strawberry.field
def estimated_value(self) -> Optional[EstimatedValue[int]]:
return EstimatedValue(value=1, type=EstimatedValueEnum.test)


Contributed by [Patrick Arminio](https://github.com/patrick91) via [PR #2411](https://github.com/strawberry-graphql/strawberry/pull/2411/)

Page 38 of 122

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.