schema

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderSchemaJSON added in v0.2.0

func RenderSchemaJSON(schema *JSONSchema) (string, error)

RenderSchemaJSON renders the JSON Schema as deterministic JSON with indentation.

func RenderSchemaYAML added in v0.2.0

func RenderSchemaYAML(schema *JSONSchema) (string, error)

RenderSchemaYAML renders the JSON Schema as deterministic YAML.

Types

type JSONSchema added in v0.2.0

type JSONSchema struct {
	Schema               string                `json:"$schema"`
	Type                 string                `json:"type"`
	AdditionalProperties bool                  `json:"additionalProperties"`
	Required             []string              `json:"required,omitempty"`
	Properties           map[string]SchemaNode `json:"properties"`
}

JSONSchema represents a JSON Schema document.

func GenerateJSONSchema added in v0.2.0

func GenerateJSONSchema(centralCfg *config.CentralConfig) *JSONSchema

GenerateJSONSchema produces a deterministic JSON Schema for the .gitrepoforge repo config file based on the central config definitions.

type SchemaNode added in v0.2.0

type SchemaNode struct {
	Type                 string                `json:"type"`
	Description          string                `json:"description,omitempty"`
	Enum                 []string              `json:"enum,omitempty"`
	Pattern              string                `json:"pattern,omitempty"`
	Default              interface{}           `json:"default,omitempty"`
	AdditionalProperties *bool                 `json:"additionalProperties,omitempty"`
	Required             []string              `json:"required,omitempty"`
	Properties           map[string]SchemaNode `json:"properties,omitempty"`
	Items                *SchemaNode           `json:"items,omitempty"`
}

SchemaNode represents a property in the JSON Schema.

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

ValidationError represents a single validation error.

func ValidateRepoConfig

func ValidateRepoConfig(repoCfg *config.RepoConfig, centralCfg *config.CentralConfig, repoPath string) []ValidationError

ValidateRepoConfig validates a repo config against the central config definitions. Returns a list of validation errors (empty if valid).

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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