Tabnine Logo
graphql.schema
Code IndexAdd Tabnine to your IDE (free)

How to use graphql.schema

Best Java code snippets using graphql.schema (Showing top 20 results out of 351)

origin: graphql-java/graphql-java

public GraphQLInterfaceType nodeInterface(TypeResolver typeResolver) {
  return newInterface()
      .name(NODE)
      .description("An object with an ID")
      .typeResolver(typeResolver)
      .field(newFieldDefinition()
          .name("id")
          .description("The ID of an object")
          .type(nonNull(GraphQLID)))
      .build();
}
origin: graphql-java/graphql-java

public GraphQLFieldDefinition nodeField(GraphQLInterfaceType nodeInterface, DataFetcher nodeDataFetcher) {
  return newFieldDefinition()
      .name("node")
      .description("Fetches an object given its ID")
      .type(nodeInterface)
      .dataFetcher(nodeDataFetcher)
      .argument(newArgument()
          .name("id")
          .description("The ID of an object")
          .type(nonNull(GraphQLID)))
      .build();
}
origin: graphql-java/graphql-java

private static Object serialize(GraphQLType type, Object value) {
  if (type instanceof GraphQLScalarType) {
    return ((GraphQLScalarType) type).getCoercing().serialize(value);
  } else {
    return ((GraphQLEnumType) type).getCoercing().serialize(value);
  }
}
origin: graphql-java/graphql-java

void recursiveTypes() {
  GraphQLObjectType person = newObject()
      .name("Person")
      .field(newFieldDefinition()
          .name("friends")
          .type(GraphQLList.list(GraphQLTypeReference.typeRef("Person"))))
      .build();
}
origin: graphql-java/graphql-java

private void directWiring() {
  GraphQLFieldDefinition descriptionField = GraphQLFieldDefinition.newFieldDefinition()
      .name("description")
      .type(Scalars.GraphQLString)
      .dataFetcher(PropertyDataFetcher.fetching("desc"))
      .build();
}
origin: graphql-java/graphql-java

  public static GraphQLInputObjectType rangeType() {
    return GraphQLInputObjectType.newInputObject()
        .name("Range")
        .field(GraphQLInputObjectField.newInputObjectField()
            .name("lowerBound")
            .type(GraphQLInt))
        .field(GraphQLInputObjectField.newInputObjectField()
            .name("upperBound")
            .type(GraphQLInt))
        .build();
  }
}
origin: graphql-java/graphql-java

void listsAndNonNullLists() {
  GraphQLList.list(GraphQLString); // a list of Strings
  GraphQLNonNull.nonNull(GraphQLString); // a non null String
  // with static imports its even shorter
  newArgument()
      .name("example")
      .type(nonNull(list(GraphQLString)));
}
origin: graphql-java/graphql-java

  @Override
  public Object get(DataFetchingEnvironment env) {
    String userId = env.getArgument("userId");
    DataFetchingFieldSelectionSet selectionSet = env.getSelectionSet();
    if (selectionSet.contains("user/*")) {
      return getUserAndTheirFriends(userId);
    } else {
      return getUser(userId);
    }
  }
};
origin: graphql-java/graphql-java

@Override
public TraversalControl visitGraphQLObjectType(GraphQLObjectType node, TraverserContext<GraphQLType> context) {
  if (isTypeReference(node.getName())) {
    assertTypeUniqueness(node, result);
  } else {
    save(node.getName(), node);
  }
  return super.visitGraphQLObjectType(node, context);
}
origin: graphql-java/graphql-java

/**
 * Creates new field coordinates
 *
 * @param parentType      the container of the field
 * @param fieldDefinition the field definition
 *
 * @return new field coordinates represented by the two parameters
 */
public static FieldCoordinates coordinates(GraphQLFieldsContainer parentType, GraphQLFieldDefinition fieldDefinition) {
  return new FieldCoordinates(parentType.getName(), fieldDefinition.getName());
}
origin: graphql-java/graphql-java

