The following:
import strawberry
from strawberry import UNSET
from strawberry.types.info import Info
from typing import Optional, List, Union
@strawberry.type
class Example:
id: int
slot_info: str
@strawberry.field
async def slot_info(self, info: Info) -> Optional[str]:
return None
@strawberry.type
class Query:
@strawberry.field
def contest(self) -> Optional[Example]:
return None
schema = strawberry.Schema(query=Query)
Generates the following schema:
type Example {
id: Int!
slotInfo: String!
}
type Query {
contest: Example
}
which is usually not what you'd expect. I think we should raise an error for this case.
This should also happen when having two fields with the same name (as in strawberry.field(name="abc")
.
We need to think what happens when subclassing a type, I think we should also error if we have the same field name with a different type, but we should allow to change resolver/extensions, but nothing else (?)
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too