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 15 of 122

0.208.1

--------------------

This fixes a bug where codegen would choke trying to find a field in the schema for a generic type.

Contributed by [Matt Gilson](https://github.com/mgilson) via [PR #3077](https://github.com/strawberry-graphql/strawberry/pull/3077/)

0.208.0

--------------------

Adds new strawberry.Parent type annotation to support resolvers without use of self.

E.g.

python
dataclass
class UserRow:
id_: str


strawberry.type
class User:
strawberry.field
staticmethod
async def name(parent: strawberry.Parent[UserRow]) -> str:
return f"User Number {parent.id}"


strawberry.type
class Query:
strawberry.field
def user(self) -> User:
return UserRow(id_="1234")


Contributed by [mattalbr](https://github.com/mattalbr) via [PR #3017](https://github.com/strawberry-graphql/strawberry/pull/3017/)

0.207.1

--------------------

This fixes a bug where codegen would choke on FragmentSpread nodes in the GraphQL during type collection.

e.g.:


fragment PartialBlogPost on BlogPost {
title
}

query OperationName {
interface {
id
... on BlogPost {
...PartialBlogPost
}
... on Image {
url
}
}
}


The current version of the code generator is not able to handle the `...PartialBogPost` in this position because it assumes it can only find `Field` type nodes even though the spread should be legit.

Contributed by [Matt Gilson](https://github.com/mgilson) via [PR #3086](https://github.com/strawberry-graphql/strawberry/pull/3086/)

0.207.0

--------------------

This release removes the deprecated `ignore` argument from the `QueryDepthLimiter` extension.

Contributed by [Kai Benevento](https://github.com/benesgarage) via [PR #3093](https://github.com/strawberry-graphql/strawberry/pull/3093/)

0.206.0

--------------------

`strawberry codegen` can now operate on multiple input query files.
The previous behavior of naming the file `types.js` and `types.py`
for the builtin `typescript` and `python` plugins respectively is
preserved, but only if a single query file is passed. When more
than one query file is passed, the code generator will now use
the stem of the query file's name to construct the name of the
output files. e.g. `my_query.graphql` -> `my_query.js` or
`my_query.py`. Creators of custom plugins are responsible
for controlling the name of the output file themselves. To
accomodate this, if the `__init__` method of a `QueryCodegenPlugin`
has a parameter named `query` or `query_file`, the `pathlib.Path`
to the query file will be passed to the plugin's `__init__`
method.

Finally, the `ConsolePlugin` has also recieved two new lifecycle
methods. Unlike other `QueryCodegenPlugin`, the same instance of
the `ConsolePlugin` is used for each query file processed. This
allows it to keep state around how many total files were processed.
The `ConsolePlugin` recieved two new lifecycle hooks: `before_any_start`
and `after_all_finished` that get called at the appropriate times.

Contributed by [Matt Gilson](https://github.com/mgilson) via [PR #2911](https://github.com/strawberry-graphql/strawberry/pull/2911/)

0.205.0

--------------------

`strawberry codegen` previously choked for inputs that used the
`strawberry.UNSET` sentinal singleton value as a default. The intent
here is to say that if a variable is not part of the request payload,
then the `UNSET` default value will not be modified and the service
code can then treat an unset value differently from a default value,
etc.

For codegen, we treat the `UNSET` default value as a `GraphQLNullValue`.
The `.value` property is the `UNSET` object in this case (instead of
the usual `None`). In the built-in python code generator, this causes
the client to generate an object with a `None` default. Custom client
generators can sniff at this value and update their behavior.

Contributed by [Matt Gilson](https://github.com/mgilson) via [PR #3050](https://github.com/strawberry-graphql/strawberry/pull/3050/)

Page 15 of 122

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.