Documentation
¶
Index ¶
- func Ruleify(left, right *DrDocument)
- func SanitizeGraph(nodes []*drV3.Node, santizePaths []string)
- type DrConfig
- type DrDocument
- func (w *DrDocument) BuildGraphMap() map[int]string
- func (w *DrDocument) BuildObjectLocationMap() map[int]any
- func (w *DrDocument) GetIndex() *index.SpecIndex
- func (w *DrDocument) LocateModel(node *yaml.Node) ([]drV3.Foundational, error)
- func (w *DrDocument) LocateModelByLine(line int) ([]drV3.Foundational, error)
- func (w *DrDocument) LocateModelsByKeyAndValue(key, value *yaml.Node) ([]drV3.Foundational, error)
- func (d *DrDocument) Release()
- type GraphMode
- type GraphResponse
- type HasValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ruleify ¶
func Ruleify(left, right *DrDocument)
Ruleify efficiently copies rule results from a left document (contains RuleResults) to a right document (needs RuleResults) by matching nodes and transferring their rule results.
Parameters:
- left: The source DrDocument containing nodes with RuleResults
- right: The target DrDocument where RuleResults will be added
The function modifies the right document in-place.
func SanitizeGraph ¶
Types ¶
type DrDocument ¶
type DrDocument struct {
BuildErrors []*drV3.BuildError
Schemas []*drV3.Schema
SkippedSchemas []*drV3.Schema
Parameters []*drV3.Parameter
Headers []*drV3.Header
MediaTypes []*drV3.MediaType
V3Document *drV3.Document
Nodes []*drV3.Node
Edges []*drV3.Edge
StorageRoot string
// contains filtered or unexported fields
}
DrDocument is a turbocharged version of the libopenapi Document model. The doctor provides a much more powerful way to navigate an OpenAPI document.
DrDocument also absorbs results from vacuum rules, and allows them to be attached contextually to the models they represent.
The doctor is the library we wanted all along. The doctor is the library we deserve.
func NewDrDocument ¶
func NewDrDocument(document *libopenapi.DocumentModel[v3.Document]) *DrDocument
NewDrDocument Create a new DrDocument from an OpenAPI v3+ document
func NewDrDocumentAndGraph ¶
func NewDrDocumentAndGraph(document *libopenapi.DocumentModel[v3.Document]) *DrDocument
NewDrDocumentAndGraph Create a new DrDocument from an OpenAPI v3+ document, and create a graph of the model.
func NewDrDocumentWithConfig ¶
func NewDrDocumentWithConfig(document *libopenapi.DocumentModel[v3.Document], config *DrConfig) *DrDocument
NewDrDocumentWithConfig Create a new DrDocument from an OpenAPI v3+ document and a configuration struct
func (*DrDocument) BuildGraphMap ¶
func (w *DrDocument) BuildGraphMap() map[int]string
func (*DrDocument) BuildObjectLocationMap ¶
func (w *DrDocument) BuildObjectLocationMap() map[int]any
BuildObjectLocationMap builds a map of line numbers to models in the document.
func (*DrDocument) GetIndex ¶
func (w *DrDocument) GetIndex() *index.SpecIndex
func (*DrDocument) LocateModel ¶
func (w *DrDocument) LocateModel(node *yaml.Node) ([]drV3.Foundational, error)
LocateModel finds the model represented by the line number of the supplied node.
func (*DrDocument) LocateModelByLine ¶
func (w *DrDocument) LocateModelByLine(line int) ([]drV3.Foundational, error)
LocateModelByLine finds the model represented by the line number of the supplied node.
func (*DrDocument) LocateModelsByKeyAndValue ¶
func (w *DrDocument) LocateModelsByKeyAndValue(key, value *yaml.Node) ([]drV3.Foundational, error)
LocateModelsByKeyAndValue finds the model represented by the line number of the supplied node. This method will locate every model that points to the supplied key and value node. There could be many models that point to the same key and value node, so this method will return a slice of models.
func (*DrDocument) Release ¶ added in v0.0.48
func (d *DrDocument) Release()
Release nils all fields that can pin YAML node trees, SpecIndex maps, or libopenapi documents in memory. This includes unexported fields (index, lineObjects) that callers outside this package cannot reach directly. Call this once all serialization work is done with the DrDocument.
type GraphResponse ¶
type GraphResponse struct {
Mode GraphMode `json:"mode,omitempty"`
Nodes []interface{} `json:"nodes,omitempty"`
Edges []interface{} `json:"edges,omitempty"`
NodesRendered []interface{} `json:"nodesRendered,omitempty"`
NodeChangeTree *v3.Node `json:"nodeChangeTree,omitempty"`
Changes []*whatChangedModel.Change `json:"changes,omitempty"`
GraphMap map[int]string `json:"graphMap,omitempty"`
Stripped bool `json:"stripped,omitempty"`
StrippedCount int `json:"strippedCount,omitempty"`
FileUUID string `json:"graphId,omitempty"`
RevisionUUID string `json:"graphRevisionId,omitempty"`
}