app

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultContractPath = "pacto.yaml"

DefaultContractPath is the default filename looked up when no path is given.

Variables

This section is empty.

Functions

This section is empty.

Types

type BundlePuller added in v0.0.6

type BundlePuller interface {
	Pull(ctx context.Context, ref string) (*contract.Bundle, error)
}

BundlePuller is the subset of oci.BundleStore needed by the fetcher. Defined here to avoid importing internal/oci from internal/graph.

type DiffOptions

type DiffOptions struct {
	OldPath string
	NewPath string
}

DiffOptions holds options for the diff command.

type DiffResult

type DiffResult struct {
	OldPath        string        `json:"oldPath"`
	NewPath        string        `json:"newPath"`
	Classification string        `json:"classification"`
	Changes        []diff.Change `json:"changes"`
}

DiffResult holds the result of the diff command.

type ExplainDependency

type ExplainDependency struct {
	Ref           string `json:"ref"`
	Required      bool   `json:"required"`
	Compatibility string `json:"compatibility"`
}

ExplainDependency is a simplified dependency summary.

type ExplainInterface

type ExplainInterface struct {
	Name       string `json:"name"`
	Type       string `json:"type"`
	Port       *int   `json:"port,omitempty"`
	Visibility string `json:"visibility,omitempty"`
}

ExplainInterface is a simplified interface summary.

type ExplainOptions

type ExplainOptions struct {
	Path string
}

ExplainOptions holds options for the explain command.

type ExplainResult

type ExplainResult struct {
	Name         string                 `json:"name"`
	Version      string                 `json:"version"`
	Owner        string                 `json:"owner,omitempty"`
	PactoVersion string                 `json:"pactoVersion"`
	Runtime      ExplainRuntime         `json:"runtime"`
	Interfaces   []ExplainInterface     `json:"interfaces,omitempty"`
	Dependencies []ExplainDependency    `json:"dependencies,omitempty"`
	Scaling      *contract.Scaling      `json:"scaling,omitempty"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
}

ExplainResult holds the result of the explain command.

type ExplainRuntime

type ExplainRuntime struct {
	WorkloadType    string `json:"workloadType"`
	StateType       string `json:"stateType"`
	Scope           string `json:"scope"`
	Durability      string `json:"durability"`
	DataCriticality string `json:"dataCriticality"`
}

ExplainRuntime is a simplified runtime summary.

type GenerateOptions

type GenerateOptions struct {
	Path      string
	OutputDir string
	Plugin    string
	Options   map[string]any
}

GenerateOptions holds options for the generate command.

type GenerateResult

type GenerateResult struct {
	Plugin     string `json:"plugin"`
	OutputDir  string `json:"outputDir"`
	FilesCount int    `json:"filesCount"`
	Message    string `json:"message,omitempty"`
}

GenerateResult holds the result of the generate command.

type GraphOptions

type GraphOptions struct {
	Path string
}

GraphOptions holds options for the graph command.

type GraphResult

type GraphResult struct {
	Root      *graph.Node      `json:"root"`
	Cycles    [][]string       `json:"cycles,omitempty"`
	Conflicts []graph.Conflict `json:"conflicts,omitempty"`
}

GraphResult holds the result of the graph command.

type InitOptions

type InitOptions struct {
	Name string
}

InitOptions holds options for the init command.

type InitResult

type InitResult struct {
	Dir  string
	Path string
}

InitResult holds the result of the init command.

type PackOptions

type PackOptions struct {
	Path   string
	Output string
}

PackOptions holds options for the pack command.

type PackResult

type PackResult struct {
	Output  string
	Name    string
	Version string
}

PackResult holds the result of the pack command.

type PluginRunner

type PluginRunner interface {
	Run(ctx context.Context, name string, req plugin.GenerateRequest) (*plugin.GenerateResponse, error)
}

PluginRunner abstracts plugin execution so the app layer does not depend on the concrete subprocess implementation.

type PullOptions

type PullOptions struct {
	Ref    string
	Output string
}

PullOptions holds options for the pull command.

type PullResult

type PullResult struct {
	Ref     string
	Output  string
	Name    string
	Version string
}

PullResult holds the result of the pull command.

type PushOptions

type PushOptions struct {
	Ref  string
	Path string
}

PushOptions holds options for the push command.

type PushResult

type PushResult struct {
	Ref     string
	Digest  string
	Name    string
	Version string
}

PushResult holds the result of the push command.

type Service

type Service struct {
	BundleStore  oci.BundleStore
	PluginRunner PluginRunner
}

Service is the application service container. It holds injected dependencies and provides methods for each CLI command.

func NewService

func NewService(store oci.BundleStore, pluginRunner PluginRunner) *Service

NewService creates a new application service with the given dependencies.

func (*Service) Diff

func (s *Service) Diff(ctx context.Context, opts DiffOptions) (*DiffResult, error)

Diff compares two contracts and produces a classified change set.

func (*Service) Explain

func (s *Service) Explain(ctx context.Context, opts ExplainOptions) (*ExplainResult, error)

Explain produces a human-readable summary of a contract.

func (*Service) Generate

func (s *Service) Generate(ctx context.Context, opts GenerateOptions) (*GenerateResult, error)

Generate invokes a plugin to produce artifacts from a contract.

func (*Service) Graph

func (s *Service) Graph(ctx context.Context, opts GraphOptions) (*GraphResult, error)

Graph resolves the dependency graph for a contract.

func (*Service) Init

func (s *Service) Init(_ context.Context, opts InitOptions) (*InitResult, error)

Init scaffolds a new pacto project directory with the full bundle structure.

func (*Service) Pack

func (s *Service) Pack(_ context.Context, opts PackOptions) (*PackResult, error)

Pack validates a contract bundle and produces a tar.gz archive.

func (*Service) Pull

func (s *Service) Pull(ctx context.Context, opts PullOptions) (*PullResult, error)

Pull fetches a contract bundle from an OCI registry and extracts it to disk.

func (*Service) Push

func (s *Service) Push(ctx context.Context, opts PushOptions) (*PushResult, error)

Push validates a contract bundle, builds an OCI image, and pushes it to a registry.

func (*Service) Validate

func (s *Service) Validate(ctx context.Context, opts ValidateOptions) (*ValidateResult, error)

Validate loads a contract, runs validation, and returns the result.

type ValidateOptions

type ValidateOptions struct {
	Path string
}

ValidateOptions holds options for the validate command.

type ValidateResult

type ValidateResult struct {
	Path     string
	Valid    bool
	Errors   []contract.ValidationError
	Warnings []contract.ValidationWarning
}

ValidateResult holds the result of the validate command.

Jump to

Keyboard shortcuts

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