in src/main/com/intellij/lang/jsgraphql/types/schema/idl/SchemaPrinter.java [645:691]
private TypePrinter<GraphQLInputObjectType> inputObjectPrinter() {
return (out, type, visibility) -> {
if (isIntrospectionType(type)) {
return;
}
if (!options.isIncludeEmptyTypes() && type.getFields().isEmpty()) {
return;
}
String indent = calcIndent(1);
if (shouldPrintAsAst(type.getDefinition())) {
printAsAst(out, type.getDefinition(), type.getExtensionDefinitions());
}
else {
printComments(out, type, "");
GraphqlTypeComparatorEnvironment environment = GraphqlTypeComparatorEnvironment.newEnvironment()
.parentType(GraphQLInputObjectType.class)
.elementType(GraphQLInputObjectField.class)
.build();
Comparator<? super GraphQLSchemaElement> comparator = options.comparatorRegistry.getComparator(environment);
out.format("input %s%s", type.getName(), directivesString(GraphQLInputObjectType.class, type.getDirectives()));
List<GraphQLInputObjectField> inputObjectFields = visibility.getFieldDefinitions(type);
if (!inputObjectFields.isEmpty()) {
out.print(" {\n");
inputObjectFields
.stream()
.filter(options.getIncludeSchemaElement())
.sorted(comparator)
.forEach(fd -> {
printComments(out, fd, indent);
out.format("%s%s: %s",
indent, fd.getName(), typeString(fd.getType()));
Object defaultValue = fd.getDefaultValue();
if (defaultValue != null) {
String astValue = printAst(defaultValue, fd.getType());
out.format(" = %s", astValue);
}
out.print(directivesString(GraphQLInputObjectField.class, fd.getDirectives()));
out.print("\n");
});
out.print("}");
}
out.print("\n\n");
}
};
}