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

Using parameterized record as GraphQL query argument makes query always fail validation #33223

Closed
rrrakyah opened this issue May 9, 2023 · 4 comments
Labels

Comments

@rrrakyah
Copy link

rrrakyah commented May 9, 2023

Describe the bug

While trying to make a GraphQL API for a project, I've come to encounter what appears to be a regression as of Quarkus 3.0.0.Final.

Using a parameterized record as an argument within a query method makes my query fail, no matter what I try or do. However, this problem is not reproducable in Quarkus versions 2.x.x, as far as I could find.

Versions I have tried so far:

  • 2.10.2.Final - Works as intended
  • 2.16.7.Final - Works as intended
  • 3.0.1.Final - Does not work as intended
  • 3.0.2.Final - Does not work as intended

Expected behavior

Be able to query with a parameterized record within my query and get back expected results

Actual behavior

Query fails with error ValidationError and message argument 'argument' with value 'StringValue{value='{\n \"variable\": \"test\"\n}'}' is not a valid 'Unknown Scalar Type [org.rrrakyah.ExampleRecord]'

How to Reproduce?

Steps to reproduce:

  1. Create new Quarkus project with extension quarkus-smallrye-graphql
  2. Add parameterized record, with a variable of type parameter, e.g.:
package org.rrrakyah;

public record ExampleRecord<T>(T variable) {
}
  1. Create query with an argument of type parameterized record, e.g.:
package org.rrrakyah;

import org.eclipse.microprofile.graphql.Description;
import org.eclipse.microprofile.graphql.GraphQLApi;
import org.eclipse.microprofile.graphql.Query;

@GraphQLApi
public class HelloGraphQLResource {

    @Query
    @Description("Say hello")
    public String sayHello(ExampleRecord<String> argument) {
        return "Hello " + argument.variable();
    }

}
  1. Try to query, e.g.:
query sayHello {
  sayHello(
    argument: {
      variable: "test"
    }
  )
}
  1. Find that your query failed with a ValidationError
{
  "errors": [
    {
      "message": "argument 'argument' with value 'StringValue{value='{\n    \"variable\": \"test\"\n}'}' is not a valid 'Unknown Scalar Type [org.rrrakyah.ExampleRecord]'",
      "locations": [
        {
          "line": 4,
          "column": 5
        }
      ],
      "extensions": {
        "classification": "ValidationError"
      }
    }
  ],
  "data": {
    "sayHello": null
  }
}

Output of uname -a or ver

No response

Output of java -version

openjdk version "17.0.4.1" 2022-08-12 LTS

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.0.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)

Additional information

No response

@rrrakyah rrrakyah added the kind/bug Something isn't working label May 9, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented May 9, 2023

/cc @jmartisk (graphql), @phillip-kruger (graphql)

@jmartisk
Copy link
Contributor

jmartisk commented May 9, 2023

This looks very similar to smallrye/smallrye-graphql#1819 where we assume it is caused by a bug in Yasson: eclipse-ee4j/yasson#599, we're waiting for Yasson maintainers to check it. There was an upgrade from Yasson 1 to 3 between Quarkus 2.16 and 3/.0.

@robp94
Copy link
Contributor

robp94 commented May 16, 2023

@rrrakyah possible workaround smallrye/smallrye-graphql#1819

@gsmet
Copy link
Member

gsmet commented Aug 24, 2024

I will close this one as this is an upstream issue and there's nothing we can do about it.

@gsmet gsmet closed this as completed Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants