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

[pre-commit.ci] pre-commit autoupdate #511

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: check-json5
exclude: apps/frontend/src/content/api/strawberry.json
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
args: ["--maxkb=128"]
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/content/docs/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ title: Strawberry docs

- [Deployment](/docs/operations/deployment)
- [Testing](/docs/operations/testing)
- [Tracing](/docs/operations/tracing)
- [Tracing](/docs/operations/tracing)
4 changes: 2 additions & 2 deletions apps/frontend/src/content/docs/_test.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ This is a warning. Something that you should be careful about.
## Blockquote

> This is a quote
>
>


```mermaid
Expand All @@ -136,4 +136,4 @@ sequenceDiagram

Bob-->Alice: Checking with John...
Alice->John: Yes... John, how are you?
```
```
2 changes: 1 addition & 1 deletion apps/frontend/src/content/docs/breaking-changes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ title: List of breaking changes and deprecations
- [Version 0.180.0 - 31 May 2023](/docs/breaking-changes/0.180.0)
- [Version 0.169.0 - 5 April 2023](/docs/breaking-changes/0.169.0)
- [Version 0.159.0 - 22 February 2023](/docs/breaking-changes/0.159.0)
- [Version 0.146.0 - 5 December 2022](/docs/breaking-changes/0.146.0)
- [Version 0.146.0 - 5 December 2022](/docs/breaking-changes/0.146.0)
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ The context value is now a dictionary instead of a custom class. This means that
you should access the context value using the `["key"]` syntax instead of the
`.key` syntax.

The `.key` syntax is still supported but will be removed in future releases.
The `.key` syntax is still supported but will be removed in future releases.
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ See the following table for a mapping between the old and new hooks.
| on_parsing_start | on_parse |
| on_parsing_end | on_parse |
| on_executing_start | on_execute |
| on_executing_end | on_execute |
| on_executing_end | on_execute |
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ If you're customizing this method you can change the signature to:

```python
async def get_root_value(self, request: Request) -> Any: ...
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ for `info.context["ws"]`, `info.context["request"]` and

If you still want to use the `.key` syntax, you can override `get_context()` to
return a custom dataclass there. See the Channels integration documentation for
an example.
an example.
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ Here's an example of the changes:

-graphql_app = GraphQLRouter(schema, graphiql=False)
+graphql_app = GraphQLRouter(schema, graphql_ide=None)
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ class Query:
@strawberry.field(permission_classes=[IsAuthorized])
def name(self, a_key: str) -> str: # pragma: no cover
return "Erik"
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ class Product:
original_info = info._raw_info

return Product(upc=upc)
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ we missed something.

```bash
strawberry upgrade update-imports
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ async def subscribe(
root_value: Optional[Any] = None,
operation_name: Optional[str] = None,
) -> Union[AsyncGenerator[ExecutionResult, None], PreExecutionError]:
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ from api.schema import schema
urlpatterns = [
path("graphql/", csrf_exempt(GraphQLView.as_view(schema=schema))),
]
```
```
2 changes: 1 addition & 1 deletion apps/frontend/src/content/docs/codegen/query-codegen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,4 @@ class ConsolePlugin:
def on_end(self, result: CodegenResult) -> None:
"""This method typically persists the results from a single query to the output directory."""
...
```
```
2 changes: 1 addition & 1 deletion apps/frontend/src/content/docs/codegen/schema-codegen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ class User:


schema = strawberry.Schema(query=Query)
```
```
2 changes: 1 addition & 1 deletion apps/frontend/src/content/docs/concepts/async.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ class Query:


schema = strawberry.Schema(Query)
```
```
2 changes: 1 addition & 1 deletion apps/frontend/src/content/docs/concepts/typings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,4 @@ safety and consistency.
Strawberry takes inspiration from these languages by requiring that all of its
types, fields, resolvers, and mutations declare the types of their arguments and
returns. Through this, the schema is generated in a standard and efficient way
that aligns with the style-direction of Python and programming as a whole.
that aligns with the style-direction of Python and programming as a whole.
2 changes: 1 addition & 1 deletion apps/frontend/src/content/docs/django/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ title: Strawberry Django docs
- [Channels](/docs/django/integrations/channels)
- [Choices Field](/docs/django/integrations/choices-field)
- [Django Guardian](/docs/django/integrations/guardian)
- [Community Projects](/docs/django/community-projects)
- [Community Projects](/docs/django/community-projects)
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Those are some community maintained projects worth mentioning:
| [🐙 strawberry-django-extras](https://github.com/m4riok/strawberry-django-extras) | JWT Authentication, Input validation and permissions, mutation hooks and deeply nested CUD mutations |

If you want your integration to be listed here, send us a
[Pull Request](https://github.com/strawberry-graphql/strawberry-django/pulls)
[Pull Request](https://github.com/strawberry-graphql/strawberry-django/pulls)
2 changes: 1 addition & 1 deletion apps/frontend/src/content/docs/django/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ import strawberry.django

## Example project?

See complete Django project from github repository folder [examples/django](https://github.com/strawberry-graphql/strawberry-django/tree/main/examples/django).
See complete Django project from github repository folder [examples/django](https://github.com/strawberry-graphql/strawberry-django/tree/main/examples/django).
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ title: Authentication
> recommended to use token authentication methods. JWT can be used with
> [strawberry-django-auth](https://github.com/nrbnlulu/strawberry-django-auth)
> lib.
>
>


`strawberry_django` provides mutations to get authentication going right away.
Expand Down Expand Up @@ -46,4 +46,4 @@ class Mutation:
login: User = strawberry_django.auth.login()
logout = strawberry_django.auth.logout()
register: User = strawberry_django.auth.register(UserInput)
```
```
4 changes: 2 additions & 2 deletions apps/frontend/src/content/docs/django/guide/export-schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Export Schema

> [!INFO]
> The `export_schema` management command provided here is specifically designed for use with `strawberry_django`. The [default Strawberry export command](https://strawberry.rocks/docs/guides/schema-export) won't work with `strawberry_django` schemas because `strawberry_django` extends the base functionality of Strawberry to integrate with Django models and queries. This command ensures proper schema export functionality.
>
>


The `export_schema` management command allows you to export a GraphQL schema defined using the `strawberry_django` library. This command converts the schema definition to GraphQL schema definition language (SDL), which can then be saved to a file or printed to the console.
Expand Down Expand Up @@ -35,4 +35,4 @@ Here's an example of how to use the export_schema command:
python manage.py export_schema myapp.schema --path=output/schema.graphql
```

In this example, the schema located at `myapp.schema` will be exported to the file `output/schema.graphql`.
In this example, the schema located at `myapp.schema` will be exported to the file `output/schema.graphql`.
8 changes: 4 additions & 4 deletions apps/frontend/src/content/docs/django/guide/fields.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Defining Fields
> [!TIP]
> It is highly recommended to enable the [Query Optimizer Extension](/docs/django/guide/optimizer)
> for improved performance and avoid some common pitfalls (e.g. the `n+1` issue)
>
>


Fields can be defined manually or `auto` type can be used for automatic type resolution. All basic field types and relation fields are supported out of the box. If you use a library that defines a custom field you will need to define an equivalent type such as `str`, `float`, `bool`, `int` or `id`.
Expand All @@ -34,7 +34,7 @@ class Fruit2:
> [Django's TextChoices/IntegerChoices](https://docs.djangoproject.com/en/4.2/ref/models/fields/#enumeration-types)
> it is recommented using the [django-choices-field](/docs/django/integrations/choices-field) integration
> enum handling.
>
>


## Relationships
Expand Down Expand Up @@ -128,7 +128,7 @@ field_type_map.update({

> [!WARNING]
> These new keywords should be used with caution, as they may inadvertently lead to exposure of unwanted data. Especially with `fields="__all__"` or `exclude`, sensitive model attributes may be included and made available in the schema without your awareness.
>
>


`strawberry_django.type` includes two optional keyword fields to help you populate fields from the Django model, `fields` and `exclude`.
Expand Down Expand Up @@ -198,4 +198,4 @@ class UserQuery:
```

In this example, each of the fields of the `UserType` will be automatically created by `CustomStrawberryDjangoField`,
which may implement anything from custom pagination of relationships to altering the field permissions.
which may implement anything from custom pagination of relationships to altering the field permissions.
32 changes: 16 additions & 16 deletions apps/frontend/src/content/docs/django/guide/filters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Fruit:
> `foo: Optional[SomeType] = strawberry.UNSET`
> Above `auto` annotation is wrapped in `Optional` automatically.
> `UNSET` is automatically used for fields without `field` or with `strawberry_django.filter_field`.
>
>


The code above would generate following schema:
Expand All @@ -47,7 +47,7 @@ input FruitFilter {
> from `relay.Node` and `GlobalID` for identifying objects, you might want to set
> `MAP_AUTO_ID_AS_GLOBAL_ID=True` in your [strawberry django settings](/docs/django/guide/settings)
> to make sure `auto` fields gets mapped to `GlobalID` on types and filters.
>
>


## AND, OR, NOT, DISTINCT ...
Expand Down Expand Up @@ -211,38 +211,38 @@ class FruitFilter:
> [!WARNING]
> It is discouraged to use `queryset.filter()` directly. When using more
> complex filtering via `NOT`, `OR` & `AND` this might lead to undesired behaviour.
>
>


> [!TIP]
>
>
> #### process_filters
>
>
> As seen above `strawberry_django.process_filters` function is exposed and can be
> reused in custom methods. Above it's used to resolve fields lookups
>
>
> #### null values
>
>
> By default `null` value is ignored for all filters & lookups. This applies to custom
> filter methods as well. Those won't even be called (you don't have to check for `None`).
> This can be modified using
> `strawberry_django.filter_field(filter_none=True)`
>
>
> This also means that built in `exact` & `iExact` lookups cannot be used to filter for `None`
> and `isNull` have to be used explicitly.
>
>
> #### value resolution
>
>
> - `value` parameter of type `relay.GlobalID` is resolved to its `node_id` attribute
> - `value` parameter of type `Enum` is resolved to is's value
> - above types are converted in `lists` as well
>
>
> resolution can modified via `strawberry_django.filter_field(resolve_value=...)`
>
>
> - True - always resolve
> - False - never resolve
> - UNSET (default) - resolves for filters without custom method only
>
>


The code above generates the following schema:
Expand Down Expand Up @@ -354,7 +354,7 @@ class FruitFilter:
> As seen above `strawberry_django.process_filters` function is exposed and can be
> reused in custom methods.
> For filter method `filter` `skip_object_order_method` was used to avoid endless recursion.
>
>


## Adding filters to types
Expand Down Expand Up @@ -434,7 +434,7 @@ The previous version of filters can be enabled via [**USE_DEPRECATED_FILTERS**](
> [!WARNING]
> If **USE_DEPRECATED_FILTERS** is not set to `True` legacy custom filtering
> methods will be *not* be called.
>
>


When using legacy filters it is important to use legacy
Expand All @@ -451,4 +451,4 @@ Migration process could be composed of these steps:
- enable **USE_DEPRECATED_FILTERS**
- gradually transform custom filter field methods to new version (do not forget to use old FilterLookup if applicable)
- gradually transform default `filter` methods
- disable **USE_DEPRECATED_FILTERS** - ***This is breaking change***
- disable **USE_DEPRECATED_FILTERS** - ***This is breaking change***
6 changes: 3 additions & 3 deletions apps/frontend/src/content/docs/django/guide/mutations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ mutation {
> If all or most of your mutations use this behaviour, you can change the
> default behaviour for `handle_django_errors` by setting
> `MUTATIONS_DEFAULT_HANDLE_ERRORS=True` in your [strawberry django settings](/docs/django/guide/settings)
>
>


## Input mutations
Expand Down Expand Up @@ -172,7 +172,7 @@ class Mutation:
> [!CAUTION]
> This is totally discouraged as it allows for any issue with the filters
> to be able to alter your whole model collection.
>
>


Filters can be added to update and delete mutations. More information in the
Expand All @@ -188,4 +188,4 @@ class Mutation:
deleteFruits: List[Fruit] = mutations.delete(filters=FruitFilter)

schema = strawberry.Schema(mutation=Mutation)
```
```
4 changes: 2 additions & 2 deletions apps/frontend/src/content/docs/django/guide/optimizer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Song.objects.all().only(
> Even though `album__release_date` field was not selected here, it got selected
> in the prefetch query later. Since Django caches known objects, we have to select it here or
> else it would trigger extra queries latter.
>
>


## Optimization hints
Expand Down Expand Up @@ -294,4 +294,4 @@ class OrderItem:
```

`total` now will be properly optimized since it points to a `@model_property`
decorated attribute, which contains the required information for optimizing it.
decorated attribute, which contains the required information for optimizing it.
10 changes: 5 additions & 5 deletions apps/frontend/src/content/docs/django/guide/ordering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FruitOrder:
> In most cases order fields should have `Optional` annotations and default value `strawberry.UNSET`.
> Above `auto` annotation is wrapped in `Optional` automatically.
> `UNSET` is automatically used for fields without `field` or with `strawberry_django.order_field`.
>
>


The code above generates the following schema:
Expand Down Expand Up @@ -78,14 +78,14 @@ class FruitOrder:
> [!WARNING]
> Do not use `queryset.order_by()` directly. Due to `order_by` not being chainable
> operation, changes applied this way would be overriden later.
>
>


> [!TIP]
> The `strawberry_django.Ordering` type has convenient method `resolve` that can be used to
> convert field's name to appropriate `F` object with correctly applied `asc()`, `desc()` method
> with `nulls_first` and `nulls_last` arguments.
>
>


The code above generates the following schema:
Expand Down Expand Up @@ -219,7 +219,7 @@ class FruitOrder:
> As seen above `strawberry_django.process_order` function is exposed and can be
> reused in custom methods.
> For order method `order` `skip_object_order_method` was used to avoid endless recursion.
>
>


## Adding orderings to types
Expand All @@ -244,4 +244,4 @@ Orderings added into a field override the default order of this type.
@strawberry.type
class Query:
fruit: Fruit = strawberry_django.field(order=FruitOrder)
```
```
Loading