@Bean public GraphQLSchemaConfig graphQLSchemaConfig() { GraphQLSchemaConfig graphQLSchemaConfig = new GraphQLSchemaConfig(); return graphQLSchemaConfig; }
private void injectClientMutationIdIfRequired(Map<String, Object> inputMap, Map<String, Object> outputMap) { if (getGraphQLSchemaConfig().isInjectClientMutationId()) { String clientMutationId = (String) inputMap.get(getGraphQLSchemaConfig().getClientMutationIdName()); outputMap.put(getGraphQLSchemaConfig().getClientMutationIdName(), clientMutationId); } }
public GraphQLQueryTemplate(final GraphQLSchemaHolder graphQLSchemaHolder) { Assert.notNull(graphQLSchemaHolder, "GraphQL Schema holder can not be null"); this.graphQLSchemaHolder = graphQLSchemaHolder; this.graphQLSchema = this.graphQLSchemaHolder.getGraphQLSchema(); this.objectMapper = new ObjectMapper(); if (!graphQLSchemaHolder.getGraphQLSchemaConfig().isDateAsTimestamp()) this.objectMapper.setDateFormat(new SimpleDateFormat(graphQLSchemaHolder.getGraphQLSchemaConfig().getDateFormat())); }
public GraphQLObjectType createGraphQLOutputObjectType(DfsContext dfsContext, String mutationName, ResolvableTypeAccessor resolvableTypeAccessor) { Class<?> cls = resolvableTypeAccessor.resolve(); GraphQLType graphQLObjectType = objectTypeResolverMap.get(cls); if (graphQLObjectType == null) graphQLObjectType = createGraphQLFieldType(dfsContext, resolvableTypeAccessor, true); GraphQLOutputType clientMutationIdType = getGraphQLSchemaConfig().isAllowEmptyClientMutationId() ? GraphQLString : new GraphQLNonNull(GraphQLString); addToMutationReturnTypeResolverMap(dfsContext, mutationName, cls, (GraphQLOutputType) graphQLObjectType); GraphQLFieldDefinition graphQLFieldDefinition = newFieldDefinition() .name(resolvableTypeAccessor.getGraphQLOutName()) .deprecate(resolvableTypeAccessor.getGraphQLDeprecationReason()) .description(resolvableTypeAccessor.getDescription()) .type((GraphQLOutputType) graphQLObjectType) .build(); addToFieldDefinitionResolverMap(dfsContext, graphQLFieldDefinition, resolvableTypeAccessor.getGraphQLComplexitySpelExpression()); return newObject() .name(resolvableTypeAccessor.getName() + getGraphQLSchemaConfig().getOutputObjectNamePrefix()) .field(newFieldDefinition() .name(getGraphQLSchemaConfig().getClientMutationIdName()) .type(clientMutationIdType) .build()) .field(graphQLFieldDefinition) .build(); }
GraphQLInputType clientMutationIdType = getGraphQLSchemaConfig().isAllowEmptyClientMutationId() ? GraphQLString : new GraphQLNonNull(GraphQLString); .name(inputObjectName + getGraphQLSchemaConfig().getInputObjectNamePrefix()) .field(newInputObjectField() .name(getGraphQLSchemaConfig().getClientMutationIdName()) .type(clientMutationIdType) .build())
private String getMutationInputArgumentName() { return graphQLSchemaHolder.getGraphQLSchemaConfig().getMutationInputArgumentName(); }
private GraphQLScalarType getGraphQLDateType() { return new GraphQLDateType("Date", "Date formatted according to defined format string", graphQLSchemaConfig.getDateFormat()); }
private boolean isClientMutationIdInjected() { return graphQLSchemaHolder.getGraphQLSchemaConfig().isInjectClientMutationId(); }
private String getClientMutationIdName() { return graphQLSchemaHolder.getGraphQLSchemaConfig().getClientMutationIdName(); }
public GraphQLScalarType getScalarGraphQLType(final Type cls) { GraphQLScalarType graphQLScalarType = MappingConstants.getScalarGraphQLType(cls); if (Date.class.isAssignableFrom((Class<?>) cls)) { if (graphQLSchemaConfig.isDateAsTimestamp()) graphQLScalarType = MappingConstants.graphQLTimestamp; else graphQLScalarType = getGraphQLDateType(); } else if (LocalDateTime.class.isAssignableFrom((Class<?>) cls)) { if (graphQLSchemaConfig.isDateAsTimestamp()) graphQLScalarType = MappingConstants.graphQLTimestamp; else graphQLScalarType = getGraphQLDateType(); } return graphQLScalarType; }
public GraphQLObjectType findSchemaMutations(DfsContext dfsContext, Class<?> implClass) { List<GraphQLFieldDefinition> graphQLFieldDefinitions = findSchemaMutationsFields(dfsContext, implClass); return newObject() .name(getGraphQLSchemaConfig().getSchemaMutationObjectName()) .fields(graphQLFieldDefinitions) .build(); }
protected Map<String, Object> unwrapInputArguments(DataFetchingEnvironment environment) { Map<String, Object> inputObject = null; String inArgName = getGraphQLSchemaConfig().getMutationInputArgumentName(); if (environment.getArguments() != null && (environment.getArguments() instanceof Map)) { inputObject = (Map<String, Object>) environment.getArguments().get(inArgName); } return inputObject; }
private GraphQLScalarType getGraphQLLocalDateTimeType() { return new GraphQLLocalDateTimeType("LocalDateTime", "LocalDateTime formatted according to defined format string", graphQLSchemaConfig.getDateFormat()); }
@Bean public GraphQLSchemaConfig graphQLSchemaConfig() { GraphQLSchemaConfig graphQLSchemaConfig = new GraphQLSchemaConfig(); return graphQLSchemaConfig; }
.name(getGraphQLSchemaConfig().getMutationInputArgumentName()) .type(graphQLInputType) .build());
@Bean public GraphQLSchemaConfig graphQLSchemaConfig() { GraphQLSchemaConfig graphQLSchemaConfig = new GraphQLSchemaConfig(); return graphQLSchemaConfig; }
@Bean public GraphQLSchemaConfig graphQLSchemaConfig() { GraphQLSchemaConfig graphQLSchemaConfig = new GraphQLSchemaConfig(); return graphQLSchemaConfig; }