gopher

package
v0.0.47 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitPath

func SplitPath(path string, base string) []string

SplitPath splits the path into components, handling URLs and file paths

Types

type CategoryStatistic

type CategoryStatistic struct {
	ID           uint      `gorm:"primaryKey" json:"-" yaml:"-"`
	CreatedAt    time.Time `json:"-" yaml:"-"`
	UpdatedAt    time.Time `json:"-" yaml:"-"`
	CategoryName string    `json:"categoryName" yaml:"categoryName"`
	CategoryId   string    `json:"categoryId" yaml:"categoryId"`
	NumIssues    int       `json:"numIssues" yaml:"numIssues"`
	Score        int       `json:"score" yaml:"score"`
	Warnings     int       `json:"warnings" yaml:"warnings"`
	Errors       int       `json:"errors" yaml:"errors"`
	Info         int       `json:"info" yaml:"info"`
	Hints        int       `json:"hints" yaml:"hints"`
}

CategoryStatistic represents the number of issues for a particular category

type Gopher

type Gopher struct {
	DrDocument *model.DrDocument
	// contains filtered or unexported fields
}

func NewGopher

func NewGopher(drDoc *model.DrDocument) *Gopher

func (*Gopher) CreateRolodexTree

func (g *Gopher) CreateRolodexTree() *RolodexTree

type Node

type Node struct {
	Children    map[string]*Node
	FullPath    string
	IsRoot      bool
	Parent      *Node
	StringValue string
	Id          string
	NumericId   int
	IsOpenApi   bool
	IsFile      bool
	Index       *index.SpecIndex
	Statistics  *ReportStatistics
	// contains filtered or unexported fields
}

func (*Node) AddChild

func (n *Node) AddChild(value string, content string, fullPath string) *Node

AddChild adds a new child node with the given value

func (*Node) Cleanup

func (n *Node) Cleanup()

func (*Node) FindChild

func (n *Node) FindChild(value string) *Node

FindChild searches for a child node with the given value

func (*Node) FlattenTree

func (n *Node) FlattenTree(nodes *[]*Node)

FlattenTree recursively collects all nodes into a flat slice

func (*Node) GetString

func (n *Node) GetString() string

func (*Node) MarshalJSON

func (n *Node) MarshalJSON() ([]byte, error)

func (*Node) SetContent

func (n *Node) SetContent(content string) string

func (*Node) SetShowContent

func (n *Node) SetShowContent(show bool)

func (*Node) SortChildren

func (n *Node) SortChildren() []*Node

SortChildren returns a slice of child nodes sorted by StringValue alphabetically

type ReportStatistics

type ReportStatistics struct {
	ID                 uint                 `gorm:"primaryKey" json:"-" yaml:"-"`
	CreatedAt          time.Time            `json:"-" yaml:"-"`
	UpdatedAt          time.Time            `json:"-" yaml:"-"`
	FilesizeKB         int                  `json:"filesizeKb,omitempty" yaml:"filesizeKb,omitempty"`
	FilesizeBytes      int                  `json:"filesizeBytes,omitempty" yaml:"filesizeBytes,omitempty"`
	SpecType           string               `json:"specType,omitempty" yaml:"specType,omitempty"`
	SpecFormat         string               `json:"specFormat,omitempty" yaml:"specFormat,omitempty"`
	Version            string               `json:"version,omitempty" yaml:"version,omitempty"`
	References         int                  `json:"references,omitempty" yaml:"references,omitempty"`
	ExternalDocs       int                  `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
	Schemas            int                  `json:"schemas,omitempty" yaml:"schemas,omitempty"`
	Parameters         int                  `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Links              int                  `json:"links,omitempty" yaml:"links,omitempty"`
	Paths              int                  `json:"paths,omitempty" yaml:"paths,omitempty"`
	Operations         int                  `json:"operations,omitempty" yaml:"operations,omitempty"`
	Tags               int                  `json:"tags,omitempty" yaml:"tags,omitempty"`
	Examples           int                  `json:"examples,omitempty" yaml:"examples,omitempty"`
	Enums              int                  `json:"enums,omitempty" yaml:"enums,omitempty"`
	Security           int                  `json:"security,omitempty" yaml:"security,omitempty"`
	OverallScore       int                  `json:"overallScore,omitempty" yaml:"overallScore,omitempty"`
	TotalErrors        int                  `json:"totalErrors,omitempty" yaml:"totalErrors,omitempty"`
	TotalWarnings      int                  `json:"totalWarnings,omitempty" yaml:"totalWarnings,omitempty"`
	TotalInfo          int                  `json:"totalInfo,omitempty" yaml:"totalInfo,omitempty"`
	TotalHints         int                  `json:"totalHints,omitempty" yaml:"totalHints,omitempty"`
	CategoryStatistics []*CategoryStatistic `gorm:"foreignKey:ID" json:"categoryStatistics,omitempty" yaml:"categoryStatistics,omitempty"`
}

ReportStatistics represents statistics for an individual specification report.

type RolodexTree

type RolodexTree struct {
	Root     *Node
	Children []*Node
	Rolodex  *index.Rolodex
	// contains filtered or unexported fields
}

func NewRolodexTree

func NewRolodexTree(rolodex *index.Rolodex) *RolodexTree

func (*RolodexTree) BuildTree

func (rt *RolodexTree) BuildTree(base string, baseUrl string) *Node

BuildTree constructs the tree from the given paths

func (*RolodexTree) Cleanup

func (rt *RolodexTree) Cleanup()

func (*RolodexTree) GetRoot

func (rt *RolodexTree) GetRoot() *Node

func (*RolodexTree) SearchForNode

func (rt *RolodexTree) SearchForNode(nodeId string) (*Node, bool)

func (*RolodexTree) SearchForNodeByPath

func (rt *RolodexTree) SearchForNodeByPath(path string) (*Node, bool)

Jump to

Keyboard shortcuts

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