Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

import graphql.Assert;
import graphql.PublicApi;
import graphql.execution.ValuesResolver;
import graphql.language.AstPrinter;
import graphql.language.AstValueHelper;
import graphql.language.Description;
import graphql.language.Document;
import graphql.language.EnumTypeDefinition;
Expand Down Expand Up @@ -47,6 +47,7 @@
import graphql.schema.GraphQLUnionType;
import graphql.schema.GraphqlTypeComparatorEnvironment;
import graphql.schema.GraphqlTypeComparatorRegistry;
import graphql.schema.InputValueWithState;
import graphql.schema.idl.ScalarInfo;
import graphql.schema.idl.SchemaParser;
import graphql.schema.idl.TypeDefinitionRegistry;
Expand Down Expand Up @@ -810,8 +811,8 @@ private TypePrinter<GraphQLInputObjectType> inputObjectPrinter() {
fd -> {
printComments(out, fd, " ");
out.format(" %s: %s", fd.getName(), typeString(fd.getType()));
Object defaultValue = fd.getDefaultValue();
if (defaultValue != null) {
InputValueWithState defaultValue = fd.getInputFieldDefaultValue();
if (defaultValue != null && defaultValue.isSet()) {
String astValue = printAst(defaultValue, fd.getType());
out.format(" = %s", astValue);
}
Expand Down Expand Up @@ -854,8 +855,9 @@ private void printAsAst(
out.println();
}

private static String printAst(Object value, GraphQLInputType type) {
return AstPrinter.printAst(AstValueHelper.astFromValue(value, type));
private static String printAst(InputValueWithState inputValueWithState, GraphQLInputType type) {
return AstPrinter.printAst(
ValuesResolver.valueToLiteral(DEFAULT_FIELD_VISIBILITY, inputValueWithState, type));
}

private TypePrinter<GraphQLSchema> schemaPrinter() {
Expand Down Expand Up @@ -954,8 +956,8 @@ String argsString(Class<? extends GraphQLSchemaElement> parent, List<GraphQLArgu
.append(argument.getName())
.append(": ")
.append(typeString(argument.getType()));
Object defaultValue = argument.getDefaultValue();
if (defaultValue != null) {
InputValueWithState defaultValue = argument.getArgumentDefaultValue();
if (defaultValue != null && defaultValue.isSet()) {
sb.append(" = ");
sb.append(printAst(defaultValue, argument.getType()));
}
Expand Down Expand Up @@ -1043,10 +1045,10 @@ private String directiveString(GraphQLDirective directive) {
for (int i = 0; i < args.size(); i++) {
GraphQLArgument arg = args.get(i);
String argValue = null;
if (arg.getValue() != null) {
argValue = printAst(arg.getValue(), arg.getType());
} else if (arg.getDefaultValue() != null) {
argValue = printAst(arg.getDefaultValue(), arg.getType());
if (arg.getArgumentValue() != null && arg.getArgumentValue().isSet()) {
argValue = printAst(arg.getArgumentValue(), arg.getType());
} else if (arg.getArgumentDefaultValue() != null && arg.getArgumentDefaultValue().isSet()) {
argValue = printAst(arg.getArgumentDefaultValue(), arg.getType());
}
if (!isNullOrEmpty(argValue)) {
sb.append(arg.getName());
Expand Down
17 changes: 12 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@
-->
<skip.dependency.convergence>false</skip.dependency.convergence>
<cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version>
<graphql-java.version>16.1</graphql-java.version>
<graphql-java-kickstart.version>11.0.0</graphql-java-kickstart.version>
<graphql-java.version>17.2</graphql-java.version>
<graphql-java-extended-scalars.version>17.0</graphql-java-extended-scalars.version>
<graphql-java-kickstart.version>11.1.0</graphql-java-kickstart.version>
<java.version>1.8</java.version>
<jetbrains-annotations.version>17.0.0</jetbrains-annotations.version>
<junit.version>5.7.1</junit.version>
<junit.version>5.7.2</junit.version>
<!-- Can't upgrade to 3.2.X until https://issues.apache.org/jira/browse/MDEP-753 is fixed. -->
<maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>
<!--
Expand All @@ -93,9 +94,9 @@
<maven-source-plugin.version>3.1.0</maven-source-plugin.version>
<maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
<nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
<slf4j.version>1.7.30</slf4j.version>
<slf4j.version>1.7.32</slf4j.version>
<spotless.version>2.12.2</spotless.version>
<spring-boot.version>2.3.6.RELEASE</spring-boot.version>
<spring-boot.version>2.5.4</spring-boot.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -127,6 +128,12 @@
<artifactId>graphql-java</artifactId>
<version>${graphql-java.version}</version>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-extended-scalars</artifactId>
<version>${graphql-java-extended-scalars.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions spring-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<properties>
<!-- Note that spring-example wasn't designed to be imported, so this is fine. -->
<skip.dependency.convergence>true</skip.dependency.convergence>
<fasterxml.jackson.version>2.12.0</fasterxml.jackson.version>
<fasterxml.jackson.version>2.12.4</fasterxml.jackson.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -52,7 +52,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>5.2.11.RELEASE</version>
<version>5.3.9</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down