SoftInstigate / restheart

Rapid API Development with MongoDB
https://restheart.org
GNU Affero General Public License v3.0
807 stars 171 forks source link

Use of deprecated graphql coercing methods #483

Closed ujibang closed 1 year ago

ujibang commented 1 year ago

Describe the bug

RESTHeart adds BSON scalars to GraphQL schema https://github.com/SoftInstigate/restheart/tree/master/graphql/src/main/java/org/restheart/graphql/scalars/bsonCoercing

The classes override deprecated methods and also they don't implement the method valueToLiteral.

To Reproduce

The following introspection query to any GraphQL app includes the error The non deprecated version of valueToLiteral has not been implemented by this scalar:

{"query":" query IntrospectionQuery { __schema {  queryType { name } mutationType { name } subscriptionType { name } types { ...FullType } directives { name description  locations args { ...InputValue } } } } fragment FullType on __Type { kind name description  fields(includeDeprecated: true) { name description args { ...InputValue } type { ...TypeRef } isDeprecated deprecationReason } inputFields { ...InputValue } interfaces { ...TypeRef } enumValues(includeDeprecated: true) { name description isDeprecated deprecationReason } possibleTypes { ...TypeRef } } fragment InputValue on __InputValue { name description type { ...TypeRef } defaultValue   } fragment TypeRef on __Type { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name } } } } } } } } "}

response

{
   "data": [ .... ]
    "errors": [
        {
            "message": "Exception while fetching data (/__schema/types[14]/fields[4]/args[0]/defaultValue) : The non deprecated version of valueToLiteral has not been implemented by this scalar : class org.restheart.graphql.scalars.bsonCoercing.GraphQLBsonBooleanCoercing",
            "locations": [
                {
                    "line": 61,
                    "column": 7
                }
            ],
            "path": [
                "__schema",
                "types",
                14,
                "fields",
                4,
                "args",
                0,
                "defaultValue"
            ],
            "extensions": {
                "classification": "DataFetchingException"
            }
        },
        ....
    ],
}

Expected behavior

The Coercing interface should be correctly implemented.

ujibang commented 1 year ago

fixed in v7.6.2

@mkjsix please release