Documentation ¶
Index ¶
- func ValidateBytes(schemaBytes []byte, data []byte, context *ReferenceContext) error
- func ValidateGoStruct(schemaBytes []byte, data interface{}, context *ReferenceContext) error
- func ValidateSchema(schemaBytes []byte) error
- func ValidateSchemaWithLoader(loader gojsonschema.JSONLoader) error
- type ReferenceContext
- type ReferenceResolver
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateBytes ¶
func ValidateBytes(schemaBytes []byte, data []byte, context *ReferenceContext) error
func ValidateGoStruct ¶
func ValidateGoStruct(schemaBytes []byte, data interface{}, context *ReferenceContext) error
func ValidateSchema ¶
ValidateSchema validates a jsonschema schema definition.
func ValidateSchemaWithLoader ¶
func ValidateSchemaWithLoader(loader gojsonschema.JSONLoader) error
ValidateSchemaWithLoader validates a jsonschema schema definition by using the given loader.
Types ¶
type ReferenceContext ¶
type ReferenceContext struct { // LocalTypes is a map of blueprint locally defined types. // It is a map of schema name to schema definition LocalTypes map[string]lsv1alpha1.JSONSchemaDefinition // BlueprintFs is the virtual filesystem that is used to resolve "blueprint" refs BlueprintFs vfs.FileSystem // ComponentVersion contains the current blueprint's component descriptor. ComponentVersion model.ComponentVersion // RegistryAccess is an object that can resolve component descriptors. RegistryAccess model.RegistryAccess // RepositoryContext can be used to overwrite the effective repository context of the component descriptor. // If not set, the effective repository context of the ComponentDescriptor will be used. RepositoryContext *types.UnstructuredTypedObject }
ReferenceContext describes the context of the current reference.
type ReferenceResolver ¶
type ReferenceResolver struct {
*ReferenceContext
}
func NewReferenceResolver ¶
func NewReferenceResolver(refCtx *ReferenceContext) *ReferenceResolver
func (*ReferenceResolver) Resolve ¶
func (rr *ReferenceResolver) Resolve(schemaBytes []byte) (interface{}, error)
Resolve walks through the given json schema and recursively resolves all references which use one of the "local", "blueprint", or "cd" schemes.
type Validator ¶
type Validator struct { Context *ReferenceContext Schema *gojsonschema.Schema }
func NewValidator ¶
func NewValidator(context *ReferenceContext) *Validator
NewValidator returns a new Validator with the given reference context.
func (*Validator) CompileSchema ¶
CompileSchema compiles the given schema and sets it as schema for the validator
func (*Validator) ValidateBytes ¶
func (*Validator) ValidateGoStruct ¶
Click to show internal directories.
Click to hide internal directories.