Issues Installing frappe_graphql with Frappe Version 15
Dear frappe_graphql Developers,
I have encountered several issues while installing and using the frappe_graphql app with Frappe version 15. I wanted to bring these to your attention in hopes that they can be addressed to improve compatibility with the latest Frappe version.
Issues Encountered:
-
Interface Field Mismatch:
-
Description: When generating SDL files, the
BaseDocTypeinterface includes fields (parent,parentfield,parenttype) that are not present in non-child DocTypes, leading to GraphQL validation errors. -
Error Messages:
Interface field BaseDocType.parent expected but Zone does not provide it. Interface field BaseDocType.parentfield expected but Zone does not provide it. Interface field BaseDocType.parenttype expected but Zone does not provide it. -
Resolution Attempted: Modified the SDL generation code to conditionally include
parentfields only for child DocTypes (istableisTrue), and adjusted the interfaces accordingly.
-
Description: When generating SDL files, the
-
Duplicate Type and Field Definitions:
- Description: After adjusting the SDL generation code, encountered errors indicating that types and fields are defined multiple times in the schema.
-
Error Messages:
TypeError: Enum value 'KanbanBoardColumnIndicatorSelectOptions.RED' can only be defined once. There can be only one type named 'BaseDocType'. Field 'BaseDocType.doctype' can only be defined once. Field 'BaseDocType.name' can only be defined once. Field 'BaseDocType.owner' can only be defined once. ... -
Cause: The interface definitions (
BaseDocTypeandChildDocType) and certain enums are being included multiple times in the generated SDL files. - Resolution Attempted: Adjusted the code to ensure that interface definitions and enums are included only once.
-
Compatibility Issues with Frappe Version 15:
-
Description: The
frappe_graphqlapp seems to have multiple compatibility issues when used with Frappe version 15. This includes changes in the underlying Frappe framework that affect how DocTypes and fields should be handled in the GraphQL schema.
-
Description: The
Steps to Reproduce:
- Install Frappe version 15.
- Install the
frappe_graphqlapp. - Generate SDL files using the command:
bench --site your_site_name graphql generate_sdl - Start the bench and attempt to execute a GraphQL query.
Expected Behavior:
- The GraphQL endpoint should be operational without schema validation errors.
Actual Behavior:
- Encountered multiple errors related to interface implementation mismatches and duplicate definitions in the GraphQL schema.
Additional Information:
- The issues seem to stem from changes in Frappe version 15 that are not yet accommodated in the
frappe_graphqlcodebase. - Modifications were made to the
doctype.pyfile to adjust the SDL generation logic, but further issues arose.
Suggestions:
- Update the
frappe_graphqlapp to ensure compatibility with Frappe version 15. - Review the SDL generation code to prevent duplicate type and enum definitions.
- Consider conditionally including fields and interfaces based on the DocType's properties (
istable,issingle, etc.).
Conclusion:
The frappe_graphql app is a valuable tool for integrating GraphQL with Frappe, but currently faces significant compatibility issues with the latest version of Frappe. Addressing these issues will greatly enhance its usability and reliability.
Please let me know if I can provide any further information or assist with testing.
Thank you for your attention to this matter.
Summary
- Explanation: The errors are caused by duplicate definitions of types, interfaces, and enums in the generated GraphQL schema.
- Solution: Adjust the SDL generation code to ensure that interfaces and enums are defined only once, and that fields are included appropriately based on the DocType's characteristics.
-
GitHub Issue: Provided a detailed issue report to help the developers understand and address the problems encountered when using
frappe_graphqlwith Frappe version 15.
You can use my fork of it which has those issues resolved.
https://gitlab.com/bitspur/frappe/graphql