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

Issues Installing frappe_graphql with Frappe Version 15 #91

Open
osama1998H opened this issue Nov 18, 2024 · 0 comments
Open

Issues Installing frappe_graphql with Frappe Version 15 #91

osama1998H opened this issue Nov 18, 2024 · 0 comments

Comments

@osama1998H
Copy link

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:

  1. Interface Field Mismatch:

    • Description: When generating SDL files, the BaseDocType interface 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 parent fields only for child DocTypes (istable is True), and adjusted the interfaces accordingly.
  2. 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 (BaseDocType and ChildDocType) 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.
  3. Compatibility Issues with Frappe Version 15:

    • Description: The frappe_graphql app 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.

Steps to Reproduce:

  1. Install Frappe version 15.
  2. Install the frappe_graphql app.
  3. Generate SDL files using the command:
    bench --site your_site_name graphql generate_sdl 
    
  4. 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_graphql codebase.
  • Modifications were made to the doctype.py file to adjust the SDL generation logic, but further issues arose.

Suggestions:

  • Update the frappe_graphql app 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_graphql with Frappe version 15.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant