manifest

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoContentGenerator = errors.New("no target content generator was set")
)

Functions

func ValidateFromReader

func ValidateFromReader(r io.Reader) (*api.Manifest, error)

Types

type Generator

type Generator struct {
	Opts *Options
}

func New

func New(opts ...Option) *Generator

New creates a new instance of the Generator. See options.Option for more info on the available configuration.

func (*Generator) GenerateManifests

func (g *Generator) GenerateManifests(ctx context.Context, manifests ...*api.Manifest) error

type Option

type Option func(p *Options)

Option is a more atomic to configure the different Options rather than passing the entire Options struct.

func CustomManifestErrorTemplate

func CustomManifestErrorTemplate(filepath string) Option

CustomManifestErrorTemplate configures the parser's generator to add the autogenerated header to generated files

func CustomManifestInfoTemplate

func CustomManifestInfoTemplate(filepath string) Option

CustomManifestInfoTemplate configures the parser's generator CustomInfoTemplateFilepath path to the custom user template for errors manifest errors

func Logger

func Logger(logger *logging.Logger) Option

Logger configure the parser's logger

func Output

func Output(dir string) Option

func Watermark

func Watermark(header string) Option

Watermark configures the parser's generator to add the autogenerated header to generated files

func Writer

func Writer(w io.Writer) Option

Writer is the io.Writer the parser will write to

func YAML

func YAML() Option

YAML returns the options.Option to run the parser generator for YAML

type Options

type Options struct {
	// Logger is the parser's logger
	// Option: func Logger(logger *logging.Logger) Option
	Logger *logging.Logger

	Output string

	// TargetManifestGenerator is the content generator used to generate the yaml error manifest.
	TargetManifestGenerator Target

	// CustomInfoTemplateFilepath path to the custom user template for errors manifest general info
	CustomInfoTemplateFilepath string

	// CustomErrorTemplateFilepath path to the custom user template for errors manifest errors
	CustomErrorTemplateFilepath string

	// GenerationWatermark is header sitting at the top of the output file
	GenerationWatermark string

	// Writer is parser internal writer
	Writer io.Writer
}

Options is a struct contains all the configurations available for the parser

type Target

type Target interface {
	// GenerateManifests transcribes the content from the specs to the writer
	GenerateManifests(ctx context.Context, manifests ...*api.Manifest) error
}

Target is an abstraction for content generators, i.e: yaml and markdown.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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