Documentation
¶
Index ¶
- type DirectiveConfig
- type DirectiveValidator
- type FieldConfig
- type FieldDirectiveOptions
- type FieldValidator
- type FieldValidatorDirectiveValidator
- type MockDirectiveValidator
- type MockFieldValidator
- type MockObjectValidator
- type ObjectConfig
- type ObjectDirectiveValidationOptions
- type ObjectValidator
- type ObjectValidatorDirectiveValidator
- type ObjectValidatorFieldValidator
- type TypeValidationFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirectiveConfig ¶
type DirectiveConfig struct {
// directives that are allowed to be defined on objects
AllowedObjectDirectives map[string]ObjectDirectiveValidationOptions
// directives that are allowed to be defined on fields
AllowedFieldDirectives map[string]FieldDirectiveOptions
}
type DirectiveValidator ¶
type DirectiveValidator struct {
// contains filtered or unexported fields
}
func NewDirectiveValidator ¶
func NewDirectiveValidator( config *DirectiveConfig, ) *DirectiveValidator
func (*DirectiveValidator) ValidateFieldDirective ¶
func (v *DirectiveValidator) ValidateFieldDirective( directive *schema.Directive, objectDirectives []string, fieldType types.Comparable, ) error
func (*DirectiveValidator) ValidateObjectDirective ¶
func (v *DirectiveValidator) ValidateObjectDirective(directive *schema.Directive) error
type FieldConfig ¶
type FieldConfig struct {
// list of allowed types representad as comparable structure
AllowedTypes []types.Comparable
// validation func that you can define to validate more complex scenarios like objects
TypeValidator TypeValidationFunc
}
type FieldDirectiveOptions ¶
type FieldDirectiveOptions struct {
// list of field types that are allowed for this directive
AllowedFieldType []types.Comparable
// allow this directive on all field types
AllowAllFieldTypes bool
// list of required arguments and their kinds (use * to allow all kinds)
RequiredArgumentKinds map[string]string
// list of optional arguments and their kinds (use * to allow all kinds)
OptionalArgumentKinds map[string]string
// one of these directives in this list is required to be defined on the object
RequireOneObjectDirectiveOf []string
// all of these directives in this list are required to be defined on the object
RequireAllObjectDirectivesOf []string
}
type FieldValidator ¶
type FieldValidator struct {
// contains filtered or unexported fields
}
func NewFieldValidator ¶
func NewFieldValidator( config *FieldConfig, directiveValidator FieldValidatorDirectiveValidator, ) *FieldValidator
type MockDirectiveValidator ¶
func (*MockDirectiveValidator) ValidateFieldDirective ¶
func (v *MockDirectiveValidator) ValidateFieldDirective( directive *schema.Directive, objectDirectiveNames []string, fieldType types.Comparable, ) error
func (*MockDirectiveValidator) ValidateObjectDirective ¶
func (v *MockDirectiveValidator) ValidateObjectDirective(directive *schema.Directive) error
type MockFieldValidator ¶
type MockObjectValidator ¶
type ObjectConfig ¶
type ObjectConfig struct {
// set to true if at least one directive is required
RequireObjectDirective bool
}
type ObjectValidator ¶
type ObjectValidator struct {
// contains filtered or unexported fields
}
func NewObjectValidator ¶
func NewObjectValidator( config *ObjectConfig, directiveValidator ObjectValidatorDirectiveValidator, fieldValidator ObjectValidatorFieldValidator, ) *ObjectValidator
Click to show internal directories.
Click to hide internal directories.