graphql.schema.idl.SchemaDirectiveWiring Maven / Gradle / Ivy
package graphql.schema.idl;
import graphql.PublicApi;
import graphql.schema.GraphQLArgument;
import graphql.schema.GraphQLEnumType;
import graphql.schema.GraphQLEnumValueDefinition;
import graphql.schema.GraphQLFieldDefinition;
import graphql.schema.GraphQLInputObjectField;
import graphql.schema.GraphQLInputObjectType;
import graphql.schema.GraphQLInterfaceType;
import graphql.schema.GraphQLObjectType;
import graphql.schema.GraphQLScalarType;
import graphql.schema.GraphQLUnionType;
/**
* A SchemaDirectiveWiring is responsible for enhancing a runtime element based on directives placed on that
* element in the Schema Definition Language (SDL).
*
* It can enhance the graphql runtime element and add new behaviour for example by changing
* the fields {@link graphql.schema.DataFetcher}
*/
@PublicApi
public interface SchemaDirectiveWiring {
/**
* This is called when an object is encountered, which gives the schema directive a chance to modify the shape and behaviour
* of that DSL element
*
* @param environment the wiring element
*
* @return a non null element based on the original one
*/
default GraphQLObjectType onObject(SchemaDirectiveWiringEnvironment environment) {
return environment.getElement();
}
/**
* This is called when a field is encountered, which gives the schema directive a chance to modify the shape and behaviour
* of that DSL element
*
* @param environment the wiring element
*
* @return a non null element based on the original one
*/
default GraphQLFieldDefinition onField(SchemaDirectiveWiringEnvironment environment) {
return environment.getElement();
}
/**
* This is called when an argument is encountered, which gives the schema directive a chance to modify the shape and behaviour
* of that DSL element
*
* @param environment the wiring element
*
* @return a non null element based on the original one
*/
default GraphQLArgument onArgument(SchemaDirectiveWiringEnvironment environment) {
return environment.getElement();
}
/**
* This is called when an interface is encountered, which gives the schema directive a chance to modify the shape and behaviour
* of that DSL element
*
* @param environment the wiring element
*
* @return a non null element based on the original one
*/
default GraphQLInterfaceType onInterface(SchemaDirectiveWiringEnvironment environment) {
return environment.getElement();
}
/**
* This is called when a union is encountered, which gives the schema directive a chance to modify the shape and behaviour
* of that DSL element
*
* @param environment the wiring element
*
* @return a non null element based on the original one
*/
default GraphQLUnionType onUnion(SchemaDirectiveWiringEnvironment environment) {
return environment.getElement();
}
/**
* This is called when an enum is encountered, which gives the schema directive a chance to modify the shape and behaviour
* of that DSL element
*
* @param environment the wiring element
*
* @return a non null element based on the original one
*/
default GraphQLEnumType onEnum(SchemaDirectiveWiringEnvironment environment) {
return environment.getElement();
}
/**
* This is called when an enum value is encountered, which gives the schema directive a chance to modify the shape and behaviour
* of that DSL element
*
* @param environment the wiring element
*
* @return a non null element based on the original one
*/
default GraphQLEnumValueDefinition onEnumValue(SchemaDirectiveWiringEnvironment environment) {
return environment.getElement();
}
/**
* This is called when a custom scalar is encountered, which gives the schema directive a chance to modify the shape and behaviour
* of that DSL element
*
* @param environment the wiring element
*
* @return a non null element based on the original one
*/
default GraphQLScalarType onScalar(SchemaDirectiveWiringEnvironment environment) {
return environment.getElement();
}
/**
* This is called when an input object is encountered, which gives the schema directive a chance to modify the shape and behaviour
* of that DSL element
*
* @param environment the wiring element
*
* @return a non null element based on the original one
*/
default GraphQLInputObjectType onInputObjectType(SchemaDirectiveWiringEnvironment environment) {
return environment.getElement();
}
/**
* This is called when an input object field is encountered, which gives the schema directive a chance to modify the shape and behaviour
* of that DSL element
*
* @param environment the wiring element
*
* @return a non null element based on the original one
*/
default GraphQLInputObjectField onInputObjectField(SchemaDirectiveWiringEnvironment environment) {
return environment.getElement();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy