package sortref
import "github.com/go-openapi/analysis/internal/flatten/sortref"
Index ¶
- func DepthFirst(in interface{}) []string
- func ReverseIndex(schemas map[string]spec.Ref, basePath string) map[string]RefRevIdx
- func TopmostFirst(refs []string) []string
- type Key
- type Keys
- type PartAdder
- type RefRevIdx
- type SplitKey
- func KeyParts(key string) SplitKey
- func (s SplitKey) BuildName(segments []string, startIndex int, adder PartAdder) string
- func (s SplitKey) DefinitionName() string
- func (s SplitKey) IsDefaultResponse() bool
- func (s SplitKey) IsDefinition() bool
- func (s SplitKey) IsOperation() bool
- func (s SplitKey) IsOperationParam() bool
- func (s SplitKey) IsOperationResponse() bool
- func (s SplitKey) IsSharedOperationParam() bool
- func (s SplitKey) IsSharedParam() bool
- func (s SplitKey) IsSharedResponse() bool
- func (s SplitKey) IsStatusCodeResponse() bool
- func (s SplitKey) PathItemRef() spec.Ref
- func (s SplitKey) PathRef() spec.Ref
- func (s SplitKey) ResponseName() string
Functions ¶
func DepthFirst ¶
func DepthFirst(in interface{}) []string
DepthFirst sorts a map of anything. It groups keys by category (shared params, op param, statuscode response, default response, definitions) sort groups internally by number of parts in the key and lexical names flatten groups into a single list of keys
func ReverseIndex ¶
ReverseIndex builds a reverse index for references in schemas
func TopmostFirst ¶
TopmostFirst sorts references by depth
Types ¶
type Key ¶
Key represent a key item constructed from /-separated segments
type Keys ¶
type Keys []Key
Keys is a sortable collable collection of Keys
func (Keys) Len ¶
func (Keys) Less ¶
func (Keys) Swap ¶
type PartAdder ¶
PartAdder know how to construct the components of a new name
type RefRevIdx ¶
RefRevIdx is a reverse index for references
type SplitKey ¶
type SplitKey []string
SplitKey holds of the parts of a /-separated key, so that their location may be determined.
func KeyParts ¶
KeyParts construct a SplitKey with all its /-separated segments decomposed. It is sortable.
func (SplitKey) BuildName ¶
BuildName builds a name from segments
func (SplitKey) DefinitionName ¶
DefinitionName yields the name of the definition
func (SplitKey) IsDefaultResponse ¶
IsDefaultResponse is true when the split key is the default response for an operation
func (SplitKey) IsDefinition ¶
IsDefinition is true when the split key is in the #/definitions section of a spec
func (SplitKey) IsOperation ¶
IsOperation is true when the split key is in the operations section
func (SplitKey) IsOperationParam ¶
IsOperationParam is true when the split key is in the parameters section of an operation
func (SplitKey) IsOperationResponse ¶
IsOperationResponse is true when the split key is in the responses section of an operation
func (SplitKey) IsSharedOperationParam ¶
IsSharedOperationParam is true when the split key is in the parameters section of a path
func (SplitKey) IsSharedParam ¶
IsSharedParam is true when the split key is in the #/parameters section of a spec
func (SplitKey) IsSharedResponse ¶
IsSharedResponse is true when the split key is in the #/responses section of a spec
func (SplitKey) IsStatusCodeResponse ¶
IsStatusCodeResponse is true when the split key is an operation response with a status code
func (SplitKey) PathItemRef ¶
PathItemRef constructs a $ref object from a split key of the form /{path}/{method}
func (SplitKey) PathRef ¶
PathRef constructs a $ref object from a split key of the form /paths/{reference}
func (SplitKey) ResponseName ¶
ResponseName yields either the status code or "Default" for a response
Source Files ¶
- Version
- v0.23.0 (latest)
- Published
- Mar 9, 2024
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 5 days ago –
Tools for package owners.