Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No Schema Available" #156

Open
jonnyasmar opened this issue Sep 16, 2018 · 4 comments
Open

"No Schema Available" #156

jonnyasmar opened this issue Sep 16, 2018 · 4 comments

Comments

@jonnyasmar
Copy link

Hello @markhuot !

First, I want to say -- what an incredible plugin! I'm migrating an existing Craft 3 site built traditionally on Twig templates & PHP to a React SPA and this is a frickin' God-send. I can't express to you the gratitude I have for this plugin right now...

Only issue I'm currently experiencing is it seems my schema is broken. I'm getting the "No Schema Available" message when I open up the Docs in Graphiql (JS GraphQL plugin for WebStorm is also picking up nothing).

I'm able to query just fine, even some slightly involved queries with relatedTos and subqueries for things like asset lists. I'm also getting a complete list of sections in the Token Scopes settings.

Any ideas what might be causing this and/or how to fix it?

@jonnyasmar
Copy link
Author

Aha! Digging a little further into the issues here to learn more about CraftQL, I learned that the devmode=true flag gives a little bit more info which led me to a temporary solution.

So, I had a dropdown field that had numbers as values -- it seems this broke the schema analyzer "RatingEnum must be an array with values as keys".

After replacing all of the values of my dropdown with strings (that did not start with a number) the schema was generated successfully!

So, I guess a feature request here might be to support dropdowns with numbers as values? Not sure if that's feasible or not with the existing architecture?

@markhuot
Copy link
Owner

Oooo, interesting, yes this is one of the most fragile parts of the "Craft to GraphQL" conversion. Craft also allows empty drop-down values, which GraphQL chokes on too.

In terms of a fix I'm inclined to say that CraftQL just won't support numeric drop-down values, not natively at least because GraphQL doesn't support it. The only other option I can think of is some sort of transformer that moves 1 to value1 or something like that…

@markhuot
Copy link
Owner

Unfortunately I don't have a great way to fix this so I added an explicit Exception in to the code. Now if you bootstrap CraftQL with numeric drop-down values you'll get an error pointing you right to the field with the issue. I'll leave this open until I cut a stable release.

@jonnyasmar
Copy link
Author

@markhuot Thanks for the quick action on this one! I think an explicit exception will help a lot.

One suggestion I might add is to make note of the dev mode features somewhere in the README :)

markhuot added a commit that referenced this issue Feb 12, 2019
Set `throwSchemaBuildErrors` to `true` to get the old functionality of thrown exceptions.
seamofreality pushed a commit to djfarly/craftql that referenced this issue Jul 3, 2019
Set `throwSchemaBuildErrors` to `true` to get the old functionality of thrown exceptions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants