simonw / datasette-graphql

Datasette plugin providing an automatic GraphQL API for your SQLite databases
https://datasette-graphql-demo.datasette.io/
Apache License 2.0
101 stars 6 forks source link

TypeError: Query fields cannot be resolved. The description of the enum value must be a string. #85

Closed simonw closed 3 years ago

simonw commented 3 years ago

Getting this in my local environment on http://127.0.0.1:8009/github/issue_comments while trying to fix #84.

simonw commented 3 years ago

I'm only getting it on table pages under /github - table pages under /fixtures work fine.

simonw commented 3 years ago

I dropped a debugger into the graphql code itself and found this:

> /Users/simon/.local/share/virtualenvs/datasette-graphql-n1OSJCS8/lib/python3.8/site-packages/graphql/type/definition.py(1231)__init__()
-> raise TypeError("The description of the enum value must be a string.")
(Pdb) list
1226            extensions: Optional[Dict[str, Any]] = None,
1227            ast_node: Optional[EnumValueDefinitionNode] = None,
1228        ) -> None:
1229            if description is not None and not is_description(description):
1230                import pdb; pdb.set_trace()
1231 ->             raise TypeError("The description of the enum value must be a string.")
1232            if deprecation_reason is not None and not is_description(deprecation_reason):
1233                raise TypeError(
1234                    "The deprecation reason for the enum value must be a string."
1235                )
1236            if extensions is not None and (
(Pdb) description
<reposSort.description: 'description'>

So it looks like having a column named description confuses Graphene.

milieere commented 1 year ago

Thanks. This just saved me a lot of time debugging this!