strawberry icon indicating copy to clipboard operation
strawberry copied to clipboard

Federation: change fields to follow the name converter convention

Open patrick91 opened this issue 5 years ago • 0 comments

At the moment keys don't get camel cased (or rather, they don't use our name converter), so you need to specify the camel case version ie:

@strawberry.federation.type(keys=["my_key"])
class X:
    my_key: strawberry.ID

the resulting directive should be @key(fields:"myKey"), but now we get @key(fields:"my_key").

In a similar fashion when using resolve_reference we need to snake_case the arguments, as now we'd get myKey:

@strawberry.federation.type(keys=["my_key"])
class X:
    my_key: strawberry.ID

    def resolve_reference(self, myKey):
         ...

patrick91 avatar Nov 20 '20 09:11 patrick91