Skip to content
This repository has been archived by the owner on Apr 25, 2021. It is now read-only.

How do resolvers get mapped? #7

Open
pspierce opened this issue Apr 11, 2020 · 1 comment
Open

How do resolvers get mapped? #7

pspierce opened this issue Apr 11, 2020 · 1 comment

Comments

@pspierce
Copy link

Using the example from the README, I get:
File "/app/tractionapp/traction/init.py", line 28, in
api_1 | schema = make_executable_schema(
api_1 | File "/usr/local/lib/python3.8/site-packages/ariadne/executable_schema.py", line 33, in make_executable_schema
api_1 | obj.bind_to_schema(schema)
api_1 | AttributeError: 'function' object has no attribute 'bind_to_schema'

I don't see how you are binding the resolver to the schema? Looking at the resolver code, you aren't using a decorator to do it or .set_field().
If I take out resolve_auth_token from make_executable_schema then at least the server will run but ariadne throws an error when you attempt to execute the mutation in playground because no token is returned as the resolver code is never run.

@pspierce
Copy link
Author

pspierce commented Apr 11, 2020

This worked:

jwt_mutation = MutationType()

jwt_mutation.set_field('tokenAuth', resolve_token_auth)

schema = make_executable_schema(
    [
        query_type_defs,
        object_type_defs,
        mutations_type_defs,
        auth_token_definition,
        auth_token_verification_definition
    ],
    [
        query_user,
        jwt_mutation,
    ]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant