ZeroQL
ZeroQL copied to clipboard
Problem building against WPGrapQL
Describe the bug
This appears to be an issue similar or the same I had with StrawberryShake against the same schema source.
How to Reproduce Create a Wordpress website: download free app https://localwp.com/ to create a local wordpress installation.
Install the WPGraphQL plugin: https://wordpress.org/plugins/wp-graphql
Go through zeroql setup steps, and when reaching the build step, build fails with 14 errors: f:\qlclient\obj\ZeroQL\config.zeroql.json.g.cs(78909,43): error CS1001: Identifier expected [f:\qlclient\qlclient.csproj] f:\qlclient\obj\ZeroQL\config.zeroql.json.g.cs(78909,43): error CS1003: Syntax error, ',' expected [f:\qlclient\qlclient.csproj] f:\qlclient\obj\ZeroQL\config.zeroql.json.g.cs(78910,13): error CS1003: Syntax error, ',' expected [f:\qlclient\qlclient.csproj] f:\qlclient\obj\ZeroQL\config.zeroql.json.g.cs(78911,43): error CS1001: Identifier expected [f:\qlclient\qlclient.csproj] f:\qlclient\obj\ZeroQL\config.zeroql.json.g.cs(78911,43): error CS1003: Syntax error, ',' expected [f:\qlclient\qlclient.csproj] f:\qlclient\obj\ZeroQL\config.zeroql.json.g.cs(78912,13): error CS1003: Syntax error, ',' expected [f:\qlclient\qlclient.csproj] f:\qlclient\obj\ZeroQL\config.zeroql.json.g.cs(83231,958): error CS1003: Syntax error, ',' expected [f:\qlclient\qlclient.csproj] f:\qlclient\obj\ZeroQL\config.zeroql.json.g.cs(83231,964): error CS1003: Syntax error, ',' expected [f:\qlclient\qlclient.csproj] f:\qlclient\obj\ZeroQL\config.zeroql.json.g.cs(83231,1033): error CS1003: Syntax error, ',' expected [f:\qlclient\qlclient.csproj] f:\qlclient\obj\ZeroQL\config.zeroql.json.g.cs(83231,1039): error CS1003: Syntax error, ',' expected [f:\qlclient\qlclient.csproj] f:\qlclient\obj\ZeroQL\config.zeroql.json.g.cs(83231,1775): error CS1003: Syntax error, ',' expected [f:\qlclient\qlclient.csproj] f:\qlclient\obj\ZeroQL\config.zeroql.json.g.cs(83231,1781): error CS1003: Syntax error, ',' expected [f:\qlclient\qlclient.csproj] f:\qlclient\obj\ZeroQL\config.zeroql.json.g.cs(83231,1850): error CS1003: Syntax error, ',' expected [f:\qlclient\qlclient.csproj] f:\qlclient\obj\ZeroQL\config.zeroql.json.g.cs(83231,1856): error CS1003: Syntax error, ',' expected [f:\qlclient\qlclient.csproj]
Expected behavior
A Successful build
The GraphqQL schema that fails
Attached as zipfile
Screenshots
Environment (please complete the following information):
- Nuget package version [6.1.1]
- IDE:vs2022 (nut never opened)
- .Net Version 8
Additional context Add any other context about the problem here.
I believe this might be an issue with enums. The schema contains enums that begin with _ which are the 14 errors in the generated source code.
enum MediaItemSizeEnum { LARGE MEDIUM MEDIUM_LARGE THUMBNAIL WOOCOMMERCE_GALLERY_THUMBNAIL WOOCOMMERCE_SINGLE WOOCOMMERCE_THUMBNAIL _1536X1536 _2048X2048 }
After going and manually fixing the enum errors to include the _ in the generated source, a whole bunch of other errors sprang up:
I have fixed the issue with the enums(6.2.0-preview.3), but as you showed, it now fails with interfaces. Some fields in the schema have additional arguments compared to those defined in interfaces. I will have a look later today.
I appreciate that.
Hello, are you making progress?
I fixed the situation that was responsible for the first two issues. However, there is another issue. The schema contains the interfaces Node
and Product
. Then the Product
is assigned to Node
property. In GraphQL, it works. In C# is doesn't because the Product
has to implement Node
. I am thinking about how to fix it.
How do you get this schema? Looks like it is broken. There are interfaces that are not explicitly "implemented". For example, PageEditorBlock
and EditorBlock
. They are identical and have zero relations between each other on the schema level, but properties use them as if they are identical.
The same issue was with Node
in lots of places. I decided to force the generation to "believe" that it is okay because it is a part of the GraphQL Relay. However, with the EditorBlock,
it is not so straightforward.
How do you get this schema?
Nevermind. You already mentioned it in the initial description.
Thanks for staying on this.
Wordpress has various 'post' types, including 'post' and 'pages' by default.
The EditorBlock interface is provided by a 3rd party plugin which adds graphql functionality for one of the core features of wordpress, the Gutenberg Block editor, which allows users to assemble their content using modules/bocks r: https://github.com/wpengine/wp-graphql-content-blocks/tree/main
This explains why the different interfaces.... They are used to determine under which contexts (post, page, etc..) they can be used. Probably to not allow them to appear on post types not supported by the Gutenberg editor and related enabled post types in the main graphql plugin.
So though they each have the same properties, the interfaces are only being used as markers.