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

Generating code from external schemas in JARs - META-INF requirement #668

Open
deweyjose opened this issue Mar 26, 2024 · 6 comments
Open

Comments

@deweyjose
Copy link

Hi team,

Curious why there is a requirement for schema files in external jars to exist under the META-INF folder.

This was uncovered in a maven graphql-codegen plugin project here. I'll update our documentation, but wondering why this is a requirement and does it make sense to update the documentation?

@deweyjose deweyjose changed the title schemaJarFilesFromDependencies - META-INF requirement Generating code from external schemas in JARs - META-INF requirement Mar 26, 2024
@srinivasankavitha
Copy link
Contributor

Usually schema files are added under src/main/resources for graphql projects and hence we scan for the META-INF folder in codegen. Thanks for pointing out the documentation gap, we need to fix that.

@srinivasankavitha
Copy link
Contributor

Fixed the docs here: Netflix/dgs@a518e6d

@deweyjose
Copy link
Author

deweyjose commented Mar 26, 2024

@srinivasankavitha

Usually schema files are added under src/main/resources for graphql projects and hence we scan for the META-INF folder in codegen. Thanks for pointing out the documentation gap, we need to fix that.

Even though the graphqls files are typically under src/main/resources they do not necessarily get packaged in the jar under META-INF. This requirement seems odd to me. All of the .graphql files in the jars I produce are packaged outside of META-INF.

Even Apollo's Federation graphqls files are not packaged under META-INF.

image

Why does the code need to enforce the META-INF prefix vs scanning the entire Jar?

@deweyjose
Copy link
Author

It looks like DGS decided to package error related schema in graphql-error-types under src/main/resources/META-INF/schema which is why it's packaged that way, but not all teams want to structure their codebases this way.
image

@srinivasankavitha
Copy link
Contributor

Ok, I see. At the time of adding this feature, our primary use case was to pick up schemas under META-INF and from other modules in a given project that has schemas under META-INF, so the current implementation addresses that requirement. But for other external dependencies it would not work as you just pointed out. We could enhance this implementation to scan for .graphqls files more generally as well I suppose.

@deweyjose
Copy link
Author

@srinivasankavitha thanks for taking a second look and reconsidering!

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