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

Generate Spring @ProjectedPayload Interface #1219

Open
JamesPeters98 opened this issue May 25, 2023 · 1 comment
Open

Generate Spring @ProjectedPayload Interface #1219

JamesPeters98 opened this issue May 25, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@JamesPeters98
Copy link
Contributor

When generating Resolver interfaces with lots of top level fields it can leave the method signatures very long.

Spring offers the use of @ProjectedPayload interfaces: https://docs.spring.io/spring-graphql/docs/current/reference/html/#controllers.schema-mapping.projectedpayload.argument

Ideally the resolvers would generate the projected interface inside or alongside the resolver interface, something like this:

    @MutationMapping
    CompletableFuture<Boolean> testMutation(TestMutationPayload payload, DataFetchingEnvironment env);

    @ProjectedPayload
    public interface TestMutationPayload {
        @NonNull BigDecimal amount();
        @NonNull String code();
        int lineNumber();
        OtherType type();
    }

For a schema that looks like this:

testMutation(
        amount: BigDecimal!,
        code: String!,
        lineNumber: Int!,
        type: OtherType = TEST
    ): Boolean!
@JamesPeters98
Copy link
Contributor Author

Thinking about it, this would probably be useful to generate completely separately to the Resovler interfaces so you can just rely on the generated Payloads without using the generated resovlers.

@jxnu-liguobin jxnu-liguobin added the enhancement New feature or request label May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants