validator

package
v0.0.0-...-dcc0d81 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CircularReferenceRule

type CircularReferenceRule struct{}

CircularReferenceRule detects circular schema references.

func (*CircularReferenceRule) Name

func (r *CircularReferenceRule) Name() string

func (*CircularReferenceRule) Validate

func (r *CircularReferenceRule) Validate(spec *v3.Document, parsed *parser.ParsedData) []Violation

type ExtensionFieldNameRule

type ExtensionFieldNameRule struct{}

ExtensionFieldNameRule validates x-graphql-field-name values.

func (*ExtensionFieldNameRule) Name

func (r *ExtensionFieldNameRule) Name() string

func (*ExtensionFieldNameRule) Validate

func (r *ExtensionFieldNameRule) Validate(spec *v3.Document, parsed *parser.ParsedData) []Violation

type ExtensionQueryRule

type ExtensionQueryRule struct{}

ExtensionQueryRule validates x-graphql-query values.

func (*ExtensionQueryRule) Name

func (r *ExtensionQueryRule) Name() string

func (*ExtensionQueryRule) Validate

func (r *ExtensionQueryRule) Validate(spec *v3.Document, parsed *parser.ParsedData) []Violation

type FieldNameCollisionRule

type FieldNameCollisionRule struct{}

FieldNameCollisionRule detects duplicate field names.

func (*FieldNameCollisionRule) Name

func (r *FieldNameCollisionRule) Name() string

func (*FieldNameCollisionRule) Validate

func (r *FieldNameCollisionRule) Validate(spec *v3.Document, parsed *parser.ParsedData) []Violation

type MultipleContentTypesRule

type MultipleContentTypesRule struct{}

MultipleContentTypesRule validates response content types.

func (*MultipleContentTypesRule) Name

func (r *MultipleContentTypesRule) Name() string

func (*MultipleContentTypesRule) Validate

func (r *MultipleContentTypesRule) Validate(spec *v3.Document, parsed *parser.ParsedData) []Violation

type Rule

type Rule interface {
	Name() string
	Validate(spec *v3.Document, parsed *parser.ParsedData) []Violation
}

Rule interface for validation rules.

type UnsupportedConstructRule

type UnsupportedConstructRule struct{}

UnsupportedConstructRule checks for oneOf/anyOf/allOf.

func (*UnsupportedConstructRule) Name

func (r *UnsupportedConstructRule) Name() string

func (*UnsupportedConstructRule) Validate

func (r *UnsupportedConstructRule) Validate(spec *v3.Document, parsed *parser.ParsedData) []Violation

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator validates OpenAPI specs for GraphQL generation.

func New

func New() *Validator

New creates a new validator with default rules.

func (*Validator) HasErrors

func (v *Validator) HasErrors(violations []Violation) bool

HasErrors checks if any violations exist.

func (*Validator) Validate

func (v *Validator) Validate(spec *v3.Document, parsed *parser.ParsedData) []Violation

Validate runs all rules and returns violations.

type Violation

type Violation struct {
	RuleName   string
	Message    string
	Suggestion string
	Path       string
}

Violation represents a validation error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL