project

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package project discovers .http files under a directory and indexes their requests by name.

Index

Constants

View Source
const ConfigFile = "apic.yaml"

ConfigFile is the optional per-project configuration file name.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Default   string `yaml:"default"`   // auth spec applied to requests without `# @auth`, e.g. "aws region=eu-west-2"
	AllowExec bool   `yaml:"allowExec"` // permit `# @auth exec ...`
}

AuthConfig is the `auth:` section of apic.yaml.

type Config

type Config struct {
	Env     string `yaml:"env"`     // default environment
	Dir     string `yaml:"dir"`     // directory holding .http files, relative to the project root
	Timeout string `yaml:"timeout"` // default request timeout, e.g. "30s"
	// MaxBodyBytes caps how much of a response apic will read into memory.
	// Zero means the built-in default; see runner.DefaultMaxBodyBytes.
	MaxBodyBytes int64      `yaml:"maxBodyBytes"`
	Auth         AuthConfig `yaml:"auth"`
	Test         TestConfig `yaml:"test"`
}

Config is the content of apic.yaml.

type Project

type Project struct {
	Root        string // absolute path of the project root (where apic.yaml / env files live)
	Config      Config
	Files       []*httpfile.File
	Diagnostics []httpfile.Diagnostic
	// contains filtered or unexported fields
}

Project is a loaded set of .http files.

func Load

func Load(root string) (*Project, error)

Load discovers and parses every *.http and *.rest file under root.

func (*Project) CapturedBy

func (p *Project) CapturedBy(name string) *httpfile.Request

CapturedBy returns the first request that captures a variable of this name.

func (*Project) File

func (p *Project) File(path string) *httpfile.File

File returns the request file at path (relative to the root, or absolute), or nil. The whole path is the file name: a `#` in it is not a fragment.

func (*Project) Lookup

func (p *Project) Lookup(name string) (*httpfile.Request, error)

Lookup finds a request by name. It fails when the name is ambiguous.

func (*Project) Requests

func (p *Project) Requests() []*httpfile.Request

Requests returns every request in file order.

func (*Project) Resolve

func (p *Project) Resolve(target string) ([]*httpfile.Request, error)

Resolve turns a command-line target into one or more requests:

get-user            a request by @name
users.http          every request in that file, in order
users.http#get-user a named request in a specific file
users.http#3        the third request in that file

func (*Project) Validate

func (p *Project) Validate() []httpfile.Diagnostic

Validate returns parse diagnostics plus project-level checks.

type TestConfig

type TestConfig struct {
	Paths []string `yaml:"paths"` // feature files or directories, relative to the root (default: features)
}

TestConfig is the `test:` section of apic.yaml.

Jump to

Keyboard shortcuts

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