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

Code generation from maven/gradle goals? #159

Closed
marc06210 opened this issue Oct 4, 2021 · 5 comments
Closed

Code generation from maven/gradle goals? #159

marc06210 opened this issue Oct 4, 2021 · 5 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@marc06210
Copy link

is it possible to generate java code (data model and Query, Mutation,... mappings) from the schema with a maven/gradle goal?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 4, 2021
@bclozel
Copy link
Member

bclozel commented Oct 6, 2021

We don't offer build plugins at the moment.
I assume this is about generating model classes and Query builders from a remote GraphQL schema, in order to use those in a GraphQL client?

If this is the case, we're working on a client implementation so we need to tackle #10 first and then consider this issue.

@bclozel bclozel added the status: blocked An issue that's blocked on an external project change label Oct 6, 2021
@estigma88
Copy link

👍 to this issue: we want to move away from DGS framework to Spring for Graphql, and we are using some Gradle DGS plugins to generate the client model.

@bclozel bclozel added for: team-attention An issue we need to discuss as a team to make progress and removed status: blocked An issue that's blocked on an external project change labels Jul 21, 2022
@bclozel
Copy link
Member

bclozel commented Jul 21, 2022

This is not blocked anymore, so we need to discuss this as a team.

@jludvice
Copy link

jludvice commented Aug 12, 2022

Doesn't the code generation make sense also for server?

Once I handwrite the graphql schema, it makes sense to me to generate at least DTOs for it.
Is there any reason to not support code generation for server?

From: https://www.graphql-java.com/tutorials/getting-started-with-spring-boot/
Isn't writing

type Book {
  id: ID
  name: String
  pageCount: Int
  author: Author
}

and also

public class Book {

    private String id;
    private String name;
    private int pageCount;
    private String authorId;

    public Book(String id, String name, int pageCount, String authorId) {
        this.id = id;
        this.name = name;
        this.pageCount = pageCount;
        this.authorId = authorId;
    }
    
    public String getId() {
        return id;
    }

    public String getAuthorId() {
        return authorId;
    }
}

kind of duplicate?

@bclozel
Copy link
Member

bclozel commented Sep 22, 2022

We've discussed this as a team today and we came to the following conclusion: while we think this is a valid use case, we don't feel like this is a top priority for the project now. On the client side, we're working on interface clients to avoid the need for code generation. On the server side, we think that tooling provided by DGS and other libraries should be usable with a Spring for GraphQL project.

We might reconsider this feature for future releases, but for now we would like to focus on highly requested features like multipart, relay/pagination, observability, GraalVM native, nullability support, etc.

If you're still interested in this feature, feel free to upvote the original description. Thanks!

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Sep 22, 2022
@bclozel bclozel added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged for: team-attention An issue we need to discuss as a team to make progress labels Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

5 participants