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

Unable to build Projection with nested type #170

Open
nhatnguyen26 opened this issue Aug 22, 2024 · 1 comment
Open

Unable to build Projection with nested type #170

nhatnguyen26 opened this issue Aug 22, 2024 · 1 comment

Comments

@nhatnguyen26
Copy link

Consider a query with this structure

{
        id
        type1 {
            subtype1 {
                id
                name
            }
            name
            subtype2 {
                id
            }
            subtype3 {
                ebayPictureUrl
            }
        }
    }

Using the code generated from this plugin would generate a ProjectionRoot, when traverse the project, once reach the nested projection, there is not a way to come back to the parent level and keep traversing

This way of building will not work

new QueryProjectRoot().
  id()
  .type1()
  .subtype1()
  .id()
  // getParent() and getRoot() is returning Object so it can't be used to traverse back without casting
  .subtype()

A work around seem to be manually build each level as a fileld projection itself but it will not be type/syntax safe

new QueryProjectRoot().
id().
getFields().put("type1", <type1projection building>)
@deweyjose
Copy link
Owner

@nhatnguyen26 can you share your example schema so we can take a look?

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

2 participants