Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/main/java/graphql/ExecutionResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public interface ExecutionResult {
* should be present. Certain JSON serializers may or may interpret {@link ExecutionResult} to spec, so this method
* is provided to produce a map that strictly follows the specification.
*
* See : <a href="http://facebook.github.io/graphql/#sec-Response-Format">http://facebook.github.io/graphql/#sec-Response-Format</a>
* See : <a href="https://spec.graphql.org/October2021/#sec-Response-Format">https://spec.graphql.org/October2021/#sec-Response-Format</a>
*
* @return a map of the result that strictly follows the spec
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/graphql/GraphQLError.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public interface GraphQLError extends Serializable {

/**
* The graphql spec says that the (optional) path field of any error should be a list
* of path entries - http://facebook.github.io/graphql/#sec-Errors
* of path entries https://spec.graphql.org/October2021/#sec-Handling-Field-Errors
*
* @return the path in list format
*/
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/graphql/Scalars.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,41 @@
* by the graphql specification (Int, Float, String, Boolean and ID) while others are offer because they are common on
* Java platforms.
* <p>
* For more info see http://graphql.org/learn/schema/#scalar-types and more specifically http://facebook.github.io/graphql/#sec-Scalars
* For more info see http://graphql.org/learn/schema/#scalar-types and more specifically https://spec.graphql.org/October2021/#sec-Scalars
*/
@PublicApi
public class Scalars {

/**
* This represents the "Int" type as defined in the graphql specification : http://facebook.github.io/graphql/#sec-Int
* This represents the "Int" type as defined in the graphql specification : https://spec.graphql.org/October2021/#sec-Int
* <p>
* The Int scalar type represents a signed 32‐bit numeric non‐fractional value.
*/
public static final GraphQLScalarType GraphQLInt = GraphQLScalarType.newScalar()
.name("Int").description("Built-in Int").coercing(new GraphqlIntCoercing()).build();

/**
* This represents the "Float" type as defined in the graphql specification : http://facebook.github.io/graphql/#sec-Float
* This represents the "Float" type as defined in the graphql specification : https://spec.graphql.org/October2021/#sec-Float
* <p>
* Note: The Float type in GraphQL is equivalent to Double in Java. (double precision IEEE 754)
*/
public static final GraphQLScalarType GraphQLFloat = GraphQLScalarType.newScalar()
.name("Float").description("Built-in Float").coercing(new GraphqlFloatCoercing()).build();

/**
* This represents the "String" type as defined in the graphql specification : http://facebook.github.io/graphql/#sec-String
* This represents the "String" type as defined in the graphql specification : https://spec.graphql.org/October2021/#sec-String
*/
public static final GraphQLScalarType GraphQLString = GraphQLScalarType.newScalar()
.name("String").description("Built-in String").coercing(new GraphqlStringCoercing()).build();

/**
* This represents the "Boolean" type as defined in the graphql specification : http://facebook.github.io/graphql/#sec-Boolean
* This represents the "Boolean" type as defined in the graphql specification : https://spec.graphql.org/October2021/#sec-Boolean
*/
public static final GraphQLScalarType GraphQLBoolean = GraphQLScalarType.newScalar()
.name("Boolean").description("Built-in Boolean").coercing(new GraphqlBooleanCoercing()).build();

/**
* This represents the "ID" type as defined in the graphql specification : http://facebook.github.io/graphql/#sec-ID
* This represents the "ID" type as defined in the graphql specification : https://spec.graphql.org/October2021/#sec-ID
* <p>
* The ID scalar type represents a unique identifier, often used to re-fetch an object or as the key for a cache. The
* ID type is serialized in the same way as a String; however, it is not intended to be human‐readable. While it is
Expand Down
31 changes: 2 additions & 29 deletions src/main/java/graphql/collect/ImmutableKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,10 @@ public static <K, V> ImmutableMap<K, V> emptyMap() {
return ImmutableMap.of();
}

/**
* ImmutableMaps are hard to build via {@link Map#computeIfAbsent(Object, Function)} style. This method
* allows you to take a mutable map with mutable list of keys and make it immutable.
* <p>
* This of course has a cost - if the map is very large you will be using more memory. But for static
* maps that live a long life it maybe be worth it.
*
* @param startingMap the starting input map
* @param <K> for key
* @param <V> for victory
*
* @return and Immutable map of ImmutableList values
*/

public static <K, V> ImmutableMap<K, ImmutableList<V>> toImmutableMapOfLists(Map<K, List<V>> startingMap) {
assertNotNull(startingMap);
ImmutableMap.Builder<K, ImmutableList<V>> map = ImmutableMap.builder();
for (Map.Entry<K, List<V>> e : startingMap.entrySet()) {
ImmutableList<V> value = ImmutableList.copyOf(startingMap.getOrDefault(e.getKey(), emptyList()));
map.put(e.getKey(), value);
}
return map.build();
}


public static <K, V> ImmutableMap<K, V> addToMap(Map<K, V> existing, K newKey, V newVal) {
return ImmutableMap.<K, V>builder().putAll(existing).put(newKey, newVal).build();
}

public static <K, V> ImmutableMap<K, V> mergeMaps(Map<K, V> m1, Map<K, V> m2) {
return ImmutableMap.<K, V>builder().putAll(m1).putAll(m2).build();
}

public static <T> ImmutableList<T> concatLists(List<T> l1, List<T> l2) {
//noinspection UnstableApiUsage
return ImmutableList.<T>builderWithExpectedSize(l1.size() + l2.size()).addAll(l1).addAll(l2).build();
Expand Down Expand Up @@ -123,6 +94,7 @@ public static <T, R> ImmutableList<R> mapAndDropNulls(Iterable<? extends T> iter
*
* @return an Immutable list with the extra items.
*/
@SafeVarargs
public static <T> ImmutableList<T> addToList(Collection<? extends T> existing, T newValue, T... extraValues) {
assertNotNull(existing);
assertNotNull(newValue);
Expand All @@ -147,6 +119,7 @@ public static <T> ImmutableList<T> addToList(Collection<? extends T> existing, T
*
* @return an Immutable Set with the extra items.
*/
@SafeVarargs
public static <T> ImmutableSet<T> addToSet(Collection<? extends T> existing, T newValue, T... extraValues) {
assertNotNull(existing);
assertNotNull(newValue);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/graphql/execution/Execution.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ private CompletableFuture<ExecutionResult> executeOperation(ExecutionContext exe
}
result = executionStrategy.execute(executionContext, parameters);
} catch (NonNullableFieldWasNullException e) {
// this means it was non null types all the way from an offending non null type
// up to the root object type and there was a a null value some where.
// this means it was non-null types all the way from an offending non-null type
// up to the root object type and there was a null value somewhere.
//
// The spec says we should return null for the data in this case
//
// http://facebook.github.io/graphql/#sec-Errors-and-Non-Nullability
// https://spec.graphql.org/October2021/#sec-Handling-Field-Errors
//
result = completedFuture(new ExecutionResultImpl(null, executionContext.getErrors()));
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/graphql/execution/ExecutionContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public ValueUnboxer getValueUnboxer() {
public void addError(GraphQLError error, ResultPath fieldPath) {
synchronized (this) {
//
// see http://facebook.github.io/graphql/#sec-Errors-and-Non-Nullability about how per
// see https://spec.graphql.org/October2021/#sec-Handling-Field-Errors about how per
// field errors should be handled - ie only once per field if it's already there for nullability
// but unclear if it's not that error path
//
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/graphql/execution/ExecutionStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
* and the other "completeXXX" methods.
* <p>
* The order of fields fetching and completion is up to the execution strategy. As the graphql specification
* <a href="http://facebook.github.io/graphql/#sec-Normal-and-Serial-Execution">http://facebook.github.io/graphql/#sec-Normal-and-Serial-Execution</a> says:
* <a href="https://spec.graphql.org/October2021/#sec-Normal-and-Serial-Execution">https://spec.graphql.org/October2021/#sec-Normal-and-Serial-Execution</a> says:
* <blockquote>
* Normally the executor can execute the entries in a grouped field set in whatever order it chooses (often in parallel). Because
* the resolution of fields other than top-level mutation fields must always be side effect-free and idempotent, the
Expand Down Expand Up @@ -746,7 +746,7 @@ protected GraphQLFieldDefinition getFieldDef(GraphQLSchema schema, GraphQLObject
}

/**
* See (<a href="http://facebook.github.io/graphql/#sec-Errors-and-Non-Nullability">...</a>),
* See (<a href="https://spec.graphql.org/October2021/#sec-Errors-and-Non-Nullability">...</a>),
* <p>
* If a non nullable child field type actually resolves to a null value and the parent type is nullable
* then the parent must in fact become null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import graphql.Internal;

/**
* This will check that a value is non null when the type definition says it must be and it will throw {@link NonNullableFieldWasNullException}
* This will check that a value is non-null when the type definition says it must be and, it will throw {@link NonNullableFieldWasNullException}
* if this is not the case.
*
* See: http://facebook.github.io/graphql/#sec-Errors-and-Non-Nullability
* See: https://spec.graphql.org/October2021/#sec-Errors-and-Non-Nullability
*/
@Internal
public class NonNullableFieldValidator {
Expand All @@ -34,7 +34,7 @@ public NonNullableFieldValidator(ExecutionContext executionContext, ExecutionSte
public <T> T validate(ResultPath path, T result) throws NonNullableFieldWasNullException {
if (result == null) {
if (executionStepInfo.isNonNullType()) {
// see http://facebook.github.io/graphql/#sec-Errors-and-Non-Nullability
// see https://spec.graphql.org/October2021/#sec-Errors-and-Non-Nullability
//
// > If the field returns null because of an error which has already been added to the "errors" list in the response,
// > the "errors" list must not be further affected. That is, only one error should be added to the errors list per field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import static graphql.schema.GraphQLTypeUtil.simplePrint;

/**
* See (http://facebook.github.io/graphql/#sec-Errors-and-Non-Nullability), but if a non nullable field
* See (https://spec.graphql.org/October2021/#sec-Errors-and-Non-Nullability), but if a non nullable field
* actually resolves to a null value and the parent type is nullable then the parent must in fact become null
* so we use exceptions to indicate this special case
*/
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/graphql/schema/GraphQLScalarType.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* for example, a GraphQL system could define a scalar called Time which, while serialized as a string, promises to
* conform to ISO‐8601. When querying a field of type Time, you can then rely on the ability to parse the result with an ISO‐8601 parser and use a client‐specific primitive for time.
* <p>
* From the spec : http://facebook.github.io/graphql/#sec-Scalars
* From the spec : https://spec.graphql.org/October2021/#sec-Scalars
* </blockquote>
* <p>
* graphql-java ships with a set of predefined scalar types via {@link graphql.Scalars}
Expand Down Expand Up @@ -301,4 +301,4 @@ public GraphQLScalarType build() {
specifiedByUrl);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private void save(String name, GraphQLNamedType type) {


/*
From http://facebook.github.io/graphql/#sec-Type-System
From https://spec.graphql.org/October2021/#sec-Type-System

All types within a GraphQL schema must have unique names. No two provided types may have the same name.
No provided type may have a name which conflicts with any built in types (including Scalar and Introspection types).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

/**
* A GraphQL document is only valid if all defined operations have unique names.
* http://facebook.github.io/graphql/October2016/#sec-Operation-Name-Uniqueness
* https://spec.graphql.org/October2021/#sec-Operation-Name-Uniqueness
*/
@Internal
public class UniqueOperationNames extends AbstractRule {
Expand Down
2 changes: 1 addition & 1 deletion src/test/groovy/graphql/NullValueSupportTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import spock.lang.Unroll
import static graphql.ExecutionInput.newExecutionInput

/*
* Taken from http://facebook.github.io/graphql/#sec-Input-Objects
* Taken from https://spec.graphql.org/October2021/#sec-Input-Objects
*
*

Expand Down
8 changes: 0 additions & 8 deletions src/test/groovy/graphql/collect/ImmutableKitTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ class ImmutableKitTest extends Specification {
ImmutableKit.emptyMap().size() == 0
}

def "can make an immutable map of lists"() {
when:
ImmutableMap<String, ImmutableList<String>> map = ImmutableKit.toImmutableMapOfLists([a: ["a", "A"]])
then:
map.get("a") == ImmutableList.copyOf(["a", "A"])
map.get("a") instanceof ImmutableList
}

def "can map a collections"() {
when:
def outputList = ImmutableKit.map(["quick", "brown", "fox"], { word -> word.reverse() })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package graphql.validation

/**
* validation examples used in the spec in given section
* http://facebook.github.io/graphql/#sec-Validation
* https://spec.graphql.org/October2021/#sec-Validation
*
* This test checks that an inline fragment containing just a directive
* is parsed correctly
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package graphql.validation
/**
* validation examples used in the spec in given section
* http://facebook.github.io/graphql/#sec-Validation
* https://spec.graphql.org/October2021/#sec-Validation
* @author dwinsor
*
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package graphql.validation
/**
* validation examples used in the spec in given section
* http://facebook.github.io/graphql/#sec-Validation
* https://spec.graphql.org/October2021/#sec-Validation
* @author dwinsor
*
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package graphql.validation
/**
* validation examples used in the spec in given section
* http://facebook.github.io/graphql/#sec-Validation
* https://spec.graphql.org/October2021/#sec-Validation
*
*/
class SpecValidation573Test extends SpecValidationBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import spock.lang.Specification

/**
* validation examples used in the spec
* http://facebook.github.io/graphql/#sec-Validation
* https://spec.graphql.org/October2021/#sec-Validation
* @author dwinsor
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

/**
* Sample schema used in the spec for validation examples
* http://facebook.github.io/graphql/#sec-Validation
* https://spec.graphql.org/October2021/#sec-Validation
*
* @author dwinsor
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Sample schema pojos used in the spec for validation examples
* http://facebook.github.io/graphql/#sec-Validation
* https://spec.graphql.org/October2021/#sec-Validation
*
* @author dwinsor
*/
Expand Down
2 changes: 1 addition & 1 deletion src/test/groovy/readme/ReadmeExamples.java
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public Review get(DataFetchingEnvironment environment) {
// be maps. You can convert them to POJOs inside the data fetcher if that
// suits your code better
//
// See http://facebook.github.io/graphql/October2016/#sec-Input-Objects
// See https://spec.graphql.org/October2021/#sec-Input-Objects
//
Map<String, Object> episodeInputMap = environment.getArgument("episode");
Map<String, Object> reviewInputMap = environment.getArgument("review");
Expand Down