Documentation ¶
Index ¶
- func ConvertNodeIntoJSONSchema(node *yaml.Node, index *index.SpecIndex) (*highBase.Schema, error)
- func ConvertYAMLIntoJSONSchema(str string, index *index.SpecIndex) (*highBase.Schema, error)
- func ValidateNodeAgainstSchema(schema *highBase.Schema, node *yaml.Node, isArray bool) (bool, []*validationErrors.ValidationError)
- type ExampleValidation
- type Schema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertNodeIntoJSONSchema ¶ added in v0.1.0
func ConvertYAMLIntoJSONSchema ¶ added in v0.1.0
func ValidateNodeAgainstSchema ¶
func ValidateNodeAgainstSchema(schema *highBase.Schema, node *yaml.Node, isArray bool) (bool, []*validationErrors.ValidationError)
ValidateNodeAgainstSchema will accept a schema and a node and check it's valid and return the result, or error.
Types ¶
type ExampleValidation ¶
type ExampleValidation struct {
Message string
}
func ValidateExample ¶
func ValidateExample(jc *highBase.Schema) []*ExampleValidation
ValidateExample will check if a schema has a valid type and example, and then perform a simple validation on the value that has been set.
type Schema ¶
type Schema struct { Schema *string `json:"$schema,omitempty" yaml:"$schema,omitempty"` Id *string `json:"$id,omitempty" yaml:"$id,omitempty"` Title *string `json:"title,omitempty" yaml:"title,omitempty"` Required *[]string `json:"required,omitempty" yaml:"required,omitempty"` Enum *[]string `json:"enum,omitempty" yaml:"enum,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"` Type *string `json:"type,omitempty" yaml:"type,omitempty"` ContentEncoding *string `json:"contentEncoding,omitempty" yaml:"contentEncoding,omitempty"` ContentSchema *string `json:"contentSchema,omitempty" yaml:"contentSchema,omitempty"` Items *Schema `json:"items,omitempty" yaml:"items,omitempty"` MultipleOf *int `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"` Maximum *int `json:"maximum,omitempty" yaml:"maximum,omitempty"` ExclusiveMaximum *int `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"` Minimum *int `json:"minimum,omitempty" yaml:"minimum,omitempty"` ExclusiveMinimum *int `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"` MaxItems *int `json:"maxItems,omitempty" yaml:"maxItems,omitempty"` MinItems *int `json:"minItems,omitempty" yaml:"minItems,omitempty"` MaxLength *int `json:"maxLength,omitempty" yaml:"maxLength,omitempty"` MinLength *int `json:"minLength,omitempty" yaml:"minLength,omitempty"` Pattern *string `json:"pattern,omitempty" yaml:"pattern,omitempty"` MaxContains *int `json:"maxContains,omitempty" yaml:"maxContains,omitempty"` MinContains *int `json:"minContains,omitempty" yaml:"minContains,omitempty"` MaxProperties *int `json:"maxProperties,omitempty" yaml:"maxProperties,omitempty"` MinProperties *int `json:"minProperties,omitempty" yaml:"minProperties,omitempty"` Properties map[string]*Schema `json:"properties,omitempty" yaml:"properties,omitempty"` Format *string `json:"format,omitempty" yaml:"format,omitempty"` // OpenAPI Example interface{} `json:"example,omitempty" yaml:"example,omitempty"` // OpenAPI Nullable bool `json:"nullable,omitempty" yaml:"nullable,omitempty"` // OpenAPI AdditionalProperties interface{} `json:"additionalProperties,omitempty" yaml:"ad,omitempty"` // OpenAPI }
func ConvertNodeDefinitionIntoSchema ¶
ConvertNodeDefinitionIntoSchema will convert any definition node (components, params, etc.) into a standard Schema that can be used with JSONSchema. This will auto-timeout of th
Click to show internal directories.
Click to hide internal directories.