Closed dvekeman closed 2 years ago
Hello @dvekeman, thank you for reporting that! Do you know what the resulting GraphQL Schema Definition Language (SDL) snippet would be?
Hi @dillonkearns
Sure, attached is a minimal example. Is this what you were looking for?
"""
columns and relationships of "external_user"
"""
type external_user
Hey @dvekeman, thanks for the info, I'm not sure how to translate that to GraphQL types, though. Could you try sharing it with the GraphQL types in Schema Definition Language? Here's one reference that explains SDL: https://www.digitalocean.com/community/tutorials/graphql-graphql-sdl.
It looks like Hasura also has a guide on exporting SDL: https://hasura.io/docs/latest/graphql/core/guides/export-graphql-schema.html. You could try to export it from that setup, and then just share the relevant section of the exported SDL. That would be a big help if you don't mind!
Hi @dillonkearns
In my above comment there is a text file with a link (https://github.com/dillonkearns/elm-graphql/files/7297112/schema.graphql.txt). Maybe you overlooked it but I believe that's what you are looking for?
I generated the file using graphqurl as described on the Hasura documentation.
It is the schema for the (hasura) role 'test' which I created for this ticket. This role only has access to the external_user relation and given I didn't allow any permissions on any of the columns the type got generated as an empty type.
Let me know if you are looking for something else.
Regards Dieter
Hello @dvekeman, sorry for the slow response on this. Yes, I see now that you had attached what I asked for earlier, thanks for clarifying!
So I did some experimentation and I found that I couldn't even get the end-to-end test to parse that schema because the SDL validator considers it invalid GraphQL schema.
Here's a relevant test case:
And the relevant code:
Maybe you could share the result of the introspection JSON query (https://github.com/dillonkearns/elm-graphql/blob/068056540eb566fdf888aa1620605173b7b96511/docs/introspection-query.gql)? Then I could make a test case for that to handle that case.
Hi @dillonkearns
Thanks a lot for the investigations. I think the conclusion is that the issue is on the Hasura side.
Our production instance is still running on Hasura v1.3.3 but in the mean time they have released Hasura v2.x which has some breaking changes but we are going to migrate to that version.
So I installed Hasura v2.x on my local environment and couldn't reproduce the problem. It seems like the schema that is generated is now correct and elm-graphql is able to generate the stubs for it.
Upon investigating a bit I think the main difference is
v1.3.3
"""
select columns of table "external_user"
"""
enum external_user_select_column
In v2.0.10 this enum is no longer present (I attached the full schemas for your information).
v1.3.3 schema_v1.3.3.graphql.txt
v2.0.10 schema_v2.0.10.graphql.txt
And in case it would be of any use, here is also the result from the introspection query (on v1.3.3 which had the problem):
Something I noticed it accidentally and really minor but wanted to share it here.
In Hasura, in my Permissions tab, I forgot to toggle the update columns
Upon generating the elm files for the
user
role I gotUpon applying the suggestion (running with --skip-elm-format) I found a module containing invalid elm syntax:
Obviously the solution in the end was to enable some columns (I'm not even sure why hasura allows me to save the permissions without selecting any field) but maybe the generated code should've looked like
or alternatively no Exercise_theory_code_update_column type and instead
or an explicit error that this is not supported.