Skip to content

Remove deprecated .defaultValue() method #3285

@georgeVlady0

Description

@georgeVlady0

Use of the deprecated GraphQL-Java method .defaultValue() rather than defaultValueProgrammatic() to specify default null value had resulted in schema linting issues and broken Apollo code generation tooling, but does not cause any immediate errors upon initial schema generation. Removing this deprecated method entirely would prevent this prevent users from having to create to manually check for usage of .defaultValue( null ) in their projects.

For example when creating a schema generated using SchemaPrinter, usage of .defaultValue( null ) with arguments and with input objects fields will result in the following:

TestQuery(
  testArg: Boolean = ,
)

input TestInput {
  testField: Boolean = 
}

Rather than:

TestQuery(
  testArg: Boolean = null,
)
input TestInput {
  testField: Boolean = null
}

In the JSON schema generated using IntrospectionQuery, this incorrectly manifests itself as shown below with defaultValue: "" . This breaks Apollo code generation tooling.

{
  "name" : "testField",
  "description" : null,
  "type" : {
    "kind" : "SCALAR",
    "name" : "Boolean",
    "ofType" : null
  },
  "defaultValue" : "",
  "isDeprecated" : false,
  "deprecationReason" : null
}

instead of defaultValue: "null"

{
  "name" : "testField",
  "description" : null,
  "type" : {
    "kind" : "SCALAR",
    "name" : "Boolean",
    "ofType" : null
  },
  "defaultValue" : "null",
  "isDeprecated" : false,
  "deprecationReason" : null
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions