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

[FerryGenerator] The code generated for schemas with intricate fragment spread may reference non-existent types #555

Open
koutaro-masaki opened this issue Nov 30, 2023 · 1 comment

Comments

@koutaro-masaki
Copy link

If there is a schema like the following, setting reuse_fragments causes the generated GBookFragment2_author to implement not only GAuthorFragment but also the non-existent type GBookFragment_author.

# book.graphql
type Book {
  title: String
  author: Person
}

type Person {
  name: String
  age: Int
  height: Int
  weight: Int
}

fragment AuthorFragment on Person {
  name
  age
}

fragment BookFragment on Book {
  title
  author {
    ...AuthorFragment
  }
}
# book2.graphql
fragment BookFragment2 on Book {
  ...BookFragment
  author {
    height
    weight
  }
}

If BookFragment and BookFragment2 are defined in the same file, this issue did not occur.

@koutaro-masaki koutaro-masaki changed the title The code generated for schemas with intricate fragment expansion may reference non-existent types The code generated for schemas with intricate fragment spread may reference non-existent types Nov 30, 2023
@koutaro-masaki koutaro-masaki changed the title The code generated for schemas with intricate fragment spread may reference non-existent types [FerryGenerator] The code generated for schemas with intricate fragment spread may reference non-existent types Nov 30, 2023
@koutaro-masaki
Copy link
Author

koutaro-masaki commented Nov 30, 2023

However, defining fragments in the same file may cause UnusedFragment errors, making this not a very effective workaround.

#337

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