use of graphql.introspection.Introspection.DirectiveLocation.OBJECT in project graphql-java by graphql-java.
the class SchemaGenerator method buildObjectType.
private GraphQLObjectType buildObjectType(BuildContext buildCtx, ObjectTypeDefinition typeDefinition) {
GraphQLObjectType.Builder builder = GraphQLObjectType.newObject();
builder.definition(typeDefinition);
builder.name(typeDefinition.getName());
builder.description(schemaGeneratorHelper.buildDescription(typeDefinition, typeDefinition.getDescription()));
List<ObjectTypeExtensionDefinition> extensions = objectTypeExtensions(typeDefinition, buildCtx);
builder.withDirectives(buildDirectives(typeDefinition.getDirectives(), directivesOf(extensions), OBJECT));
typeDefinition.getFieldDefinitions().forEach(fieldDef -> {
GraphQLFieldDefinition newFieldDefinition = buildField(buildCtx, typeDefinition, fieldDef);
builder.field(newFieldDefinition);
});
extensions.forEach(extension -> extension.getFieldDefinitions().forEach(fieldDef -> {
GraphQLFieldDefinition newFieldDefinition = buildField(buildCtx, typeDefinition, fieldDef);
if (!builder.hasField(newFieldDefinition.getName())) {
builder.field(newFieldDefinition);
}
}));
buildObjectTypeInterfaces(buildCtx, typeDefinition, builder, extensions);
return builder.build();
}
Aggregations