graphql-python / graphene-federation

Federation implementation for Graphene.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Breaks with custom scalars

Meemaw opened this issue · comments

Version 3.1.0 breaks with custom scalars.

To reproduce:

class AddressScalar(Scalar):
    base = String

    @staticmethod
    def coerce_address(value: Any):
        ...

    serialize = coerce_address
    parse_value = coerce_address

    @staticmethod
    def parse_literal(ast):
        ...


class Query(ObjectType):
    test = String(x=AddressScalar())


schema = build_schema(query=Query)

@Meemaw can you post the error? 😊

@Meemaw can you post the error? 😊

@patrick91 - This issue will be resolved in the #14 along with other few issues related to Compound keys as well.

It seems 3.1.1 still breaks with custom enums cc @arunsureshkumar @patrick91

  File "/runner/_work/xx/.venv/lib/python3.11/site-packages/graphene_federation/utils.py", line 98, in get_attributed_fields
    for field in list(type_.graphene_type._meta.fields):
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'EnumOptions' object has no attribute 'fields'

@arunsureshkumar do you have time to check at this error too? :)

@arunsureshkumar do you have time to check at this error too? :)

Sure!

#15 - @patrick91 Please review.

@Meemaw should be fixed in v3.1.2 :)

sorry, it should be 3.1.3, I forgot to update the version in setup.py 🤦