-
-
Notifications
You must be signed in to change notification settings - Fork 144
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the Bug
When I implemented an extension and I setted a value to self.execution_context.result.extensions
. This field is not shown in the response.
I've already debugged and the value is setted properly, but it's not shown in the response.
import strawberry
from models.product import Product
@strawberry.type
class ProductQuery:
@strawberry.field
@classmethod
def product_by_slug(cls, slug: str) -> Product:
return Product.objects.get(slug=slug)
from strawberry.extensions import SchemaExtension
class ResponseExtension(SchemaExtension):
def on_request_end(self):
result = self.execution_context.result
if not result.extensions:
result.extensions = {}
result.extensions["field1"] = "value1"
result.extensions["field2"] = "value2"
print(self.execution_context.result.extensions)
@strawberry.type
class Query(
ProductQuery
):
pass
schema = strawberry.Schema(
query=Query,
extensions=[
ResponseExtension
]
)
There is no extensions
field in the response
{
"data": {
"productBySlug": {
"name": "myname"
}
}
# extensions: {} should be displayed on this level.
}
System Information
- Operating system: Windows
- Strawberry version: strawberry-graphql-django==0.60.0
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working