Skip to content

Commit

Permalink
Added a named SDL definition (#2538)
Browse files Browse the repository at this point in the history
* Added a named SDL definition

* Added SDLExtensionDefinition for definitions that are extends
  • Loading branch information
bbakerman authored Sep 6, 2021
1 parent ba2a29a commit 84984aa
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/main/java/graphql/language/DirectiveDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static java.util.Collections.emptyMap;

@PublicApi
public class DirectiveDefinition extends AbstractDescribedNode<DirectiveDefinition> implements SDLDefinition<DirectiveDefinition>, NamedNode<DirectiveDefinition> {
public class DirectiveDefinition extends AbstractDescribedNode<DirectiveDefinition> implements SDLNamedDefinition<DirectiveDefinition>, NamedNode<DirectiveDefinition> {
private final String name;
private final boolean repeatable;
private final ImmutableList<InputValueDefinition> inputValueDefinitions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import static graphql.collect.ImmutableKit.emptyList;

@PublicApi
public class EnumTypeExtensionDefinition extends EnumTypeDefinition {
public class EnumTypeExtensionDefinition extends EnumTypeDefinition implements SDLExtensionDefinition {

@Internal
protected EnumTypeExtensionDefinition(String name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import static graphql.collect.ImmutableKit.emptyList;

@PublicApi
public class InputObjectTypeExtensionDefinition extends InputObjectTypeDefinition {
public class InputObjectTypeExtensionDefinition extends InputObjectTypeDefinition implements SDLExtensionDefinition {

@Internal
protected InputObjectTypeExtensionDefinition(String name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static graphql.language.NodeChildrenContainer.newNodeChildrenContainer;

@PublicApi
public class InterfaceTypeDefinition extends AbstractDescribedNode<InterfaceTypeDefinition> implements ImplementingTypeDefinition<InterfaceTypeDefinition>, DirectivesContainer<InterfaceTypeDefinition>, NamedNode<InterfaceTypeDefinition> {
public class InterfaceTypeDefinition extends AbstractDescribedNode<InterfaceTypeDefinition> implements ImplementingTypeDefinition<InterfaceTypeDefinition>, DirectivesContainer<InterfaceTypeDefinition>, NamedNode<InterfaceTypeDefinition>, SDLExtensionDefinition {

private final String name;
private final ImmutableList<Type> implementz;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import static graphql.collect.ImmutableKit.emptyMap;

@PublicApi
public class ObjectTypeExtensionDefinition extends ObjectTypeDefinition {
public class ObjectTypeExtensionDefinition extends ObjectTypeDefinition implements SDLExtensionDefinition {

@Internal
protected ObjectTypeExtensionDefinition(String name,
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/graphql/language/SDLDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import graphql.PublicApi;

/**
* All Schema Definition Language (SDL) Definitions.
* An interface for Schema Definition Language (SDL) definitions.
*
* @param <T> the actual Node type
*/
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/graphql/language/SDLExtensionDefinition.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package graphql.language;


import graphql.PublicApi;

/**
* An marker interface for Schema Definition Language (SDL) extension definitions.
*/
@PublicApi
public interface SDLExtensionDefinition {

}
18 changes: 18 additions & 0 deletions src/main/java/graphql/language/SDLNamedDefinition.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package graphql.language;


import graphql.PublicApi;

/**
* A interface for named Schema Definition Language (SDL) definition.
*
* @param <T> the actual Node type
*/
@PublicApi
public interface SDLNamedDefinition<T extends SDLNamedDefinition> extends SDLDefinition<T> {

/**
* @return The name of this SDL definition
*/
String getName();
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import static graphql.collect.ImmutableKit.emptyList;

@PublicApi
public class ScalarTypeExtensionDefinition extends ScalarTypeDefinition {
public class ScalarTypeExtensionDefinition extends ScalarTypeDefinition implements SDLExtensionDefinition {

@Internal
protected ScalarTypeExtensionDefinition(String name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import graphql.PublicApi;
import graphql.collect.ImmutableKit;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -14,7 +13,7 @@
import static graphql.collect.ImmutableKit.emptyList;

@PublicApi
public class SchemaExtensionDefinition extends SchemaDefinition {
public class SchemaExtensionDefinition extends SchemaDefinition implements SDLExtensionDefinition {

protected SchemaExtensionDefinition(List<Directive> directives,
List<OperationTypeDefinition> operationTypeDefinitions,
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/graphql/language/TypeDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import graphql.PublicApi;

/**
* All type definitions in a SDL.
* An interface for type definitions in a Schema Definition Language (SDL).
*
* @param <T> the actual Node type
*/
@PublicApi
public interface TypeDefinition<T extends TypeDefinition> extends SDLDefinition<T>, DirectivesContainer<T>, NamedNode<T> {
public interface TypeDefinition<T extends TypeDefinition> extends SDLNamedDefinition<T>, DirectivesContainer<T>, NamedNode<T> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import static graphql.collect.ImmutableKit.emptyList;

@PublicApi
public class UnionTypeExtensionDefinition extends UnionTypeDefinition {
public class UnionTypeExtensionDefinition extends UnionTypeDefinition implements SDLExtensionDefinition {

@Internal
protected UnionTypeExtensionDefinition(String name,
Expand Down

0 comments on commit 84984aa

Please sign in to comment.