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
1 change: 1 addition & 0 deletions src/main/java/graphql/Assert.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Collection;

@Internal
public class Assert {

public static <T> T assertNotNull(T object, String errorMessage) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/graphql/AssertException.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package graphql;


@PublicApi
public class AssertException extends GraphQLException {

public AssertException(String message) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/graphql/ExceptionWhileDataFetching.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.util.List;

@PublicApi
public class ExceptionWhileDataFetching implements GraphQLError {

private final Throwable exception;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/graphql/ExecutionResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.List;
import java.util.Map;

@PublicApi
public interface ExecutionResult {

<T> T getData();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/graphql/ExecutionResultImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.List;
import java.util.Map;

@Internal
public class ExecutionResultImpl implements ExecutionResult {

private final List<GraphQLError> errors = new ArrayList<>();
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/graphql/GraphQL.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import static graphql.Assert.assertNotNull;

@PublicApi
public class GraphQL {

private static final Logger log = LoggerFactory.getLogger(GraphQL.class);
Expand All @@ -48,6 +49,7 @@ public class GraphQL {
*
* @deprecated use the {@link #newGraphQL(GraphQLSchema)} builder instead. This will be removed in a future version.
*/
@Internal
public GraphQL(GraphQLSchema graphQLSchema) {
//noinspection deprecation
this(graphQLSchema, null, null);
Expand All @@ -61,6 +63,7 @@ public GraphQL(GraphQLSchema graphQLSchema) {
*
* @deprecated use the {@link #newGraphQL(GraphQLSchema)} builder instead. This will be removed in a future version.
*/
@Internal
public GraphQL(GraphQLSchema graphQLSchema, ExecutionStrategy queryStrategy) {
//noinspection deprecation
this(graphQLSchema, queryStrategy, null);
Expand All @@ -75,6 +78,7 @@ public GraphQL(GraphQLSchema graphQLSchema, ExecutionStrategy queryStrategy) {
*
* @deprecated use the {@link #newGraphQL(GraphQLSchema)} builder instead. This will be removed in a future version.
*/
@Internal
public GraphQL(GraphQLSchema graphQLSchema, ExecutionStrategy queryStrategy, ExecutionStrategy mutationStrategy) {
this(graphQLSchema, queryStrategy, mutationStrategy, null, DEFAULT_EXECUTION_ID_PROVIDER, NoOpInstrumentation.INSTANCE);
}
Expand All @@ -89,6 +93,7 @@ public GraphQL(GraphQLSchema graphQLSchema, ExecutionStrategy queryStrategy, Exe
*
* @deprecated use the {@link #newGraphQL(GraphQLSchema)} builder instead. This will be removed in a future version.
*/
@Internal
public GraphQL(GraphQLSchema graphQLSchema, ExecutionStrategy queryStrategy, ExecutionStrategy mutationStrategy, ExecutionStrategy subscriptionStrategy) {
this(graphQLSchema, queryStrategy, mutationStrategy, subscriptionStrategy, DEFAULT_EXECUTION_ID_PROVIDER, NoOpInstrumentation.INSTANCE);
}
Expand All @@ -114,6 +119,7 @@ public static Builder newGraphQL(GraphQLSchema graphQLSchema) {
}


@PublicApi
public static class Builder {
private GraphQLSchema graphQLSchema;
private ExecutionStrategy queryExecutionStrategy = new SimpleExecutionStrategy();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/graphql/GraphQLError.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.util.List;

@PublicApi
public interface GraphQLError {

String getMessage();
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/graphql/Internal.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package graphql;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;

@Retention(RetentionPolicy.RUNTIME)
@Target(value = {CONSTRUCTOR, METHOD, TYPE})
public @interface Internal {
}
16 changes: 16 additions & 0 deletions src/main/java/graphql/PublicApi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package graphql;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;

@Retention(RetentionPolicy.RUNTIME)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding

java.lang.annotation.Documented

@documented

@Target(value = {CONSTRUCTOR, METHOD, TYPE})
@Documented
public @interface PublicApi {
}
16 changes: 16 additions & 0 deletions src/main/java/graphql/PublicSpi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package graphql;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider @documented

@Retention(RetentionPolicy.RUNTIME)
@Target(value = {CONSTRUCTOR, METHOD, TYPE})
@Documented
public @interface PublicSpi {
}
2 changes: 2 additions & 0 deletions src/main/java/graphql/execution/Execution.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import graphql.ExecutionResult;
import graphql.ExecutionResultImpl;
import graphql.GraphQLException;
import graphql.Internal;
import graphql.MutationNotSupportedError;
import graphql.execution.instrumentation.Instrumentation;
import graphql.execution.instrumentation.InstrumentationContext;
Expand All @@ -26,6 +27,7 @@
import static graphql.language.OperationDefinition.Operation.QUERY;
import static graphql.language.OperationDefinition.Operation.SUBSCRIPTION;

@Internal
public class Execution {

private final FieldCollector fieldCollector = new FieldCollector();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/graphql/execution/ExecutionStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import graphql.ExecutionResult;
import graphql.ExecutionResultImpl;
import graphql.GraphQLException;
import graphql.PublicSpi;
import graphql.TypeResolutionEnvironment;
import graphql.execution.instrumentation.Instrumentation;
import graphql.execution.instrumentation.InstrumentationContext;
Expand Down Expand Up @@ -35,6 +36,7 @@
import static graphql.introspection.Introspection.TypeMetaFieldDef;
import static graphql.introspection.Introspection.TypeNameMetaFieldDef;

@PublicSpi
public abstract class ExecutionStrategy {

private static final Logger log = LoggerFactory.getLogger(ExecutionStrategy.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import graphql.ExecutionResult;
import graphql.ExecutionResultImpl;
import graphql.GraphQLException;
import graphql.PublicApi;
import graphql.language.Field;

import java.util.LinkedHashMap;
Expand All @@ -27,6 +28,7 @@
*
* See {@code graphql.execution.ExecutorServiceExecutionStrategyTest} for example usage.
*/
@PublicApi
public class ExecutorServiceExecutionStrategy extends ExecutionStrategy {

ExecutorService executorService;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/graphql/execution/FieldCollector.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package graphql.execution;


import graphql.Internal;
import graphql.language.Field;
import graphql.language.FragmentDefinition;
import graphql.language.FragmentSpread;
Expand All @@ -19,6 +20,7 @@

import static graphql.execution.TypeFromAST.getTypeFromAST;

@Internal
public class FieldCollector {

private ConditionalNodes conditionalNodes;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/graphql/execution/TypeFromAST.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package graphql.execution;


import graphql.Internal;
import graphql.language.ListType;
import graphql.language.NonNullType;
import graphql.language.Type;
Expand All @@ -10,6 +11,7 @@
import graphql.schema.GraphQLSchema;
import graphql.schema.GraphQLType;

@Internal
public class TypeFromAST {


Expand Down
3 changes: 3 additions & 0 deletions src/main/java/graphql/schema/DataFetcher.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package graphql.schema;


import graphql.PublicSpi;

@PublicSpi
public interface DataFetcher<T> {

T get(DataFetchingEnvironment environment);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/graphql/schema/GraphQLFieldDefinition.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package graphql.schema;


import graphql.Internal;
import graphql.PublicApi;
import graphql.language.FieldDefinition;

import java.util.ArrayList;
Expand All @@ -11,6 +13,7 @@
import static graphql.Assert.assertNotNull;
import static graphql.Assert.assertValidName;

@PublicApi
public class GraphQLFieldDefinition {

private final String name;
Expand All @@ -22,10 +25,12 @@ public class GraphQLFieldDefinition {
private final FieldDefinition definition;


@Internal
public GraphQLFieldDefinition(String name, String description, GraphQLOutputType type, DataFetcher dataFetcher, List<GraphQLArgument> arguments, String deprecationReason) {
this(name,description,type, dataFetcher,arguments,deprecationReason,null);
}

@Internal
public GraphQLFieldDefinition(String name, String description, GraphQLOutputType type, DataFetcher dataFetcher, List<GraphQLArgument> arguments, String deprecationReason, FieldDefinition definition) {
assertValidName(name);
assertNotNull(dataFetcher, "dataFetcher can't be null");
Expand Down Expand Up @@ -89,6 +94,7 @@ public static Builder newFieldDefinition() {
return new Builder();
}

@PublicApi
public static class Builder {

private String name;
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/graphql/schema/GraphQLInputObjectField.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package graphql.schema;


import graphql.Internal;
import graphql.PublicApi;
import graphql.language.InputValueDefinition;

import java.util.Map;

import static graphql.Assert.assertNotNull;
import static graphql.Assert.assertValidName;

@PublicApi
public class GraphQLInputObjectField {

private final String name;
Expand All @@ -16,14 +19,17 @@ public class GraphQLInputObjectField {
private final Object defaultValue;
private final InputValueDefinition definition;

@Internal
public GraphQLInputObjectField(String name, GraphQLInputType type) {
this(name, null, type, null, null);
}

@Internal
public GraphQLInputObjectField(String name, String description, GraphQLInputType type, Object defaultValue) {
this(name,description,type,defaultValue,null);
}

@Internal
public GraphQLInputObjectField(String name, String description, GraphQLInputType type, Object defaultValue, InputValueDefinition definition) {
assertValidName(name);
assertNotNull(type, "type can't be null");
Expand All @@ -42,8 +48,7 @@ public String getName() {
return name;
}

public GraphQLInputType getType() {
return type;
public GraphQLInputType getType() { return type;
}

public Object getDefaultValue() {
Expand All @@ -62,6 +67,7 @@ public static Builder newInputObjectField() {
return new Builder();
}

@PublicApi
public static class Builder {
private String name;
private String description;
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/graphql/schema/GraphQLInputObjectType.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package graphql.schema;

import graphql.AssertException;
import graphql.Internal;
import graphql.PublicApi;
import graphql.language.InputObjectTypeDefinition;

import java.util.ArrayList;
Expand All @@ -12,16 +14,20 @@
import static graphql.Assert.assertNotNull;
import static graphql.Assert.assertValidName;

@PublicApi
public class GraphQLInputObjectType implements GraphQLType, GraphQLInputType, GraphQLUnmodifiedType, GraphQLNullableType, GraphQLInputFieldsContainer {

private final String name;
private final String description;
private final Map<String, GraphQLInputObjectField> fieldMap = new LinkedHashMap<>();
private final InputObjectTypeDefinition definition;

@Internal
public GraphQLInputObjectType(String name, String description, List<GraphQLInputObjectField> fields) {
this(name,description,fields,null);
}

@Internal
public GraphQLInputObjectType(String name, String description, List<GraphQLInputObjectField> fields, InputObjectTypeDefinition definition) {
assertValidName(name);
assertNotNull(fields, "fields can't be null");
Expand Down Expand Up @@ -75,6 +81,7 @@ public InputObjectTypeDefinition getDefinition() {
return definition;
}

@PublicApi
public static class Builder {
private String name;
private String description;
Expand Down
Loading