validate

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package validate is the validate command: the repo's AML, checked.

Index

Constants

This section is empty.

Variables

View Source
var Validate = command.Define(command.Def[ValidateInput, aml.RepoValidation]{
	Name:     "validate",
	Short:    "Validate the AML repo, optionally scoped to file globs",
	ReadOnly: true,
	Timeout:  5 * time.Minute,
	Needs:    func(ValidateInput) command.Sidecars { return command.Sidecars{Node: true} },
	Run: func(ctx context.Context, cc command.CommandContext, in ValidateInput) (aml.RepoValidation, error) {
		if err := command.RequireSidecars(cc, command.Sidecars{Node: true}); err != nil {
			return aml.RepoValidation{}, err
		}
		res, err := aml.Validate(ctx, cc.Clients.Node, cc.Repo, in.Globs)
		if v, ok := refused(err); ok {
			return aml.RepoValidation{}, apperr.EncapsulateWith(err, apperr.ValidationFailed, v.Message, apperr.Violate(v))
		}
		if err != nil {
			return res, err
		}

		local, isLocal := cc.Repo.Local()
		var apps []string
		if isLocal {
			apps = dataApps(local.Dir)
			res.Reports = append(res.Reports, appReports(local.Dir, apps, in.Globs)...)
		}
		if err := unmatched(in.Globs, res.Unmatched, apps, isLocal); err != nil {
			return aml.RepoValidation{}, err
		}
		return res, nil
	},
	Valid: func(r aml.RepoValidation) bool { return r.Valid },
})

Validate checks the AML repo, optionally scoped to file globs.

Functions

This section is empty.

Types

type ValidateInput

type ValidateInput struct {
	Globs []string `` /* 128-byte string literal not displayed */
}

ValidateInput is validate's input.

func (ValidateInput) TransformSchema

func (ValidateInput) TransformSchema(_ huma.Registry, s *huma.Schema) *huma.Schema

Jump to

Keyboard shortcuts

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