Problem/Motivation
When we enable similar machine name entities on graphql_compose we get the "Unsupported type" for the entity reference fields. This is happening for example when we enable the entity types "message, private_message, private_message_thread" together.
The GraphQL says "[UnsupportedType!]!" for such fields althouth it finds the new types normally.
Steps to reproduce
1) On a fresh Drupal install modules message, private_message and graphql_compose.
2) Create some bundles for the "message" entity type above.
3) Create a simple module that enables graphql_compose for entities message, private_message, private_message_thread (module attached as zip).
4) Enable module graphql_compose_private_messages and graphql_compose_messages
5) Enable the graphql_compose schema on Drupal Graphql and add the types above to the schema (/admin/config/graphql_compose/)
6) Go to the GraphQL Documentation on explorer and check for the "privateMessages" field. It is an "[UnsupportedType!]!" although the new entity types are normally supported.
Example commands to use the attached zip file with ddev:
unzip test_pm_drupal.zip
cd test_pm_drupal
ddev start
ddev composer install
ddev import-db --file database.sql.gz
# ddev drush cim -y
# Open https://test-pm-drupal.ddev.site/admin/config/graphql/servers/manage/graphql_compose_server/explorer
Proposed resolution
- Not sure if this is happening due to the naming patterns. Because in this case the machine names in GraphQL are "MessageXXX, PrivateMessagePrivateMessage, PrivateMessageThreadPrivateMessageThread".
- Tried to use custom "id" and "prefix" on the "@GraphQLComposeEntityType" annotation but did not solve the issue.
Remaining tasks
| Comment | File | Size | Author |
|---|---|---|---|
| test_pm_drupal.zip | 40.63 MB | theodorosploumis |
Comments
Comment #2
almunningsWill take a look at this in the next day or so.
Had second baby, now this baby suffers!
🥲
Comment #3
almunningsAdd a
MessageTemplatetype to bridge the `template` inMessageRemove the prefix from
PrivateMessageandPrivateMessageThread(These entities don't have bundles)That should get your entity references to resolve.
As for the overall functionality of your modules, No idea, choose your own adventure! :D
Have fun!