这是indexloc提供的服务,不要输入任何密码
Skip to content

Compilation Errors in Generated Java Classes: Missing Methods, Duplicate Case Labels, and Method Definitions #67

@alexyzmarino

Description

@alexyzmarino

Issue Summary

I encountered multiple compilation errors when using the generated Java classes from the schema.json file for Admin API, which was fetched using the method described in Issue #65. These errors require manual intervention to resolve, making the process less efficient and prone to mistakes.

Steps to Reproduce

Fetch the schema.json file as described in Issue #65.
Use the graphql_java_gen Ruby code to generate Java classes from the schema.
Attempt to compile the generated Java code in a Maven project.

Compilation Errors

Here are some examples of the errors encountered during compilation:

Cannot find symbol:

[ERROR] /home/alex/projects/work/codecommit/3w-shopify-client/src/main/java/org/sample/shopify/admin/graphql/SaleEdge.java:[47,54] cannot find symbol
symbol:   method create(com.google.gson.JsonObject)
location: class it.trew.shopify.admin.graphql.UnknownSale

Duplicate case labels:

[ERROR] /home/alex/projects/work/codecommit/3w-shopify-client/src/main/java/org/sample/shopify/admin/graphql/UnknownHasMetafields.java:[135,13] duplicate case label
[ERROR] /home/alex/projects/work/codecommit/3w-shopify-client/src/main/java/org/sample/shopify/admin/graphql/UnknownHasMetafields.java:[143,13] duplicate case label

Method already defined:

[ERROR] /home/alex/projects/work/codecommit/3w-shopify-client/src/main/java/org/sample/shopify/admin/graphql/DisplayableErrorQuery.java:[966,34] method onProductVariantsBulkUpdateUserError(it.trew.shopify.admin.graphql.ProductVariantsBulkUpdateUserErrorQueryDefinition) is already defined in class it.trew.shopify.admin.graphql.DisplayableErrorQuery

Can the Ruby code responsible for generating these classes be updated to resolve these issues?

Specifically:

  • Ensure that all required methods are properly generated (e.g., create methods for unknown types).
  • Avoid generating duplicate case labels in the switch statements.
  • Prevent duplicate method definitions in the same class.

Additional Information

Ruby version: ruby 3.0.2p107
graphql_java_gen version: 0.2.1
Java version: openjdk version 1.8.0_402
Admin GraphQL API version: 2025-01

Let me know if any additional information is needed. Thank you for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions