graphql-python / graphene-federation

Federation implementation for Graphene.
MIT License
40 stars 10 forks source link

Breaks with custom scalars #13

Closed Meemaw closed 1 year ago

Meemaw commented 1 year ago

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)
patrick91 commented 1 year ago

@Meemaw can you post the error? 😊

arunsureshkumar commented 1 year ago

@Meemaw can you post the error? 😊

@patrick91 - This issue will be resolved in the https://github.com/graphql-python/graphene-federation/pull/14 along with other few issues related to Compound keys as well.

Meemaw commented 1 year ago

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'
patrick91 commented 1 year ago

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

arunsureshkumar commented 1 year ago

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

Sure!

arunsureshkumar commented 1 year ago

https://github.com/graphql-python/graphene-federation/pull/15 - @patrick91 Please review.

patrick91 commented 1 year ago

@Meemaw should be fixed in v3.1.2 :)

patrick91 commented 1 year ago

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