docmerge

package
v2.0.0-b6 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge(inDef *v3.Document, opts ...Option) (*v3.Document, error)

Merge merges the documentation into the OpenAPI schema

Types

type CommentProcessor

type CommentProcessor struct {
}

CommentProcessor processes Go-style documentation comments

func NewCommentProcessor

func NewCommentProcessor() *CommentProcessor

NewCommentProcessor creates a new comment processor

func (*CommentProcessor) Process

func (p *CommentProcessor) Process(doc *v3.Document) error

Process implements Stage interface

type ErrMergeConflict

type ErrMergeConflict struct {
	Path    string
	Runtime interface{}
	Doc     interface{}
}

ErrMergeConflict represents a conflict between runtime and documentation

func (*ErrMergeConflict) Error

func (e *ErrMergeConflict) Error() string

type ErrValidation

type ErrValidation struct {
	Field   string
	Message string
}

ErrValidation represents a validation error during merge

func (*ErrValidation) Error

func (e *ErrValidation) Error() string

type Option

type Option func(*mergeOptions)

Option is a functional option for merge configuration

func WithDocFile

func WithDocFile(f *docgen.YAMLDoc) Option

WithDocFile uses a given docfile instead of the global registry. Useful for testing internals, not much else.

func WithPreserveExisting

func WithPreserveExisting(preserve bool) Option

WithPreserveExisting configures whether to keep existing documentation in the OpenAPI Document. If true, existing documentation will not be overwritten by the YAML documentation.

func WithStrictValidation

func WithStrictValidation(strict bool) Option

WithStrictValidation enables strict validation during merge. If true, any potential issue (missing docs, type mismatches etc) will result in an error.

type Pipeline

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

Pipeline processes documentation through multiple stages

func NewPipeline

func NewPipeline(stages ...Stage) *Pipeline

NewPipeline creates a new documentation processing pipeline

func (*Pipeline) Process

func (p *Pipeline) Process(doc *v3.Document) error

Process runs the document through all stages

type Stage

type Stage interface {
	Process(doc *v3.Document) error
}

Stage represents a single documentation processing stage

Jump to

Keyboard shortcuts

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