wpengine / wp-graphql-content-blocks

Plugin that extends WPGraphQL to support querying (Gutenberg) Blocks as data

Home Page:https://faustjs.org/docs/gutenberg/wp-graphql-content-blocks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plugin breaks GraphQL schema if CPT slug contains dash (`-`)

szaleq opened this issue · comments

Some interface type names are invalid.
For example, I have a case-study CPT registered. This causes wp-graphql-content-blocks to create an interface named NodeWithCase-studyEditorBlock, which is invalid in GraphQL and causes errors. GraphiQL doesn't load, it presents the error in the console: Uncaught (in promise) GraphQLError: Names must only contain [_a-zA-Z0-9] but "NodeWithCase-studyEditorBlocks" does not.
obraz

I believe the code responsible for this is in WPGraphQL\ContentBlocks\Type\InterfaceType\PostTypeBlockInterface class, here and here. This code uses ucfirst on $post_type, which is a post slug containing a dash. I think it should rather use Utils::format_type_name, like here in the Registry class.

@szaleq this is already fixed and we will be publishing a new Release today.