manifest

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorDef

type ErrorDef struct {
	Code        int    `yaml:"code" json:"code"`
	Description string `yaml:"description" json:"description"`
}

ErrorDef represents an error response

type Field

type Field struct {
	Name     string
	Type     string
	Required bool
	Array    bool
	Optional bool
}

Field represents a parsed field with its type and requirements

func ParseField

func ParseField(name, typeStr string) Field

ParseField parses a field type string (e.g., "string!", "User[]", "int")

type Manifest

type Manifest struct {
	PluginID    string    `yaml:"plugin_id" json:"plugin_id"`
	Version     string    `yaml:"version" json:"version"`
	Description string    `yaml:"description,omitempty" json:"description,omitempty"`
	Routes      []Route   `yaml:"routes" json:"routes"`
	Types       []TypeDef `yaml:"types,omitempty" json:"types,omitempty"`
	BasePath    string    `yaml:"base_path,omitempty" json:"base_path,omitempty"`
}

Manifest represents a complete API manifest for a plugin or core module

func (*Manifest) Validate

func (m *Manifest) Validate() error

Validate validates the manifest

type Parser

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

Parser handles loading and parsing manifest files

func NewParser

func NewParser() *Parser

NewParser creates a new manifest parser

func (*Parser) Filter

func (p *Parser) Filter(pluginIDs []string) []*Manifest

Filter returns manifests matching the given plugin IDs

func (*Parser) Get

func (p *Parser) Get(pluginID string) (*Manifest, bool)

Get returns a manifest by plugin ID

func (*Parser) GetCore

func (p *Parser) GetCore() (*Manifest, error)

GetCore returns the core manifest (plugin_id: "core")

func (*Parser) GetPluginManifests

func (p *Parser) GetPluginManifests() []*Manifest

GetPluginManifests returns all non-core manifests

func (*Parser) List

func (p *Parser) List() []*Manifest

List returns all loaded manifests

func (*Parser) LoadDirectory

func (p *Parser) LoadDirectory(dir string) error

LoadDirectory loads all manifest files from a directory

func (*Parser) LoadFile

func (p *Parser) LoadFile(path string) error

LoadFile loads a single manifest file

type Route

type Route struct {
	Name         string            `yaml:"name" json:"name"`
	Description  string            `yaml:"description,omitempty" json:"description,omitempty"`
	Method       string            `yaml:"method" json:"method"`
	Path         string            `yaml:"path" json:"path"`
	Request      map[string]string `yaml:"request,omitempty" json:"request,omitempty"`
	Response     map[string]string `yaml:"response,omitempty" json:"response,omitempty"`
	RequestType  string            `yaml:"request_type,omitempty" json:"request_type,omitempty"`   // Named type for request (e.g., "SignInRequest")
	ResponseType string            `yaml:"response_type,omitempty" json:"response_type,omitempty"` // Named type for response (e.g., "SignInResponse")
	Params       map[string]string `yaml:"params,omitempty" json:"params,omitempty"`
	Query        map[string]string `yaml:"query,omitempty" json:"query,omitempty"`
	Headers      map[string]string `yaml:"headers,omitempty" json:"headers,omitempty"`
	Errors       []ErrorDef        `yaml:"errors,omitempty" json:"errors,omitempty"`
	Auth         bool              `yaml:"auth,omitempty" json:"auth,omitempty"` // Requires authentication
}

Route represents a single API endpoint

func (*Route) GetParamFields

func (r *Route) GetParamFields() []Field

GetParamFields returns parsed path parameter fields

func (*Route) GetQueryFields

func (r *Route) GetQueryFields() []Field

GetQueryFields returns parsed query parameter fields

func (*Route) GetRequestFields

func (r *Route) GetRequestFields() []Field

GetRequestFields returns parsed request fields

func (*Route) GetResponseFields

func (r *Route) GetResponseFields() []Field

GetResponseFields returns parsed response fields

func (*Route) Validate

func (r *Route) Validate() error

Validate validates a route

type TypeDef

type TypeDef struct {
	Name        string            `yaml:"name" json:"name"`
	Description string            `yaml:"description,omitempty" json:"description,omitempty"`
	Fields      map[string]string `yaml:"fields" json:"fields"`
}

TypeDef represents a custom type definition

func (*TypeDef) GetFields

func (t *TypeDef) GetFields() []Field

GetTypeFields returns parsed type definition fields

Jump to

Keyboard shortcuts

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