Skip to content

Release com.kobylynskyi.graphql.codegen.model.graphql as a separate artifact #564

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
streibeb opened this issue Mar 3, 2021 · 7 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@streibeb
Copy link
Contributor

streibeb commented Mar 3, 2021

Is your feature request related to a problem? Please describe.
Our project consists of three sub-projects:

  • foo-api
  • foo-client
  • foo-service

The generator is run in the foo-service project, which builds the models for the foo-api project. foo-client performs the serialization and makes the http requests for service-to-service communication. To keep the projects lightweight, we only want to include the necessary client dependencies in the api and client projects rather than the full code-generator dependency.

Describe the solution you'd like
The package com.kobylynskyi.graphql.codegen.model.graphql to be split out into its own project and released separately alongside future builds of the project. I don't really have a recommendation or expectation for naming of this new project.

Describe alternatives you've considered
We implemented the proposed fix locally in our project and included our temporary solution as an api dependency in the foo-api and foo-client projects and everything works as we would expect.

@kobylynskyi kobylynskyi added the enhancement New feature or request label Mar 4, 2021
@jxnu-liguobin
Copy link
Collaborator

It looks good. Does this mean that the graphql package can be replaced in the future?

@kobylynskyi
Copy link
Owner

@jxnu-liguobin sorry, what do you mean "graphql package can be replaced"?

@jxnu-liguobin
Copy link
Collaborator

@kobylynskyi Replace the implementation. But it seems that the implementation of the package doesn't have to replace.

@jamesmartinpp
Copy link

Creating a separate artifact that has only the classes needed to compile the generated client classes would be really great.

@dspenceb
Copy link

I agree that this solution is a bit better than what we currently have, but I feel having any dependency is somewhat of a smell. Could these classes appear as part of the "generated" pool of classes? This could eliminate the need to depend on anything outside and I think would be the lightest weight solution by far.

@kobylynskyi
Copy link
Owner

kobylynskyi commented Mar 26, 2021

I think the easiest solution would be to just exclude graphql-java dependency (+ other) from graphql-java-codegen by marking all dependencies as "compileOnly": https://github.com/kobylynskyi/graphql-java-codegen/pull/611/files#diff-49a96e7eea8a94af862798a45174e6ac43eb4f8b4bd40759b5da63ba31ec3ef7
So that graphql-java-codegen will be a lightweight library containing only the classes related to code-generation (including model classes for request serialization).

This change might break existing clients only if they rely on graphql-java coming from graphql-java-codegen (which is unlikely).
I will include this change as part of graphql-java-codegen-5.0.0.

@kobylynskyi
Copy link
Owner

5.0.0 was released.
graphql-java and other libraries are now excluded from the classpath of graphql-java-codegen so please try upgrading graphql-java-codegen to 5.0.0.
Thanks.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants