model

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 15 Imported by: 6 modules, 13 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSpecification added in v0.4.0

func ParseSpecification(data []byte, config *datamodel.DocumentConfiguration) (libopenapi.Document, libasyncapi.Document, error)

ParseSpecification parses once and selects the native model by its root version field.

func SendFatalError

func SendFatalError(job, message string, errorChan chan ProgressError)

func SendProgressError

func SendProgressError(job, message string, errorChan chan ProgressError)

func SendProgressUpdate

func SendProgressUpdate(job, message string, completed bool, progressChan chan *ProgressUpdate)

func SendProgressWarning

func SendProgressWarning(job, message string, progressChan chan *ProgressUpdate)

Types

type Commit

type Commit struct {
	Specification     *ComparisonSpecification `json:"-"`
	OriginalRevision  string                   `json:"-"`
	ChangeReport      whatChanged.Changed      `json:"-"`
	Source            *HistorySource           `json:"-"`
	Window            *HistoryWindow           `json:"-"`
	Rules             *ComparisonRules         `json:"-"`
	CreatedAt         time.Time                `json:"-"`
	UpdatedAt         time.Time                `json:"-"`
	ID                uint                     `gorm:"primaryKey" json:"-"`
	Hash              string                   `json:"commitHash"`
	Message           string                   `json:"message"`
	Author            string                   `json:"author"`
	AuthorEmail       string                   `gorm:"index" json:"authorEmail"`
	CommitDate        time.Time                `json:"committed"`
	Changes           *wc.DocumentChanges      `gorm:"-" json:"changeReport,omitempty"`
	AsyncDocument     libasyncapi.Document     `json:"-"`
	OldAsyncDocument  libasyncapi.Document     `json:"-"`
	SerializedChanges []byte                   `gorm:"-" json:"-"`
	Data              []byte                   `gorm:"-" json:"-"`
	OldData           []byte                   `gorm:"-" json:"-"`
	Document          libopenapi.Document      `gorm:"-" json:"-"`
	OldDocument       libopenapi.Document      `gorm:"-" json:"-"`
	RepoDirectory     string                   `gorm:"-" json:"-"`
	FilePath          string                   `gorm:"-" json:"-"`
	OriginalSource    string                   `gorm:"-" json:"-"`
	ModifiedSource    string                   `gorm:"-" json:"-"`
	Synthetic         bool                     `gorm:"-" json:"-"`
	DocumentRewriters []DocumentPathRewriter   `gorm:"-" json:"-"`
}

func (*Commit) APILabel added in v0.4.0

func (c *Commit) APILabel() string

APILabel returns the human-facing native format name.

func (*Commit) AllChanges added in v0.4.0

func (c *Commit) AllChanges() whatChanged.Changed

AllChanges returns the active engine report while preserving Changes for callers that consume the existing concrete OpenAPI history API.

func (*Commit) Comparable added in v0.4.0

func (c *Commit) Comparable() bool

Comparable reports whether both sides of a commit contain the same native format.

func (*Commit) PrepareHistory added in v0.4.0

func (c *Commit) PrepareHistory() (*Commit, func(), error)

PrepareHistory returns a comparison copy. Malformed predecessor revisions are bypassed so a valid revision can still compare against the last valid source.

func (*Commit) SetSpecification added in v0.4.0

func (c *Commit) SetSpecification()

SetSpecification records format metadata without retaining parsed models.

type ComparisonRules added in v0.4.0

type ComparisonRules struct {
	Legacy   bool                         `yaml:"-"` // an unscoped OpenAPI policy must not silently apply to AsyncAPI
	OpenAPI  *openapi.BreakingRulesConfig `yaml:"openapiRules"`
	AsyncAPI *async.BreakingRulesConfig   `yaml:"asyncapiRules"`
	Schema   *openapi.BreakingRulesConfig `yaml:"schemaRules"`
}

ComparisonRules keeps independent policies for each engine. SchemaRules applies to JSON Schemas embedded in AsyncAPI documents only.

type ComparisonSpecification added in v0.4.0

type ComparisonSpecification struct {
	Kind            string `json:"kind"`
	OriginalVersion string `json:"originalVersion"`
	ModifiedVersion string `json:"modifiedVersion"`
}

ComparisonSpecification identifies the native format and versions of both inputs.

type DocumentPathRewriter added in v0.2.2

type DocumentPathRewriter func(string) string

type FlatHistoricalReport added in v0.0.54

type FlatHistoricalReport struct {
	GitRepoPath   string                    `json:"gitRepoPath"`
	GitFilePath   string                    `json:"gitFilePath"`
	Filename      string                    `json:"filename"`
	DateGenerated string                    `json:"dateGenerated,omitempty"`
	MetaData      *HistoricalReportMetaData `json:"metaData,omitempty"`
	Reports       []*FlatReport             `json:"reports" `
}

type FlatReport added in v0.0.54

type FlatReport struct {
	Specification *ComparisonSpecification    `json:"specification,omitempty"`
	Summary       map[string]*reports.Changed `json:"reportSummary"`
	Changes       []*HashedChange             `json:"changes"`
	OriginalPath  string                      `json:"originalPath,omitempty"`
	ModifiedPath  string                      `json:"modifiedPath,omitempty"`
	DateGenerated string                      `json:"dateGenerated,omitempty"`
	Commit        *Commit                     `gorm:"foreignKey:ID" json:"commitDetails,omitempty"`
}

type HashedChange added in v0.0.65

type HashedChange struct {
	*model.Change
	ChangeHash string `json:"changeHash,omitempty"`
	RawPath    string `json:"rawPath,omitempty"`
}

func (*HashedChange) HashChange added in v0.0.65

func (hc *HashedChange) HashChange()

func (*HashedChange) MarshalJSON added in v0.0.65

func (hc *HashedChange) MarshalJSON() ([]byte, error)

type HistoricalReportMetaData added in v0.2.3

type HistoricalReportMetaData struct {
	Partial        bool     `json:"partial,omitempty"`
	SkippedCommits []string `json:"skippedCommits,omitempty"`
}

type HistorySource added in v0.4.0

type HistorySource struct {
	Revision string
	Data     []byte
	Previous *HistorySource
	Config   func() (*datamodel.DocumentConfiguration, error)
}

HistorySource is an immutable revision input. It holds no parsed model.

type HistoryWindow added in v0.4.0

type HistoryWindow struct {
	DiscardIdle bool // console cache entries own their pairs; retain no second idle cache
	// contains filtered or unexported fields
}

HistoryWindow retains at most two idle parsed revisions. Active comparisons pin their inputs until Release; callers can safely render before releasing.

func (*HistoryWindow) Acquire added in v0.4.0

func (w *HistoryWindow) Acquire(source *HistorySource) (libopenapi.Document, libasyncapi.Document, func(), error)

Acquire parses or reuses one revision and pins it until the returned release.

func (*HistoryWindow) Close added in v0.4.0

func (w *HistoryWindow) Close()

Close releases idle models and releases pinned models when their owners finish.

type ProgressError

type ProgressError struct {
	Job     string
	Message string
	Fatal   bool
}

func (ProgressError) Error

func (p ProgressError) Error() string

type ProgressUpdate

type ProgressUpdate struct {
	Job       string
	Message   string
	Completed bool
	Warning   bool
}

type Report

type Report struct {
	ID        uint                        `gorm:"primaryKey" json:"-"`
	Summary   map[string]*reports.Changed `gorm:"-" json:"reportSummary"`
	CreatedAt time.Time                   `json:"-"`
	UpdatedAt time.Time                   `json:"-"`
	Commit    *Commit                     `gorm:"foreignKey:ID" json:"commitDetails,omitempty"`
}

Jump to

Keyboard shortcuts

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