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

Support schemas in JAR files #98

Closed
paulbakker opened this issue Apr 9, 2021 · 9 comments
Closed

Support schemas in JAR files #98

paulbakker opened this issue Apr 9, 2021 · 9 comments

Comments

@paulbakker
Copy link
Collaborator

At Netflix we ship common types as libraries, with schemas in META-INF/schema.
Currently we can't add these schemas to the code generation configuration, so these types aren't known during generation. This requires a workaround with typeMappings.

Ideally we should also support a mechanism to provide a typeMapping in the JAR file, e.g. with a mapping file in META-INF, so that we can extend the typeMappings based on libraries.

@jbaxleyiii
Copy link
Contributor

@paulbakker did y'all ever implement something like this? I'm interested in splitting a dgs app into a multi-module project split by service boundary so there would be extended types we would want to collect and merge in the main application

@srinivasankavitha
Copy link
Contributor

srinivasankavitha commented Sep 14, 2022 via email

@paulbakker
Copy link
Collaborator Author

@jbaxleyiii we do exactly that, we have a few schemas containing "common" types, which are shipped in JAR files. Both the Intellij plugin and the framework support this if the schema is in META-INF/schema.

I don't think we ever added it to codegen, because it is less of a common need. We could bring that up again though.

@jbaxleyiii
Copy link
Contributor

jbaxleyiii commented Sep 14, 2022

Gotcha! Any recommendations for setup in a multi-module project? One thing I was considering was having a single schema module that creates the generated code for all schemas sourced in the repo but could be used by other modules but not sure how that would scale.

Mainly so since the schema needs to be checked against all other parts for global consistency (i.e. extending a type and not having collisions) so having schemas be part of modules doesn't seem like it would create the ability to do extensions.

edit:
This approach is working but still would love to hear y'alls approach!

@srinivasankavitha
Copy link
Contributor

srinivasankavitha commented Sep 14, 2022 via email

@jbaxleyiii
Copy link
Contributor

@srinivasankavitha how do you handle shared interfaces? typeMapping doesn't allow you to link to the generated interface

@srinivasankavitha
Copy link
Contributor

srinivasankavitha commented Sep 19, 2022 via email

@srinivasankavitha
Copy link
Contributor

Merged this PR: #468
Will be available in the next release (early next week)

@srinivasankavitha
Copy link
Contributor

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

3 participants