Documentation
¶
Index ¶
- Constants
- func AddChunkDefaultHeight(element any, height int) int
- func AppendIndexSegment(base, segment string, index int) string
- func AppendKeySegment(base, key string) string
- func BuildReference(ctx *DrContext, ref low.IsReferenced)
- func CompareByParentPosition(a, b Foundational) bool
- func CopyRuleResultsByNodeID(source, target []*Node)
- func DefaultSchemaWorkers() intdeprecated
- func DefaultWalkWorkers() int
- func EnsureSchemaChildrenForRead(schema *Schema)
- func ExtractKeyNodeForLowModel(obj any) *yaml.Node
- func ExtractParameterValues(params []*Parameter) []*v3.Parameter
- func ExtractValueNodeForLowModel(obj any) *yaml.Node
- func NodeIDHash(id string) string
- func ParseSchemaSize(schema *base.Schema) (height, width int)
- func RefToJSONPath(ref string) string
- func ReleaseEdge(e *Edge)
- func ReleaseNode(n *Node)
- func RuleResultOwnedByNode(result *RuleFunctionResult, node *Node) bool
- func SourceFileForFoundational(candidate Foundational) string
- type AcceptsRuleResults
- type BuildError
- type Callback
- type ChangeSummary
- type ChildChangeSummary
- type CircularRefSets
- type Companion
- type Components
- type Contact
- type ContextKey
- type Discriminator
- type Doctor
- type Document
- type DrContext
- func (d *DrContext) BuildRefEdgeByLine(ctx context.Context, source *Foundation, ref string) bool
- func (d *DrContext) RunWalk(f func())
- func (d *DrContext) SubmitSchemaWalk(ctx context.Context, sch *SchemaProxy, baseSchema *base.SchemaProxy, depth int)deprecated
- func (d *DrContext) WaitForCompletion()
- func (d *DrContext) WalkContextForRef(ctx context.Context, isRef bool) context.Context
- type DynamicValue
- type Edge
- type Encoding
- type Example
- type ExternalDoc
- type Foundation
- func (f *Foundation) AddChange(change *NodeChange)
- func (f *Foundation) AddChanges(changes []*NodeChange)
- func (f *Foundation) AddEdge(edge *Edge)
- func (f *Foundation) AddRuleFunctionResult(result *RuleFunctionResult)
- func (f *Foundation) BuildNode(ctx context.Context, label, nodeType string, arrayType bool, ...) *Node
- func (f *Foundation) BuildNodesAndEdges(ctx context.Context, label, nodeType string, model high.GoesLowUntyped, ...)
- func (f *Foundation) BuildNodesAndEdgesWithArray(ctx context.Context, label, nodeType string, model high.GoesLowUntyped, ...)
- func (f *Foundation) BuildReferenceEdge(ctx context.Context, source, destination, ref string, poly string) *Edge
- func (f *Foundation) BuildReferenceEdgeToLine(ctx context.Context, source string, targetLine int, ref string, poly string) *Edge
- func (f *Foundation) BuildSchemaNodeAndEdge(ctx context.Context, label string, model high.GoesLowUntyped, drModel any)
- func (f *Foundation) GenerateJSONPath() string
- func (f *Foundation) GenerateJSONPathWithLevel(level int) string
- func (f *Foundation) GetChanges() []*NodeChange
- func (f *Foundation) GetEdges() []*Edge
- func (f *Foundation) GetIndexValue() *int
- func (f *Foundation) GetInstanceType() string
- func (f *Foundation) GetKeyNode() *yaml.Node
- func (f *Foundation) GetKeyValue() string
- func (f *Foundation) GetNode() *Node
- func (f *Foundation) GetNodeParent() Foundational
- func (f *Foundation) GetParent() Foundational
- func (f *Foundation) GetPathSegment() string
- func (f *Foundation) GetRefNode() *Node
- func (f *Foundation) GetRoot() Foundational
- func (f *Foundation) GetRuleFunctionResults() []*RuleFunctionResult
- func (f *Foundation) GetSize() (height, width int)
- func (f *Foundation) GetValueNode() *yaml.Node
- func (f *Foundation) ProcessNodesAndEdges(ctx context.Context, label, nodeType string, model high.GoesLowUntyped, ...)
- func (f *Foundation) SetInstanceType(instanceType string)
- func (f *Foundation) SetNode(node *Node)
- func (f *Foundation) SetPathSegment(segment string)
- func (f *Foundation) SetRefNode(node *Node)
- type Foundational
- type HasIndex
- type HasSize
- type HasValue
- type HashCache
- type Header
- type Info
- type IsObjectReference
- type License
- type Link
- type MediaType
- type Node
- type NodeChange
- func (n *NodeChange) GetAllChanges() []*model.Change
- func (n *NodeChange) GetHash() string
- func (n *NodeChange) GetLabel() string
- func (n *NodeChange) GetPath() string
- func (n *NodeChange) GetPropertyChanges() []*model.Change
- func (n *NodeChange) GetType() string
- func (n *NodeChange) PropertiesOnly()
- func (n *NodeChange) SetChanges(changes what_changed.Changed)
- func (n *NodeChange) TotalBreakingChanges() int
- func (n *NodeChange) TotalChanges() int
- type NodeChangeable
- type OAuthFlow
- type OAuthFlows
- type ObjectReference
- type Operation
- type Parameter
- type PathItem
- type Paths
- type RequestBody
- type Response
- type Responses
- type Rule
- type RuleCategory
- type RuleFunctionResult
- type Schema
- func (s *Schema) AdditionalPropertiesForRead() *DynamicValue[*base.SchemaProxy, bool, *SchemaProxy, bool]
- func (s *Schema) AllOfForRead() []*SchemaProxy
- func (s *Schema) AnyOfForRead() []*SchemaProxy
- func (s *Schema) ContainsForRead() *SchemaProxy
- func (s *Schema) DefinitionSource() (*Schema, bool)
- func (s *Schema) DependentSchemasForRead() *orderedmap.Map[string, *SchemaProxy]
- func (s *Schema) ElseForRead() *SchemaProxy
- func (s *Schema) EnsureChildrenForRead()
- func (s *Schema) GetSize() (height, width int)
- func (s *Schema) GetValue() any
- func (s *Schema) IfForRead() *SchemaProxy
- func (s *Schema) IsAlias() bool
- func (s *Schema) ItemsForRead() *DynamicValue[*base.SchemaProxy, bool, *SchemaProxy, bool]
- func (s *Schema) NotForRead() *SchemaProxy
- func (s *Schema) OneOfForRead() []*SchemaProxy
- func (s *Schema) PatternPropertiesForRead() *orderedmap.Map[string, *SchemaProxy]
- func (s *Schema) PrefixItemsForRead() []*SchemaProxy
- func (s *Schema) PropertiesForRead() *orderedmap.Map[string, *SchemaProxy]
- func (s *Schema) PropertyNamesForRead() *SchemaProxy
- func (s *Schema) ThenForRead() *SchemaProxy
- func (s *Schema) Travel(ctx context.Context, tardis Tardis)
- func (s *Schema) UnevaluatedItemsForRead() *SchemaProxy
- func (s *Schema) UnevaluatedPropertiesForRead() *DynamicValue[*base.SchemaProxy, bool, *SchemaProxy, bool]
- func (s *Schema) Walk(ctx context.Context, schema *base.Schema, depth int)
- type SchemaProxy
- type SchemaWalkPooldeprecated
- func (p *SchemaWalkPool) DrainAndShutdown()deprecated
- func (p *SchemaWalkPool) IsIdle() booldeprecated
- func (p *SchemaWalkPool) Shutdown()deprecated
- func (p *SchemaWalkPool) Submit(sch *SchemaProxy, baseSchema *base.SchemaProxy, depth int) booldeprecated
- func (p *SchemaWalkPool) SubmitOrWalk(sch *SchemaProxy, baseSchema *base.SchemaProxy, depth int)deprecated
- func (p *SchemaWalkPool) WaitForCompletion()deprecated
- type SchemaWorkItemdeprecated
- type SecurityRequirement
- type SecurityScheme
- type Server
- type ServerVariable
- type Tag
- type Tardis
- type WalkPool
- func (p *WalkPool) DrainAndShutdown()
- func (p *WalkPool) InFlight() int64
- func (p *WalkPool) IsIdle() bool
- func (p *WalkPool) QueueLen() int
- func (p *WalkPool) Shutdown()
- func (p *WalkPool) Submit(fn func()) bool
- func (p *WalkPool) SubmitOrRun(fn func())
- func (p *WalkPool) WaitForCompletion()
- func (p *WalkPool) Workers() int
- type Walkable
- type WalkedHeader
- type WalkedMediaType
- type WalkedParam
- type WalkedSchema
- type XML
Constants ¶
const CHAR_WIDTH = 8
const DefaultSchemaWorkQueueSize = 5000
DefaultSchemaWorkQueueSize is the buffer size for pending schema walks.
Deprecated: retained only for source compatibility with SchemaWalkPool.
const DefaultWalkWorkQueueSize = 5000
DefaultWalkWorkQueueSize is the buffer size for pending walk operations. Set to 5000 to handle enterprise-scale OpenAPI specs out of the box.
const HEIGHT = 25
const MAX_WIDTH = 700
const MIN_WIDTH = 150
const WIDTH = 200
Variables ¶
This section is empty.
Functions ¶
func AddChunkDefaultHeight ¶
func AppendIndexSegment ¶ added in v0.0.76
AppendIndexSegment appends an indexed segment to a JSONPath base, e.g. base + .seg[3]. Counterpart of AppendKeySegment for indexed collections.
func AppendKeySegment ¶ added in v0.0.76
AppendKeySegment appends a quoted key segment to a JSONPath base, e.g. base + ['key']. This is THE single encoding of the key-segment grammar: Foundation.buildJSONPathIterative and the canonical-path pre-population in the model package (prePopulate* family) must both use it so walked paths and pre-seeded definition-site paths can never drift apart.
func BuildReference ¶
func BuildReference(ctx *DrContext, ref low.IsReferenced)
func CompareByParentPosition ¶
func CompareByParentPosition(a, b Foundational) bool
CompareByParentPosition returns true if a's parent comes before b's parent in document order (lower line, or same line with lower column). This is used to ensure a deterministic schema collection when the same schema is encountered via multiple concurrent paths (e.g., via anyOf/oneOf refs). A nil parent (definition site) is always considered canonical.
func CopyRuleResultsByNodeID ¶ added in v0.0.61
func CopyRuleResultsByNodeID(source, target []*Node)
CopyRuleResultsByNodeID copies owned rule results from matching source nodes to target nodes. Aggregate results forwarded to roots are skipped; adding a copied child result may still forward the aggregate copy through normal Foundation behavior.
func DefaultSchemaWorkers
deprecated
func DefaultSchemaWorkers() int
DefaultSchemaWorkers returns the number of concurrent schema walkers.
Deprecated: retained only for source compatibility with SchemaWalkPool.
func DefaultWalkWorkers ¶
func DefaultWalkWorkers() int
DefaultWalkWorkers returns the number of concurrent walk workers. Scales with available CPU cores for optimal performance.
func EnsureSchemaChildrenForRead ¶ added in v0.0.64
func EnsureSchemaChildrenForRead(schema *Schema)
func ExtractParameterValues ¶ added in v0.0.50
func ExtractParameterValues(params []*Parameter) []*v3.Parameter
ExtractParameterValues extracts the underlying libopenapi Parameter values from a slice of doctor Parameter wrappers, preserving order and nil entries.
func NodeIDHash ¶ added in v0.0.76
func ParseSchemaSize ¶
func RefToJSONPath ¶ added in v0.0.50
RefToJSONPath converts a JSON Reference string to a JSONPath node ID. e.g., "#/components/headers/RateLimit" -> "$.components.headers['RateLimit']" Handles JSON Pointer escapes (~0 -> ~, ~1 -> /) and external refs (file.yaml#/...).
func RuleResultOwnedByNode ¶ added in v0.0.61
func RuleResultOwnedByNode(result *RuleFunctionResult, node *Node) bool
RuleResultOwnedByNode reports whether a result belongs directly to the node, excluding copies forwarded to aggregate/root receivers.
func SourceFileForFoundational ¶ added in v0.0.61
func SourceFileForFoundational(candidate Foundational) string
SourceFileForFoundational returns the absolute spec path for a Doctor object when its underlying low model carries an index.
Types ¶
type AcceptsRuleResults ¶
type AcceptsRuleResults interface {
AddRuleFunctionResult(result *RuleFunctionResult)
GetRuleFunctionResults() []*RuleFunctionResult
}
type BuildError ¶
type BuildError struct {
Error error
SchemaProxy *base.SchemaProxy
DrSchemaProxy *SchemaProxy
}
type Callback ¶
type Callback struct {
Value *v3.Callback
Expression *orderedmap.Map[string, *PathItem]
Foundation
}
type ChangeSummary ¶ added in v0.0.50
type ChangeSummary struct {
Additions int `json:"additions"`
Modifications int `json:"modifications"`
Removals int `json:"removals"`
Breaking int `json:"breaking"`
Total int `json:"total"`
}
ChangeSummary holds aggregated change counts for a node's subtree.
type ChildChangeSummary ¶ added in v0.0.50
type ChildChangeSummary struct {
Label string `json:"label"`
Type string `json:"type"`
IdHash string `json:"idHash"`
NodeId string `json:"nodeId"`
Changes *ChangeSummary `json:"changes"`
}
ChildChangeSummary represents one child row in change-view rendering. Go field "ChildChangeSummaries" serializes as JSON "childChanges" via MarshalJSON.
type CircularRefSets ¶ added in v0.0.76
type CircularRefSets struct {
// contains filtered or unexported fields
}
CircularRefSets caches the document's circular reference lookups as sets. The underlying index data is immutable during a walk, but the slices are re-assembled (three appends + linear scan) by every reference walk without this cache. Built lazily on first use; safe for concurrent walkers.
type Companion ¶
Companion is implemented by any visitable object. It allows the tardis to travel through it. The secret to the doctor, is his companion.
type Components ¶
type Components struct {
Value *v3.Components
Schemas *orderedmap.Map[string, *SchemaProxy]
Responses *orderedmap.Map[string, *Response]
Parameters *orderedmap.Map[string, *Parameter]
Examples *orderedmap.Map[string, *Example]
RequestBodies *orderedmap.Map[string, *RequestBody]
Headers *orderedmap.Map[string, *Header]
SecuritySchemes *orderedmap.Map[string, *SecurityScheme]
Links *orderedmap.Map[string, *Link]
Callbacks *orderedmap.Map[string, *Callback]
PathItems *orderedmap.Map[string, *PathItem]
Foundation
}
func (*Components) GetSize ¶
func (c *Components) GetSize() (height, width int)
func (*Components) GetValue ¶
func (c *Components) GetValue() any
func (*Components) Walk ¶
func (c *Components) Walk(ctx context.Context, components *v3.Components)
type Contact ¶
type Contact struct {
Value *base.Contact `json:"contact,omitempty" yaml:"contact,omitempty"`
Foundation
}
type Discriminator ¶
type Discriminator struct {
Value *base.Discriminator
Foundation
}
func (*Discriminator) GetValue ¶
func (d *Discriminator) GetValue() any
type Doctor ¶
type Doctor interface {
LocateModelsByKeyAndValue(key, value *yaml.Node) ([]Foundational, error)
LocateModel(node *yaml.Node) ([]Foundational, error)
LocateModelByLine(line int) ([]Foundational, error)
}
Doctor who?
type Document ¶
type Document struct {
Document *v3.Document
Info *Info
Servers []*Server
Paths *Paths
Components *Components
Security []*SecurityRequirement
Tags []*Tag
ExternalDocs *ExternalDoc
Webhooks *orderedmap.Map[string, *PathItem]
Foundation
}
type DrContext ¶
type DrContext struct {
SchemaChan chan *WalkedSchema
ObjectChan chan any
SkippedSchemaChan chan *WalkedSchema
ParameterChan chan *WalkedParam
HeaderChan chan *WalkedHeader
MediaTypeChan chan *WalkedMediaType
ErrorChan chan *BuildError
NodeChan chan *Node
EdgeChan chan *Edge
Index *index.SpecIndex
Rolodex *index.Rolodex
V3Document *v3.Document
BuildGraph bool
RenderChanges bool
UseSchemaCache bool
SyncWalk bool // When true, walk everything synchronously (no goroutines)
WalkPool *WalkPool // General bounded worker pool for all walk operations
// Deprecated: schema subtrees are walked inline before cache publication.
// This field is retained only for source compatibility with callers that
// constructed DrContext directly.
SchemaPool *SchemaWalkPool
// Deprecated: pooled walking is the default whenever SyncWalk is false.
// This field is retained only for source compatibility.
PooledWalk bool
DeterministicPaths bool // When true, component objects return definition-site paths
SchemaCache *sync.Map
CanonicalPathCache *sync.Map // Maps *yaml.Node pointer -> canonical JSONPath (definition site)
HashCache *HashCache
// Deprecated: string interning was removed from the walker. This field is
// retained only for source compatibility.
StringCache *sync.Map
StorageRoot string
WorkingDirectory string
Logger *slog.Logger
// CanonicalPathsApplied tracks canonical schemas whose subtrees have had
// canonical cache paths applied during this walk, so repeated cache hits
// skip the idempotent full-subtree traversal. A pointer so DrContext
// copies (WalkContextForRef) share the set; nil simply disables the guard.
CanonicalPathsApplied *sync.Map
// CircularRefs caches circular-reference lookups as sets so reference
// walks avoid re-assembling slices per $ref. A pointer so DrContext
// copies share it; nil falls back to scanning the index slices directly.
CircularRefs *CircularRefSets
}
func GetDrContext ¶
func (*DrContext) BuildRefEdgeByLine ¶
BuildRefEdgeByLine creates a reference edge from source node to a component definition using the component's canonical JSONPath as target identifier. Returns true if edge was created successfully.
func (*DrContext) RunWalk ¶
func (d *DrContext) RunWalk(f func())
RunWalk submits work to the bounded a WalkPool or runs synchronously if SyncWalk is true. The pool automatically falls back to synchronous execution if the queue is full.
func (*DrContext) SubmitSchemaWalk
deprecated
func (d *DrContext) SubmitSchemaWalk(ctx context.Context, sch *SchemaProxy, baseSchema *base.SchemaProxy, depth int)
SubmitSchemaWalk submits a schema walk through the deprecated schema pool when one is configured, otherwise it walks synchronously.
Deprecated: schema descendants are now walked inline before schema cache publication. New code should call SchemaProxy.Walk directly or use RunWalk for non-schema document branches.
func (*DrContext) WaitForCompletion ¶
func (d *DrContext) WaitForCompletion()
WaitForCompletion blocks until all submitted walk operations have completed. In sync mode, this is a no-op because work has already completed inline.
func (*DrContext) WalkContextForRef ¶
WalkContextForRef returns a context suitable for walking a $ref object. When DeterministicPaths is enabled and not rendering changes, BuildGraph is disabled to prevent creating duplicate nodes. The component definition creates the canonical node; reference usages only need edges.
type DynamicValue ¶
type DynamicValue[A, R, S, E any] struct { Value *base.DynamicValue[A, R] A S B E Foundation }
func (*DynamicValue[A, R, S, E]) GetValue ¶
func (d *DynamicValue[A, R, S, E]) GetValue() any
func (*DynamicValue[A, R, S, E]) Walk ¶
func (d *DynamicValue[A, R, S, E]) Walk(ctx context.Context)
type Edge ¶
type Edge struct {
Id string `json:"id"`
Sources []string `json:"sources"`
Targets []string `json:"targets"`
Poly string `json:"poly,omitempty"`
Ref string `json:"ref"`
// TargetLine carries an unresolved reference target as a source line
// number during the walk; it is resolved to a node id (Targets[0]) or the
// edge is dropped before edges are published. Never serialized.
TargetLine int `json:"-"`
}
func GenerateEdge ¶
type Encoding ¶
type Encoding struct {
Value *v3.Encoding
Headers *orderedmap.Map[string, *Header]
Foundation
}
type Example ¶
type Example struct {
Value *base.Example
Foundation
}
type ExternalDoc ¶
type ExternalDoc struct {
Value *base.ExternalDoc
Foundation
}
func (*ExternalDoc) GetValue ¶
func (ed *ExternalDoc) GetValue() any
func (*ExternalDoc) Walk ¶
func (ed *ExternalDoc) Walk(ctx context.Context, externalDoc *base.ExternalDoc)
type Foundation ¶
type Foundation struct {
PathSegment string
InstanceType string
IsIndexed bool
Index *int
Key string
PolyType string
Parent any
NodeParent any
RuleResults []*RuleFunctionResult
JSONPath string
Mutex sync.RWMutex
// Deprecated: retained only for source compatibility with direct struct
// users. Locking this mutex no longer synchronizes PathSegment; use
// GetPathSegment and SetPathSegment instead.
PathSegmentMutex sync.RWMutex
JSONPathOnce sync.Once
Node *Node
NodeReference *Node // if the chain was broken, keep a reference
Edges []*Edge
KeyNode *yaml.Node
ValueNode *yaml.Node
Changes []*NodeChange
CacheSplit bool
}
func (*Foundation) AddChange ¶
func (f *Foundation) AddChange(change *NodeChange)
func (*Foundation) AddChanges ¶
func (f *Foundation) AddChanges(changes []*NodeChange)
func (*Foundation) AddEdge ¶
func (f *Foundation) AddEdge(edge *Edge)
func (*Foundation) AddRuleFunctionResult ¶
func (f *Foundation) AddRuleFunctionResult(result *RuleFunctionResult)
func (*Foundation) BuildNodesAndEdges ¶
func (f *Foundation) BuildNodesAndEdges(ctx context.Context, label, nodeType string, model high.GoesLowUntyped, drModel any)
func (*Foundation) BuildNodesAndEdgesWithArray ¶
func (f *Foundation) BuildNodesAndEdgesWithArray(ctx context.Context, label, nodeType string, model high.GoesLowUntyped, drModel any, arrayType bool, arrayCount int, arrayIndex *int)
func (*Foundation) BuildReferenceEdge ¶
func (*Foundation) BuildReferenceEdgeToLine ¶ added in v0.0.76
func (f *Foundation) BuildReferenceEdgeToLine(ctx context.Context, source string, targetLine int, ref string, poly string) *Edge
BuildReferenceEdgeToLine builds a reference edge whose target is a source line number, resolved to a node id after the walk completes. It avoids formatting the line into the Targets slice just to parse it back out.
func (*Foundation) BuildSchemaNodeAndEdge ¶
func (f *Foundation) BuildSchemaNodeAndEdge(ctx context.Context, label string, model high.GoesLowUntyped, drModel any)
func (*Foundation) GenerateJSONPath ¶
func (f *Foundation) GenerateJSONPath() string
func (*Foundation) GenerateJSONPathWithLevel ¶
func (f *Foundation) GenerateJSONPathWithLevel(level int) string
func (*Foundation) GetChanges ¶
func (f *Foundation) GetChanges() []*NodeChange
func (*Foundation) GetEdges ¶
func (f *Foundation) GetEdges() []*Edge
func (*Foundation) GetIndexValue ¶
func (f *Foundation) GetIndexValue() *int
func (*Foundation) GetInstanceType ¶
func (f *Foundation) GetInstanceType() string
func (*Foundation) GetKeyNode ¶
func (f *Foundation) GetKeyNode() *yaml.Node
func (*Foundation) GetKeyValue ¶
func (f *Foundation) GetKeyValue() string
func (*Foundation) GetNode ¶
func (f *Foundation) GetNode() *Node
func (*Foundation) GetNodeParent ¶
func (f *Foundation) GetNodeParent() Foundational
func (*Foundation) GetParent ¶
func (f *Foundation) GetParent() Foundational
func (*Foundation) GetPathSegment ¶
func (f *Foundation) GetPathSegment() string
func (*Foundation) GetRefNode ¶
func (f *Foundation) GetRefNode() *Node
func (*Foundation) GetRoot ¶
func (f *Foundation) GetRoot() Foundational
func (*Foundation) GetRuleFunctionResults ¶
func (f *Foundation) GetRuleFunctionResults() []*RuleFunctionResult
func (*Foundation) GetSize ¶ added in v0.0.50
func (f *Foundation) GetSize() (height, width int)
func (*Foundation) GetValueNode ¶
func (f *Foundation) GetValueNode() *yaml.Node
func (*Foundation) ProcessNodesAndEdges ¶
func (*Foundation) SetInstanceType ¶
func (f *Foundation) SetInstanceType(instanceType string)
func (*Foundation) SetNode ¶
func (f *Foundation) SetNode(node *Node)
func (*Foundation) SetPathSegment ¶
func (f *Foundation) SetPathSegment(segment string)
func (*Foundation) SetRefNode ¶
func (f *Foundation) SetRefNode(node *Node)
type Foundational ¶
type Foundational interface {
GetParent() Foundational
GetNodeParent() Foundational
GetPathSegment() string
GetKeyValue() string
GetIndexValue() *int
GenerateJSONPath() string
GenerateJSONPathWithLevel(level int) string
GetRoot() Foundational
SetNode(node *Node)
AddEdge(edge *Edge)
GetNode() *Node
GetRefNode() *Node
GetEdges() []*Edge
GetKeyNode() *yaml.Node
GetValueNode() *yaml.Node
GetInstanceType() string
SetInstanceType(instanceType string)
GetChanges() []*NodeChange
AddChanges(changes []*NodeChange)
AddChange(changes *NodeChange)
}
Foundational is the base interface for all models in the doctor. It provides a way to navigate the model
type HashCache ¶ added in v0.0.64
type HashCache struct {
// contains filtered or unexported fields
}
func NewHashCache ¶ added in v0.0.64
func NewHashCache() *HashCache
type Header ¶
type Header struct {
Value *v3.Header
Schema *SchemaProxy
Examples *orderedmap.Map[string, *Example]
Content *orderedmap.Map[string, *MediaType]
Foundation
}
type IsObjectReference ¶
type License ¶
type License struct {
Value *base.License
Foundation
}
type MediaType ¶
type MediaType struct {
Value *v3.MediaType
SchemaProxy *SchemaProxy
Examples *orderedmap.Map[string, *Example]
Encoding *orderedmap.Map[string, *Encoding]
Foundation
}
type Node ¶
type Node struct {
Value *yaml.Node `json:"-"`
Id string `json:"id"`
IdHash string `json:"idHash,omitempty"`
ParentId string `json:"parentId"`
Type string `json:"type"`
Label string `json:"label"`
Width int `json:"width"`
Height int `json:"height"`
Children []*Node `json:"nodes,omitempty"`
IsArray bool `json:"isArray,omitempty"`
IsPoly bool `json:"isPoly,omitempty"`
PolyType string `json:"polyType,omitempty"`
PropertyCount int `json:"propertyCount,omitempty"`
ArrayIndex int `json:"arrayIndex,omitempty"`
ArrayValues int `json:"arrayValues,omitempty"`
Extensions int `json:"extensions,omitempty"`
Hash string `json:"hash,omitempty"`
OriginLocation string `json:"originLocation,omitempty"`
Origin *index.NodeOrigin `json:"nodeOrigin,omitempty"`
KeyLine int `json:"-"`
ValueLine int `json:"valueLine"`
Instance any `json:"instance"`
DrInstance any `json:"-"`
Changes []what_changed.Changed `json:"-"`
RenderedChanges []*model.Change `json:"timeline,omitempty"`
CleanedChanged []*model.Change `json:"cleanedChanges,omitempty"`
SubtreeChanges *ChangeSummary `json:"-"`
ChildChangeSummaries []*ChildChangeSummary `json:"-"`
RenderProps bool `json:"-"`
RenderChanges bool `json:"-"`
RenderProblems bool `json:"-"`
RenderProblemsAsIds bool `json:"-"` // modified design to stop embedding violations in nodes, uses lookup now.
ViolationIdMap map[string]string `json:"-"`
Mutex sync.RWMutex `json:"-"`
// contains filtered or unexported fields
}
func GenerateNode ¶
func NewSyntheticNode ¶ added in v0.0.50
NewSyntheticNode creates a minimal Node for use outside the normal model walk. It is sufficient for tree/explorer rendering and the report path, but does not participate in ELK layout, edges, or object channel emission.
func (*Node) AppendChange ¶
func (n *Node) AppendChange(change what_changed.Changed)
func (*Node) CloneShallow ¶ added in v0.0.76
CloneShallow copies node data without copying lock state. Slice and map fields remain shared with the source, matching the historical shallow-copy behavior.
func (*Node) GetChanges ¶
func (n *Node) GetChanges() []what_changed.Changed
Node methods for thread-safe access to Changes field
func (*Node) GetInstance ¶
func (*Node) MarshalJSON ¶
func (*Node) SetInstance ¶
type NodeChange ¶
type NodeChange struct {
Id string `json:"id,omitempty"`
IdHash string `json:"idHash,omitempty"`
Type string `json:"type,omitempty"`
Label string `json:"label,omitempty"`
Path string `json:"path,omitempty"`
Children []*Node `json:"nodes,omitempty"`
ArrayIndex int `json:"arrayIndex,omitempty"`
Changes what_changed.Changed `json:"timeline,omitempty"`
Mutex sync.RWMutex `json:"-"`
}
func (*NodeChange) GetAllChanges ¶
func (n *NodeChange) GetAllChanges() []*model.Change
func (*NodeChange) GetHash ¶
func (n *NodeChange) GetHash() string
func (*NodeChange) GetLabel ¶
func (n *NodeChange) GetLabel() string
func (*NodeChange) GetPath ¶
func (n *NodeChange) GetPath() string
func (*NodeChange) GetPropertyChanges ¶
func (n *NodeChange) GetPropertyChanges() []*model.Change
func (*NodeChange) GetType ¶
func (n *NodeChange) GetType() string
func (*NodeChange) PropertiesOnly ¶
func (n *NodeChange) PropertiesOnly()
func (*NodeChange) SetChanges ¶
func (n *NodeChange) SetChanges(changes what_changed.Changed)
func (*NodeChange) TotalBreakingChanges ¶
func (n *NodeChange) TotalBreakingChanges() int
func (*NodeChange) TotalChanges ¶
func (n *NodeChange) TotalChanges() int
type NodeChangeable ¶
type OAuthFlow ¶
type OAuthFlow struct {
Value *v3.OAuthFlow
Foundation
}
type OAuthFlows ¶
type OAuthFlows struct {
Value *v3.OAuthFlows
Implicit *OAuthFlow
Password *OAuthFlow
ClientCredentials *OAuthFlow
AuthorizationCode *OAuthFlow
Device *OAuthFlow
Foundation
}
func (*OAuthFlows) GetValue ¶
func (o *OAuthFlows) GetValue() any
func (*OAuthFlows) Walk ¶
func (o *OAuthFlows) Walk(ctx context.Context, flows *v3.OAuthFlows)
type ObjectReference ¶
type ObjectReference struct {
Reference string
Node *yaml.Node
Foundation
}
func (*ObjectReference) GetReference ¶
func (r *ObjectReference) GetReference() string
func (*ObjectReference) GetReferenceNode ¶
func (r *ObjectReference) GetReferenceNode() *yaml.Node
func (*ObjectReference) GetValue ¶
func (r *ObjectReference) GetValue() any
func (*ObjectReference) GoLowUntyped ¶
func (r *ObjectReference) GoLowUntyped() any
func (*ObjectReference) IsReference ¶
func (r *ObjectReference) IsReference() bool
type Operation ¶
type Operation struct {
Value *v3.Operation
ExternalDocs *ExternalDoc
Parameters []*Parameter
RequestBody *RequestBody
Responses *Responses
Callbacks *orderedmap.Map[string, *Callback]
Security []*SecurityRequirement
Servers []*Server
Tags *Foundation
Foundation
}
type Parameter ¶
type Parameter struct {
Value *v3.Parameter
SchemaProxy *SchemaProxy
Examples *orderedmap.Map[string, *Example]
Content *orderedmap.Map[string, *MediaType]
Foundation
}
type PathItem ¶
type PathItem struct {
Value *v3.PathItem
Get *Operation
Put *Operation
Post *Operation
Delete *Operation
Options *Operation
Head *Operation
Patch *Operation
Trace *Operation
Servers []*Server
Parameters []*Parameter
Foundation
}
func (*PathItem) GetOperations ¶
func (p *PathItem) GetOperations() *orderedmap.Map[string, *Operation]
type Paths ¶
type Paths struct {
Value *v3.Paths
PathItems *orderedmap.Map[string, *PathItem]
Foundation
}
type RequestBody ¶
type RequestBody struct {
Value *v3.RequestBody
Content *orderedmap.Map[string, *MediaType]
Foundation
}
func (*RequestBody) GetSize ¶
func (r *RequestBody) GetSize() (height, width int)
func (*RequestBody) GetValue ¶
func (r *RequestBody) GetValue() any
func (*RequestBody) Walk ¶
func (r *RequestBody) Walk(ctx context.Context, requestBody *v3.RequestBody)
type Response ¶
type Response struct {
Value *v3.Response
Headers *orderedmap.Map[string, *Header]
Content *orderedmap.Map[string, *MediaType]
Links *orderedmap.Map[string, *Link]
Foundation
}
type Responses ¶
type Responses struct {
Value *v3.Responses
Codes *orderedmap.Map[string, *Response]
Default *Response
Foundation
}
type Rule ¶
type Rule struct {
Id string `json:"id,omitempty" yaml:"id,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Message string `json:"message,omitempty" yaml:"message,omitempty"`
Recommended bool `json:"recommended,omitempty" yaml:"recommended,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Severity string `json:"severity,omitempty" yaml:"severity,omitempty"`
RuleCategory *RuleCategory `json:"category,omitempty" yaml:"category,omitempty"`
HowToFix string `json:"howToFix,omitempty" yaml:"howToFix,omitempty"`
}
Rule is a structure that represents a rule as part of a ruleset.
type RuleCategory ¶
type RuleFunctionResult ¶
type RuleFunctionResult struct {
Message string `json:"message" yaml:"message"`
Path string `json:"path" yaml:"path"`
RuleId string `json:"ruleId" yaml:"ruleId"`
RuleSeverity string `json:"ruleSeverity" yaml:"ruleSeverity"`
Origin *index.NodeOrigin `json:"origin,omitempty" yaml:"origin,omitempty"`
Rule *Rule `json:"-" yaml:"-"`
StartNode *yaml.Node `json:"-" yaml:"-"`
EndNode *yaml.Node `json:"-" yaml:"-"`
ParentObject any `json:"-" yaml:"-"`
}
RuleFunctionResult describes a failure with linting after being run through a rule
func CloneRuleFunctionResultForParent ¶ added in v0.0.61
func CloneRuleFunctionResultForParent(result *RuleFunctionResult, parent any) *RuleFunctionResult
CloneRuleFunctionResultForParent makes a shallow copy for a new owner.
func ConvertRuleResult ¶
func ConvertRuleResult(object any) *RuleFunctionResult
type Schema ¶
type Schema struct {
Name string
Value *base.Schema
Hash string
AllOf []*SchemaProxy
OneOf []*SchemaProxy
AnyOf []*SchemaProxy
PrefixItems []*SchemaProxy
Discriminator *Discriminator
Contains *SchemaProxy
If *SchemaProxy
Else *SchemaProxy
Then *SchemaProxy
DependentSchemas *orderedmap.Map[string, *SchemaProxy]
PatternProperties *orderedmap.Map[string, *SchemaProxy]
PropertyNames *SchemaProxy
UnevaluatedItems *SchemaProxy
UnevaluatedProperties *DynamicValue[*base.SchemaProxy, bool, *SchemaProxy, bool]
Items *DynamicValue[*base.SchemaProxy, bool, *SchemaProxy, bool]
Not *SchemaProxy
Properties *orderedmap.Map[string, *SchemaProxy]
AdditionalProperties *DynamicValue[*base.SchemaProxy, bool, *SchemaProxy, bool]
XML *XML
ExternalDocs *ExternalDoc
// Definition points at the canonical schema for render-cache aliases.
// It remains exported for compatibility; external callers should treat it
// as read-only and use the alias-safe *ForRead helpers instead of assigning
// it directly.
// Alias child fields are populated lazily via the *ForRead helpers. The
// canonical schema is treated as immutable after cache publication; alias
// Hash and Walked values are snapshots from that build phase.
Definition *Schema
// Walked remains true for render-cache aliases because their canonical
// definition has already been walked.
Walked bool
Foundation
// contains filtered or unexported fields
}
func SchemaFromProxyForRead ¶ added in v0.0.64
func SchemaFromProxyForRead(proxy *SchemaProxy) *Schema
func (*Schema) AdditionalPropertiesForRead ¶ added in v0.0.64
func (s *Schema) AdditionalPropertiesForRead() *DynamicValue[*base.SchemaProxy, bool, *SchemaProxy, bool]
func (*Schema) AllOfForRead ¶ added in v0.0.64
func (s *Schema) AllOfForRead() []*SchemaProxy
func (*Schema) AnyOfForRead ¶ added in v0.0.64
func (s *Schema) AnyOfForRead() []*SchemaProxy
func (*Schema) ContainsForRead ¶ added in v0.0.64
func (s *Schema) ContainsForRead() *SchemaProxy
func (*Schema) DefinitionSource ¶ added in v0.0.64
func (*Schema) DependentSchemasForRead ¶ added in v0.0.64
func (s *Schema) DependentSchemasForRead() *orderedmap.Map[string, *SchemaProxy]
func (*Schema) ElseForRead ¶ added in v0.0.64
func (s *Schema) ElseForRead() *SchemaProxy
func (*Schema) EnsureChildrenForRead ¶ added in v0.0.64
func (s *Schema) EnsureChildrenForRead()
func (*Schema) IfForRead ¶ added in v0.0.64
func (s *Schema) IfForRead() *SchemaProxy
func (*Schema) ItemsForRead ¶ added in v0.0.64
func (s *Schema) ItemsForRead() *DynamicValue[*base.SchemaProxy, bool, *SchemaProxy, bool]
func (*Schema) NotForRead ¶ added in v0.0.64
func (s *Schema) NotForRead() *SchemaProxy
func (*Schema) OneOfForRead ¶ added in v0.0.64
func (s *Schema) OneOfForRead() []*SchemaProxy
func (*Schema) PatternPropertiesForRead ¶ added in v0.0.64
func (s *Schema) PatternPropertiesForRead() *orderedmap.Map[string, *SchemaProxy]
func (*Schema) PrefixItemsForRead ¶ added in v0.0.64
func (s *Schema) PrefixItemsForRead() []*SchemaProxy
func (*Schema) PropertiesForRead ¶ added in v0.0.64
func (s *Schema) PropertiesForRead() *orderedmap.Map[string, *SchemaProxy]
func (*Schema) PropertyNamesForRead ¶ added in v0.0.64
func (s *Schema) PropertyNamesForRead() *SchemaProxy
func (*Schema) ThenForRead ¶ added in v0.0.64
func (s *Schema) ThenForRead() *SchemaProxy
func (*Schema) UnevaluatedItemsForRead ¶ added in v0.0.64
func (s *Schema) UnevaluatedItemsForRead() *SchemaProxy
func (*Schema) UnevaluatedPropertiesForRead ¶ added in v0.0.64
func (s *Schema) UnevaluatedPropertiesForRead() *DynamicValue[*base.SchemaProxy, bool, *SchemaProxy, bool]
type SchemaProxy ¶
type SchemaProxy struct {
Value *base.SchemaProxy
Schema *Schema
Foundation
}
func (*SchemaProxy) GetValue ¶
func (sp *SchemaProxy) GetValue() any
func (*SchemaProxy) IsCircular ¶
func (sp *SchemaProxy) IsCircular(ctx context.Context) bool
func (*SchemaProxy) SchemaForRead ¶ added in v0.0.64
func (sp *SchemaProxy) SchemaForRead() *Schema
func (*SchemaProxy) Walk ¶
func (sp *SchemaProxy) Walk(ctx context.Context, schemaProxy *base.SchemaProxy, depth int)
type SchemaWalkPool
deprecated
type SchemaWalkPool struct {
// contains filtered or unexported fields
}
SchemaWalkPool manages bounded concurrent schema walking.
Deprecated: the production walker no longer uses a separate schema pool because schema subtrees must be fully built before cache publication. This compatibility type preserves the old API for external callers that still construct one directly.
func NewSchemaWalkPool
deprecated
func NewSchemaWalkPool(ctx context.Context, drCtx *DrContext, workers int) *SchemaWalkPool
NewSchemaWalkPool creates a deprecated compatibility schema pool.
Deprecated: new walker code should not use a separate schema pool. Schema descendants are walked inline before cache publication.
func (*SchemaWalkPool) DrainAndShutdown
deprecated
func (p *SchemaWalkPool) DrainAndShutdown()
DrainAndShutdown waits for all work to complete, then shuts down.
Deprecated: retained only for source compatibility with SchemaWalkPool.
func (*SchemaWalkPool) IsIdle
deprecated
func (p *SchemaWalkPool) IsIdle() bool
IsIdle returns true if the pool has no work in progress.
Deprecated: retained only for source compatibility with SchemaWalkPool.
func (*SchemaWalkPool) Shutdown
deprecated
func (p *SchemaWalkPool) Shutdown()
Shutdown closes the work channel and waits for all workers to finish.
Deprecated: retained only for source compatibility with SchemaWalkPool.
func (*SchemaWalkPool) Submit
deprecated
func (p *SchemaWalkPool) Submit(sch *SchemaProxy, baseSchema *base.SchemaProxy, depth int) bool
Submit attempts to queue a schema for async walking.
Deprecated: new walker code should walk schema descendants inline.
func (*SchemaWalkPool) SubmitOrWalk
deprecated
func (p *SchemaWalkPool) SubmitOrWalk(sch *SchemaProxy, baseSchema *base.SchemaProxy, depth int)
SubmitOrWalk submits to the deprecated pool if possible, otherwise walks synchronously.
Deprecated: new walker code should walk schema descendants inline.
func (*SchemaWalkPool) WaitForCompletion
deprecated
func (p *SchemaWalkPool) WaitForCompletion()
WaitForCompletion blocks until all submitted work has completed.
Deprecated: retained only for source compatibility with SchemaWalkPool.
type SchemaWorkItem
deprecated
type SchemaWorkItem struct {
Schema *SchemaProxy
BaseSchema *base.SchemaProxy
Depth int
}
SchemaWorkItem represents a unit of work for schema walking.
Deprecated: schema descendants are now walked inline before schema cache publication. This type is retained only for source compatibility.
type SecurityRequirement ¶
type SecurityRequirement struct {
Value *base.SecurityRequirement
Foundation
}
func (*SecurityRequirement) GetValue ¶
func (s *SecurityRequirement) GetValue() any
func (*SecurityRequirement) Travel ¶
func (s *SecurityRequirement) Travel(ctx context.Context, tardis Tardis)
func (*SecurityRequirement) Walk ¶
func (s *SecurityRequirement) Walk(ctx context.Context, securityRequirement *base.SecurityRequirement)
type SecurityScheme ¶
type SecurityScheme struct {
Value *v3.SecurityScheme
Flows *OAuthFlows
Foundation
}
func (*SecurityScheme) GetSize ¶
func (s *SecurityScheme) GetSize() (height, width int)
func (*SecurityScheme) GetValue ¶
func (s *SecurityScheme) GetValue() any
func (*SecurityScheme) Walk ¶
func (s *SecurityScheme) Walk(ctx context.Context, securityScheme *v3.SecurityScheme)
type Server ¶
type Server struct {
Value *v3.Server
Variables *orderedmap.Map[string, *ServerVariable]
Foundation
}
type ServerVariable ¶
type ServerVariable struct {
Value *v3.ServerVariable
Foundation
}
func (*ServerVariable) GetValue ¶
func (sv *ServerVariable) GetValue() any
func (*ServerVariable) Travel ¶
func (sv *ServerVariable) Travel(ctx context.Context, traveler Tardis)
func (*ServerVariable) Walk ¶
func (sv *ServerVariable) Walk(ctx context.Context, serverVariable *v3.ServerVariable, key string)
type Tag ¶
type Tag struct {
Value *libopenapibase.Tag
ExternalDocs *ExternalDoc
Foundation
}
type Tardis ¶
type Tardis interface {
// Visit visit any object that implements the Companion interface
Visit(ctx context.Context, object any)
// GetDoctor will call the doctor, are you ready for him is the question.
GetDoctor() Doctor
}
Tardis is a visitor pattern interface. Used in combination with Companion
type WalkPool ¶
type WalkPool struct {
// contains filtered or unexported fields
}
WalkPool is a bounded worker pool for executing walk operations. This prevents goroutine explosion when processing large OpenAPI specs by limiting the number of concurrent walkers to a fixed pool size.
func NewWalkPool ¶
NewWalkPool creates a bounded pool with the specified number of workers. If workers <= 0, defaults to runtime.NumCPU() (one worker per core).
func (*WalkPool) DrainAndShutdown ¶
func (p *WalkPool) DrainAndShutdown()
DrainAndShutdown waits for all work to complete, then shuts down.
func (*WalkPool) InFlight ¶
InFlight returns the current number of work items being processed or queued.
func (*WalkPool) Shutdown ¶
func (p *WalkPool) Shutdown()
Shutdown closes the work channel and waits for all workers to finish.
func (*WalkPool) Submit ¶
Submit attempts to queue a function for async execution. Returns true if queued successfully. Returns false if the queue is full or pool is shutting down (caller should run sync).
func (*WalkPool) SubmitOrRun ¶
func (p *WalkPool) SubmitOrRun(fn func())
SubmitOrRun submits to the pool if possible, otherwise runs synchronously.
func (*WalkPool) WaitForCompletion ¶
func (p *WalkPool) WaitForCompletion()
WaitForCompletion blocks until all submitted work has completed. Uses sync.Cond for efficient blocking (no polling).
type WalkedHeader ¶
type WalkedMediaType ¶
type WalkedParam ¶
type WalkedSchema ¶
Source Files
¶
- callback.go
- components.go
- contact.go
- context.go
- convert_results.go
- discriminator.go
- document.go
- dynamic_value.go
- encoding.go
- example.go
- external_doc.go
- foundation.go
- header.go
- info.go
- license.go
- link.go
- lockstep.go
- media_type.go
- node_edge.go
- oauth_flow.go
- oauth_flows.go
- operation.go
- parameter.go
- path_item.go
- paths.go
- request_body.go
- response.go
- responses.go
- rule_results.go
- schema.go
- schema_cache.go
- schema_pool.go
- schema_proxy.go
- security_requirement.go
- security_scheme.go
- server.go
- server_variable.go
- tag.go
- tardis.go
- walk_pool.go
- xml.go