@Override
public TraversalControl visitGraphQLScalarType(GraphQLScalarType node, TraverserContext<GraphQLType> context) {
  assertTypeUniqueness(node, result);
  save(node.getName(), node);
  return super.visitGraphQLScalarType(node, context);
}
origin: graphql-java/graphql-java

@Override
public TraversalControl visitGraphQLInputObjectType(GraphQLInputObjectType node, TraverserContext<GraphQLType> context) {
  if (isTypeReference(node.getName())) {
    assertTypeUniqueness(node, result);
  } else {
    save(node.getName(), node);
  }
  return super.visitGraphQLInputObjectType(node, context);
}
origin: graphql-java/graphql-java

@Override
public TraversalControl visitGraphQLInterfaceType(GraphQLInterfaceType node, TraverserContext<GraphQLType> context) {
  if (isTypeReference(node.getName())) {
    assertTypeUniqueness(node, result);
  } else {
    save(node.getName(), node);
  }
  return super.visitGraphQLInterfaceType(node, context);
}
origin: graphql-java/graphql-java

@Override
public TraversalControl visitGraphQLUnionType(GraphQLUnionType node, TraverserContext<GraphQLType> context) {
  assertTypeUniqueness(node, result);
  save(node.getName(), node);
  return super.visitGraphQLUnionType(node, context);
}
origin: graphql-java/graphql-java

@Override
public TraversalControl visitGraphQLEnumType(GraphQLEnumType node, TraverserContext<GraphQLType> context) {
  assertTypeUniqueness(node, result);
  save(node.getName(), node);
  return super.visitGraphQLEnumType(node, context);
}
origin: graphql-java/graphql-java

DataFetcher getDataFetcher() {
  return dataFetcherFactory.get(newDataFetchingFactoryEnvironment()
      .fieldDefinition(this)
      .build());
}
origin: graphql-java/graphql-java

@Override
public TraversalControl visitGraphQLInputObjectField(GraphQLInputObjectField node, TraverserContext<GraphQLType> context) {
  node.replaceType((GraphQLInputType) resolvedType);
  return super.visitGraphQLInputObjectField(node, context);
}
origin: graphql-java/graphql-java

void interfaceType() {
  GraphQLInterfaceType comicCharacter = newInterface()
      .name("ComicCharacter")
      .description("A abstract comic character.")
      .field(newFieldDefinition()
          .name("name")
          .description("The name of the character.")
          .type(GraphQLString))
      .build();
}
origin: graphql-java/graphql-java

void inputTypes() {
  GraphQLInputObjectType inputObjectType = newInputObject()
      .name("inputObjectType")
      .field(newInputObjectField()
          .name("field")
          .type(GraphQLString))
      .build();
}
origin: graphql-java/graphql-java

private Object coerce(GraphQLType type, Object value) {
  if (value == null) {
    return null;
  }
  if (type instanceof GraphQLEnumType) {
    return ((GraphQLEnumType) type).getCoercing().serialize(value);
  } else {
    return ((GraphQLScalarType) type).getCoercing().serialize(value);
  }
}
graphql.schema

Most used classes

  • DataFetchingEnvironment
    A DataFetchingEnvironment instance of passed to a DataFetcher as a execution context and its the pla
  • GraphQLObjectType
    This is the work horse type and represents an object with one or more field values that can be retri
  • GraphQLFieldDefinition
    Fields are the ways you get data values in graphql and a field definition represents a field, its ty
  • GraphQLObjectType$Builder
  • GraphQLSchema
    The schema represents the combined type system of the graphql engine. This is how the engine knows w
  • GraphQLList,
  • GraphQLSchema$Builder,
  • GraphQLArgument,
  • GraphQLArgument$Builder,
  • GraphQLNonNull,
  • GraphQLTypeReference,
  • GraphQLEnumType,
  • GraphQLInputObjectField$Builder,
  • GraphQLInputObjectField,
  • GraphQLType,
  • GraphQLEnumType$Builder,
  • GraphQLInputObjectType$Builder,
  • GraphQLInputObjectType,
  • GraphQLInterfaceType$Builder
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now