core

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package core provides the main engine for executing yapi configs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractConfigStats

func ExtractConfigStats(analysis *validation.Analysis) map[string]any

ExtractConfigStats extracts feature usage statistics from an analysis result. This is used by observability hooks to gather request metadata.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine owns shared execution bits used by CLI, TUI, etc.

func NewEngine

func NewEngine(httpClient *http.Client, opts ...EngineOption) *Engine

NewEngine wires a single HTTP client and executor factory.

func (*Engine) RunChain

func (e *Engine) RunChain(
	ctx context.Context,
	base *config.ConfigV1,
	chain []config.ChainStep,
	opts runner.Options,
	analysis *validation.Analysis,
) (*runner.ChainResult, error)

RunChain executes a chain configuration

func (*Engine) RunConfig

func (e *Engine) RunConfig(
	ctx context.Context,
	path string,
	opts runner.Options,
) *RunConfigResult

RunConfig analyzes, validates, and executes a config file. It never prints. Callers decide how to render diagnostics/output.

type EngineOption

type EngineOption func(*Engine)

EngineOption configures an Engine

func WithRequestHook

func WithRequestHook(hook RequestHook) EngineOption

WithRequestHook sets a hook to be called after each request

type RequestHook

type RequestHook func(stats map[string]any)

RequestHook is called after a request completes with stats about the execution. This allows the caller (main.go) to wire observability without core knowing about it.

type RunConfigResult

type RunConfigResult struct {
	Analysis  *validation.Analysis
	Result    *runner.Result
	ExpectRes *runner.ExpectationResult
	Error     error
}

RunConfigResult contains the results of running a config

Jump to

Keyboard shortcuts

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