Package graphql.schema.idl
Class ArgValueOfAllowedTypeChecker
- java.lang.Object
-
- graphql.schema.idl.ArgValueOfAllowedTypeChecker
-
class ArgValueOfAllowedTypeChecker extends java.lang.ObjectClass to check whether a given directive argument value matches a given directive definition.
-
-
Field Summary
Fields Modifier and Type Field Description private Argumentargumentprivate Directivedirectiveprivate Node<?>elementprivate java.lang.StringelementNameprivate static org.slf4j.LoggerlogNotSafeprivate RuntimeWiringruntimeWiringprivate TypeDefinitionRegistrytypeRegistry
-
Constructor Summary
Constructors Constructor Description ArgValueOfAllowedTypeChecker(Directive directive, Node<?> element, java.lang.String elementName, Argument argument, TypeDefinitionRegistry typeRegistry, RuntimeWiring runtimeWiring)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddValidationError(java.util.List<GraphQLError> errors, java.lang.String message, java.lang.Object... args)private voidcheckArgInputObjectValueFieldMatchesAllowedDefinition(java.util.List<GraphQLError> errors, ObjectField objectField, InputValueDefinition allowedValueDef)private voidcheckArgValueMatchesAllowedEnum(java.util.List<GraphQLError> errors, Value<?> instanceValue, EnumTypeDefinition allowedTypeDefinition)private voidcheckArgValueMatchesAllowedInputType(java.util.List<GraphQLError> errors, Value<?> instanceValue, InputObjectTypeDefinition allowedTypeDefinition)private voidcheckArgValueMatchesAllowedListType(java.util.List<GraphQLError> errors, Value<?> instanceValue, ListType allowedArgType)private voidcheckArgValueMatchesAllowedNonNullType(java.util.List<GraphQLError> errors, Value<?> instanceValue, NonNullType allowedArgType)private voidcheckArgValueMatchesAllowedScalar(java.util.List<GraphQLError> errors, Value<?> instanceValue, ScalarTypeDefinition allowedTypeDefinition)(package private) voidcheckArgValueMatchesAllowedType(java.util.List<GraphQLError> errors, Value<?> instanceValue, Type<?> allowedArgType)Recursively inspects an argument value given an allowed type.private voidcheckArgValueMatchesAllowedTypeName(java.util.List<GraphQLError> errors, Value<?> instanceValue, Type<?> allowedArgType)private booleanisArgumentValueScalarLiteral(GraphQLScalarType scalarType, Value<?> instanceValue)
-
-
-
Field Detail
-
logNotSafe
private static final org.slf4j.Logger logNotSafe
-
directive
private final Directive directive
-
element
private final Node<?> element
-
elementName
private final java.lang.String elementName
-
argument
private final Argument argument
-
typeRegistry
private final TypeDefinitionRegistry typeRegistry
-
runtimeWiring
private final RuntimeWiring runtimeWiring
-
-
Constructor Detail
-
ArgValueOfAllowedTypeChecker
ArgValueOfAllowedTypeChecker(Directive directive, Node<?> element, java.lang.String elementName, Argument argument, TypeDefinitionRegistry typeRegistry, RuntimeWiring runtimeWiring)
-
-
Method Detail
-
checkArgValueMatchesAllowedType
void checkArgValueMatchesAllowedType(java.util.List<GraphQLError> errors, Value<?> instanceValue, Type<?> allowedArgType)
Recursively inspects an argument value given an allowed type. Given the (invalid) SDL below:directive @myDirective(arg: [[String]] ) on FIELD_DEFINITION
query { f: String @myDirective(arg: ["A String"]) }
it will first check that the `myDirective.arg` type is an array and fail when finding "A String" as it expected a nested array ([[String]]).
- Parameters:
errors- validation error collectorinstanceValue- directive argument valueallowedArgType- directive definition argument allowed type
-
addValidationError
private void addValidationError(java.util.List<GraphQLError> errors, java.lang.String message, java.lang.Object... args)
-
checkArgValueMatchesAllowedTypeName
private void checkArgValueMatchesAllowedTypeName(java.util.List<GraphQLError> errors, Value<?> instanceValue, Type<?> allowedArgType)
-
checkArgValueMatchesAllowedInputType
private void checkArgValueMatchesAllowedInputType(java.util.List<GraphQLError> errors, Value<?> instanceValue, InputObjectTypeDefinition allowedTypeDefinition)
-
checkArgValueMatchesAllowedEnum
private void checkArgValueMatchesAllowedEnum(java.util.List<GraphQLError> errors, Value<?> instanceValue, EnumTypeDefinition allowedTypeDefinition)
-
checkArgValueMatchesAllowedScalar
private void checkArgValueMatchesAllowedScalar(java.util.List<GraphQLError> errors, Value<?> instanceValue, ScalarTypeDefinition allowedTypeDefinition)
-
checkArgInputObjectValueFieldMatchesAllowedDefinition
private void checkArgInputObjectValueFieldMatchesAllowedDefinition(java.util.List<GraphQLError> errors, ObjectField objectField, InputValueDefinition allowedValueDef)
-
checkArgValueMatchesAllowedNonNullType
private void checkArgValueMatchesAllowedNonNullType(java.util.List<GraphQLError> errors, Value<?> instanceValue, NonNullType allowedArgType)
-
checkArgValueMatchesAllowedListType
private void checkArgValueMatchesAllowedListType(java.util.List<GraphQLError> errors, Value<?> instanceValue, ListType allowedArgType)
-
isArgumentValueScalarLiteral
private boolean isArgumentValueScalarLiteral(GraphQLScalarType scalarType, Value<?> instanceValue)
-
-