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

SPQR throws an error for default pageable value #108

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

andreysubbotin
Copy link

@andreysubbotin andreysubbotin commented Aug 27, 2021

  • Create a service like:
        @GraphQLQuery(name = "springPageableComponent_users")
        public List<PageableUser> users(@GraphQLArgument(name = "page") Pageable page) {
            return users.subList((int) page.getOffset(), (int) (page.getOffset() + page.getPageSize()));
        }
  • Try to execute a query without a page.
{
    springPageableComponent_users {
        id
        name
        age
     }
}
  • SPQR try to use default values for the page and an exception occurs:
io.leangen.graphql.metadata.strategy.value.InputParsingException: Value: Page request [number: 0, size 20, sort: UNSORTED] could not be parsed into an instance of org.springframework.data.domain.Pageable
    at io.leangen.graphql.metadata.strategy.value.jackson.JacksonValueMapper.fromInput(JacksonValueMapper.java:77) ~[spqr-0.11.2.jar:na]
    at io.leangen.graphql.metadata.strategy.value.ValueMapper.fromInput(ValueMapper.java:11) ~[spqr-0.11.2.jar:na]
    at io.leangen.graphql.generator.mapping.common.InputValueDeserializer.getArgumentValue(InputValueDeserializer.java:32) ~[spqr-0.11.2.jar:na]
    at io.leangen.graphql.execution.ResolutionEnvironment.getInputValue(ResolutionEnvironment.java:116) ~[spqr-0.11.2.jar:na]
    at io.leangen.graphql.execution.OperationExecutor.execute(OperationExecutor.java:84) ~[spqr-0.11.2.jar:na]
    at io.leangen.graphql.execution.OperationExecutor.execute(OperationExecutor.java:58) ~[spqr-0.11.2.jar:na]
    at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:270) ~[graphql-java-16.2.jar:na]
    at graphql.execution.ExecutionStrategy.resolveFieldWithInfo(ExecutionStrategy.java:203) ~[graphql-java-16.2.jar:na]
    at graphql.execution.AsyncExecutionStrategy.execute(AsyncExecutionStrategy.java:60) ~[graphql-java-16.2.jar:na]
    at graphql.execution.Execution.executeOperation(Execution.java:165) ~[graphql-java-16.2.jar:na]
    at graphql.execution.Execution.execute(Execution.java:104) ~[graphql-java-16.2.jar:na]
    at graphql.GraphQL.execute(GraphQL.java:557) ~[graphql-java-16.2.jar:na]
    at graphql.GraphQL.parseValidateAndExecute(GraphQL.java:482) ~[graphql-java-16.2.jar:na]
    at graphql.GraphQL.executeAsync(GraphQL.java:446) ~[graphql-java-16.2.jar:na]

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

Successfully merging this pull request may close these issues.

1 participant