@@ -4,24 +4,22 @@ title: Schema Configurations
44
55# Schema Configurations
66
7- Strawberry allows to customise how the schema is generated by passing
8- configurations .
7+ Strawberry allows you to customise how the schema is generated by passing
8+ configuration options as a dictionary .
99
10- To customise the schema you can create an instance of ` StrawberryConfig ` , as
11- shown in the example below:
10+ To customise the schema, you can pass a configuration dictionary to the ` config `
11+ parameter, as shown in the example below:
1212
1313``` python
1414import strawberry
1515
16- from strawberry.schema.config import StrawberryConfig
17-
1816
1917@strawberry.type
2018class Query :
2119 example_field: str
2220
2321
24- schema = strawberry.Schema(query = Query, config = StrawberryConfig( auto_camel_case = False ) )
22+ schema = strawberry.Schema(query = Query, config = { " auto_camel_case" : False } )
2523```
2624
2725In this case we are disabling the auto camel casing feature, so your output
@@ -33,6 +31,14 @@ type Query {
3331}
3432```
3533
34+ <Note >
35+
36+ **Upgrading from v0 .284.0 or earlier ?** See the
37+ [v0 .285.0 breaking changes ](../breaking-changes/0.285.0.md) for migration
38+ instructions if you were using the old `StrawberryConfig ` class syntax .
39+
40+ </Note >
41+
3642## Available configurations
3743
3844Here 's a list of the available configurations :
@@ -44,7 +50,7 @@ like `example_field` will be converted to `exampleField`. You can disable this
4450feature by setting `auto_camel_case ` to `False `.
4551
4652```python
47- schema = strawberry.Schema(query=Query, config=StrawberryConfig( auto_camel_case= False) )
53+ schema = strawberry.Schema(query=Query, config={ " auto_camel_case" : False} )
4854```
4955
5056### default_resolver
@@ -58,8 +64,6 @@ resolver.
5864``` python
5965import strawberry
6066
61- from strawberry.schema.config import StrawberryConfig
62-
6367
6468def custom_resolver (obj , field ):
6569 try :
@@ -80,9 +84,7 @@ class Query:
8084 return {" name" : " Patrick" }
8185
8286
83- schema = strawberry.Schema(
84- query=Query, config=StrawberryConfig(default_resolver=custom_resolver)
85- )
87+ schema = strawberry.Schema(query = Query, config = {" default_resolver" : custom_resolver})
8688```
8789
8890### relay_max_results
@@ -91,7 +93,7 @@ By default Strawberry's max limit for relay connections is 100. You can
9193customise this by setting the ` relay_max_results ` configuration.
9294
9395``` python
94- schema = strawberry.Schema(query=Query, config=StrawberryConfig( relay_max_results=50) )
96+ schema = strawberry.Schema(query = Query, config = { " relay_max_results" : 50 } )
9597```
9698
9799### disable_field_suggestions
@@ -101,9 +103,7 @@ schema. You can disable this feature by setting `disable_field_suggestions` to
101103` True ` .
102104
103105``` python
104- schema = strawberry.Schema(
105- query=Query, config=StrawberryConfig(disable_field_suggestions=True)
106- )
106+ schema = strawberry.Schema(query = Query, config = {" disable_field_suggestions" : True })
107107```
108108
109109### info_class
@@ -123,7 +123,7 @@ class CustomInfo(Info):
123123 return self .context[" response" ].headers
124124
125125
126- schema = strawberry.Schema(query=Query, config=StrawberryConfig( info_class= CustomInfo) )
126+ schema = strawberry.Schema(query = Query, config = { " info_class" : CustomInfo} )
127127```
128128
129129### enable_experimental_incremental_execution
@@ -142,7 +142,7 @@ response to be delivered incrementally.
142142
143143``` python
144144schema = strawberry.Schema(
145- query=Query, config=StrawberryConfig( enable_experimental_incremental_execution= True)
145+ query = Query, config = { " enable_experimental_incremental_execution" : True }
146146)
147147```
148148
0 commit comments