Versions in this module Expand all Collapse all v0 v0.16.2 Jun 10, 2024 Changes in this version + func GenerateCleanSpecConfigBaseURL(baseURL *url.URL, dir string, includeFile bool) string + func HumanFileSize(size float64) string + func Round(val float64, roundOn float64, places int) (newVal float64) + type CanBeIndexed interface + Index func(config *SpecIndexConfig) (*SpecIndex, error) + type CircularReferenceResult struct + IsArrayResult bool + IsInfiniteLoop bool + IsPolymorphicResult bool + Journey []*Reference + LoopIndex int + LoopPoint *Reference + ParentNode *yaml.Node + PolymorphicType string + Start *Reference + func (c *CircularReferenceResult) GenerateJourneyPath() string + type ContextKey string + const CurrentPathKey + const FoundIndexKey + type DescriptionReference struct + Content string + IsSummary bool + KeyNode *yaml.Node + Node *yaml.Node + ParentNode *yaml.Node + Path string + type EnumReference struct + KeyNode *yaml.Node + Node *yaml.Node + ParentNode *yaml.Node + Path string + SchemaNode *yaml.Node + Type *yaml.Node + type ExternalLookupFunction func(id string) (foundNode *yaml.Node, rootNode *yaml.Node, lookupError error) + type ExtractedRef struct + Location string + Type RefType + func (r *ExtractedRef) GetFile() string + func (r *ExtractedRef) GetReference() string + type FileExtension int + const JSON + const UNSUPPORTED + const YAML + func ExtractFileType(ref string) FileExtension + type IndexingError struct + Err error + KeyNode *yaml.Node + Node *yaml.Node + Path string + func (i *IndexingError) Error() string + type LocalFS struct + Files syncmap.Map + func NewLocalFSWithConfig(config *LocalFSConfig) (*LocalFS, error) + func (l *LocalFS) GetErrors() []error + func (l *LocalFS) GetFiles() map[string]RolodexFile + func (l *LocalFS) Open(name string) (fs.File, error) + type LocalFSConfig struct + BaseDirectory string + DirFS fs.FS + FileFilters []string + IndexConfig *SpecIndexConfig + Logger *slog.Logger + type LocalFile struct + func (l *LocalFile) Close() error + func (l *LocalFile) FullPath() string + func (l *LocalFile) GetContent() string + func (l *LocalFile) GetContentAsYAMLNode() (*yaml.Node, error) + func (l *LocalFile) GetErrors() []error + func (l *LocalFile) GetFileExtension() FileExtension + func (l *LocalFile) GetFullPath() string + func (l *LocalFile) GetIndex() *SpecIndex + func (l *LocalFile) Index(config *SpecIndexConfig) (*SpecIndex, error) + func (l *LocalFile) IsDir() bool + func (l *LocalFile) ModTime() time.Time + func (l *LocalFile) Mode() fs.FileMode + func (l *LocalFile) Name() string + func (l *LocalFile) Read(b []byte) (int, error) + func (l *LocalFile) Size() int64 + func (l *LocalFile) Stat() (fs.FileInfo, error) + func (l *LocalFile) Sys() interface{} + type NodeOrigin struct + AbsoluteLocation string + Column int + Index *SpecIndex + Line int + Node *yaml.Node + type ObjectReference struct + KeyNode *yaml.Node + Node *yaml.Node + ParentNode *yaml.Node + Path string + type RefType int + const File + const HTTP + const Local + type Reference struct + Circular bool + Definition string + FullDefinition string + Index *SpecIndex + IsRemote bool + KeyNode *yaml.Node + Name string + Node *yaml.Node + ParentNode *yaml.Node + ParentNodeSchemaType string + ParentNodeTypes []string + Path string + RemoteLocation string + RequiredRefProperties map[string][]string + Resolved bool + Seen bool + func FindComponent(root *yaml.Node, componentId, absoluteFilePath string, index *SpecIndex) *Reference + type ReferenceMapped struct + Definition string + FullDefinition string + OriginalReference *Reference + Reference *Reference + type RemoteFS struct + FetchChannel chan *RemoteFile + FetchTime int64 + Files syncmap.Map + ProcessingFiles syncmap.Map + RemoteHandlerFunc utils.RemoteURLHandler + func NewRemoteFSWithConfig(specIndexConfig *SpecIndexConfig) (*RemoteFS, error) + func NewRemoteFSWithRootURL(rootURL string) (*RemoteFS, error) + func (i *RemoteFS) GetErrors() []error + func (i *RemoteFS) GetFiles() map[string]RolodexFile + func (i *RemoteFS) Open(remoteURL string) (fs.File, error) + func (i *RemoteFS) SetIndexConfig(config *SpecIndexConfig) + func (i *RemoteFS) SetRemoteHandlerFunc(handlerFunc utils.RemoteURLHandler) + type RemoteFile struct + URL *url.URL + func (f *RemoteFile) Close() error + func (f *RemoteFile) GetContent() string + func (f *RemoteFile) GetContentAsYAMLNode() (*yaml.Node, error) + func (f *RemoteFile) GetErrors() []error + func (f *RemoteFile) GetFileExtension() FileExtension + func (f *RemoteFile) GetFileName() string + func (f *RemoteFile) GetFullPath() string + func (f *RemoteFile) GetIndex() *SpecIndex + func (f *RemoteFile) GetLastModified() time.Time + func (f *RemoteFile) Index(config *SpecIndexConfig) (*SpecIndex, error) + func (f *RemoteFile) IsDir() bool + func (f *RemoteFile) ModTime() time.Time + func (f *RemoteFile) Mode() fs.FileMode + func (f *RemoteFile) Name() string + func (f *RemoteFile) Read(b []byte) (int, error) + func (f *RemoteFile) Size() int64 + func (f *RemoteFile) Stat() (fs.FileInfo, error) + func (f *RemoteFile) Sys() interface{} + type Resolver struct + IgnoreArray bool + IgnorePoly bool + func NewResolver(index *SpecIndex) *Resolver + func (resolver *Resolver) CheckForCircularReferences() []*ResolvingError + func (resolver *Resolver) GetCircularReferences() []*CircularReferenceResult + func (resolver *Resolver) GetIgnoredCircularArrayReferences() []*CircularReferenceResult + func (resolver *Resolver) GetIgnoredCircularPolyReferences() []*CircularReferenceResult + func (resolver *Resolver) GetIndexesVisited() int + func (resolver *Resolver) GetInfiniteCircularReferences() []*CircularReferenceResult + func (resolver *Resolver) GetJourneysTaken() int + func (resolver *Resolver) GetNonPolymorphicCircularErrors() []*CircularReferenceResult + func (resolver *Resolver) GetPolymorphicCircularErrors() []*CircularReferenceResult + func (resolver *Resolver) GetReferenceVisited() int + func (resolver *Resolver) GetRelativesSeen() int + func (resolver *Resolver) GetResolvingErrors() []*ResolvingError + func (resolver *Resolver) GetSafeCircularReferences() []*CircularReferenceResult + func (resolver *Resolver) IgnoreArrayCircularReferences() + func (resolver *Resolver) IgnorePolymorphicCircularReferences() + func (resolver *Resolver) Resolve() []*ResolvingError + func (resolver *Resolver) ResolvePendingNodes() + func (resolver *Resolver) VisitReference(ref *Reference, seen map[string]bool, journey []*Reference, resolve bool) []*yaml.Node + type ResolvingError struct + CircularReference *CircularReferenceResult + ErrorRef error + Node *yaml.Node + Path string + func (r *ResolvingError) Error() string + type Rolodex struct + func NewRolodex(indexConfig *SpecIndexConfig) *Rolodex + func (r *Rolodex) AddExternalIndex(idx *SpecIndex, location string) + func (r *Rolodex) AddIndex(idx *SpecIndex) + func (r *Rolodex) AddLocalFS(baseDir string, fileSystem fs.FS) + func (r *Rolodex) AddRemoteFS(baseURL string, fileSystem fs.FS) + func (r *Rolodex) BuildIndexes() + func (r *Rolodex) CheckForCircularReferences() + func (r *Rolodex) FindNodeOrigin(node *yaml.Node) *NodeOrigin + func (r *Rolodex) GetCaughtErrors() []error + func (r *Rolodex) GetIgnoredCircularReferences() []*CircularReferenceResult + func (r *Rolodex) GetIndexes() []*SpecIndex + func (r *Rolodex) GetIndexingDuration() time.Duration + func (r *Rolodex) GetRootIndex() *SpecIndex + func (r *Rolodex) GetRootNode() *yaml.Node + func (r *Rolodex) IndexTheRolodex() error + func (r *Rolodex) Open(location string) (RolodexFile, error) + func (r *Rolodex) Resolve() + func (r *Rolodex) RolodexFileSize() int64 + func (r *Rolodex) RolodexFileSizeAsString() string + func (r *Rolodex) RolodexTotalFiles() int + func (r *Rolodex) SetRootNode(node *yaml.Node) + type RolodexFS interface + GetFiles func() map[string]RolodexFile + Open func(name string) (fs.File, error) + type RolodexFile interface + GetContent func() string + GetContentAsYAMLNode func() (*yaml.Node, error) + GetErrors func() []error + GetFileExtension func() FileExtension + GetFullPath func() string + GetIndex func() *SpecIndex + IsDir func() bool + ModTime func() time.Time + Mode func() os.FileMode + Name func() string + Size func() int64 + Sys func() any + type SpecIndex struct + func NewSpecIndex(rootNode *yaml.Node) *SpecIndex + func NewSpecIndexWithConfig(rootNode *yaml.Node, config *SpecIndexConfig) *SpecIndex + func (index *SpecIndex) AllowCircularReferenceResolving() bool + func (index *SpecIndex) BuildIndex() + func (index *SpecIndex) ExtractComponentsFromRefs(refs []*Reference) []*Reference + func (index *SpecIndex) ExtractExternalDocuments(node *yaml.Node) []*Reference + func (index *SpecIndex) ExtractRefs(node, parent *yaml.Node, seenPath []string, level int, poly bool, pName string) []*Reference + func (index *SpecIndex) FindComponent(componentId string) *Reference + func (index *SpecIndex) FindComponentInRoot(componentId string) *Reference + func (index *SpecIndex) FindNodeOrigin(node *yaml.Node) *NodeOrigin + func (index *SpecIndex) GetAllCallbacks() map[string]*Reference + func (index *SpecIndex) GetAllCombinedReferences() map[string]*Reference + func (index *SpecIndex) GetAllComponentSchemas() map[string]*Reference + func (index *SpecIndex) GetAllDescriptions() []*DescriptionReference + func (index *SpecIndex) GetAllDescriptionsCount() int + func (index *SpecIndex) GetAllEnums() []*EnumReference + func (index *SpecIndex) GetAllExamples() map[string]*Reference + func (index *SpecIndex) GetAllExternalDocuments() map[string]*Reference + func (index *SpecIndex) GetAllHeaders() map[string]*Reference + func (index *SpecIndex) GetAllInlineSchemaObjects() []*Reference + func (index *SpecIndex) GetAllInlineSchemas() []*Reference + func (index *SpecIndex) GetAllLinks() map[string]*Reference + func (index *SpecIndex) GetAllObjectsWithProperties() []*ObjectReference + func (index *SpecIndex) GetAllOperationsServers() map[string]map[string][]*Reference + func (index *SpecIndex) GetAllParameters() map[string]*Reference + func (index *SpecIndex) GetAllParametersFromOperations() map[string]map[string]map[string][]*Reference + func (index *SpecIndex) GetAllPaths() map[string]map[string]*Reference + func (index *SpecIndex) GetAllReferenceSchemas() []*Reference + func (index *SpecIndex) GetAllReferences() map[string]*Reference + func (index *SpecIndex) GetAllRequestBodies() map[string]*Reference + func (index *SpecIndex) GetAllResponses() map[string]*Reference + func (index *SpecIndex) GetAllRootServers() []*Reference + func (index *SpecIndex) GetAllSchemas() []*Reference + func (index *SpecIndex) GetAllSecuritySchemes() map[string]*Reference + func (index *SpecIndex) GetAllSequencedReferences() []*Reference + func (index *SpecIndex) GetAllSummaries() []*DescriptionReference + func (index *SpecIndex) GetAllSummariesCount() int + func (index *SpecIndex) GetCache() *syncmap.Map + func (index *SpecIndex) GetCircularReferences() []*CircularReferenceResult + func (index *SpecIndex) GetComponentParameterCount() int + func (index *SpecIndex) GetComponentSchemaCount() int + func (index *SpecIndex) GetConfig() *SpecIndexConfig + func (index *SpecIndex) GetDiscoveredReferences() map[string]*Reference + func (index *SpecIndex) GetGlobalCallbacksCount() int + func (index *SpecIndex) GetGlobalLinksCount() int + func (index *SpecIndex) GetGlobalTagsCount() int + func (index *SpecIndex) GetGlobalTagsNode() *yaml.Node + func (index *SpecIndex) GetIgnoredArrayCircularReferences() []*CircularReferenceResult + func (index *SpecIndex) GetIgnoredPolymorphicCircularReferences() []*CircularReferenceResult + func (index *SpecIndex) GetInlineDuplicateParamCount() int + func (index *SpecIndex) GetInlineOperationDuplicateParameters() map[string][]*Reference + func (index *SpecIndex) GetInlineUniqueParamCount() int + func (index *SpecIndex) GetLinesWithReferences() map[int]bool + func (index *SpecIndex) GetLogger() *slog.Logger + func (index *SpecIndex) GetMappedReferences() map[string]*Reference + func (index *SpecIndex) GetMappedReferencesSequenced() []*ReferenceMapped + func (index *SpecIndex) GetNode(line int, column int) (*yaml.Node, bool) + func (index *SpecIndex) GetNodeMap() map[int]map[int]*yaml.Node + func (index *SpecIndex) GetOperationCount() int + func (index *SpecIndex) GetOperationParameterReferences() map[string]map[string]map[string][]*Reference + func (index *SpecIndex) GetOperationParametersIndexErrors() []error + func (index *SpecIndex) GetOperationTags() map[string]map[string][]*Reference + func (index *SpecIndex) GetOperationTagsCount() int + func (index *SpecIndex) GetOperationsParameterCount() int + func (index *SpecIndex) GetParametersNode() *yaml.Node + func (index *SpecIndex) GetPathCount() int + func (index *SpecIndex) GetPathsNode() *yaml.Node + func (index *SpecIndex) GetPolyAllOfReferences() []*Reference + func (index *SpecIndex) GetPolyAnyOfReferences() []*Reference + func (index *SpecIndex) GetPolyOneOfReferences() []*Reference + func (index *SpecIndex) GetPolyReferences() map[string]*Reference + func (index *SpecIndex) GetRawReferenceCount() int + func (index *SpecIndex) GetRawReferencesSequenced() []*Reference + func (index *SpecIndex) GetReferenceIndexErrors() []error + func (index *SpecIndex) GetReferencesWithSiblings() map[string]Reference + func (index *SpecIndex) GetRefsByLine() map[string]map[int]bool + func (index *SpecIndex) GetResolver() *Resolver + func (index *SpecIndex) GetRolodex() *Rolodex + func (index *SpecIndex) GetRootNode() *yaml.Node + func (index *SpecIndex) GetRootSecurityNode() *yaml.Node + func (index *SpecIndex) GetRootSecurityReferences() []*Reference + func (index *SpecIndex) GetRootServersNode() *yaml.Node + func (index *SpecIndex) GetSchemasNode() *yaml.Node + func (index *SpecIndex) GetSecurityRequirementReferences() map[string]map[string][]*Reference + func (index *SpecIndex) GetSpecAbsolutePath() string + func (index *SpecIndex) GetTotalTagsCount() int + func (index *SpecIndex) MapNodes(rootNode *yaml.Node) + func (index *SpecIndex) SearchIndexForReference(ref string) (*Reference, *SpecIndex) + func (index *SpecIndex) SearchIndexForReferenceByReference(fullRef *Reference) (*Reference, *SpecIndex) + func (index *SpecIndex) SearchIndexForReferenceByReferenceWithContext(ctx context.Context, searchRef *Reference) (*Reference, *SpecIndex, context.Context) + func (index *SpecIndex) SearchIndexForReferenceWithContext(ctx context.Context, ref string) (*Reference, *SpecIndex, context.Context) + func (index *SpecIndex) SetAbsolutePath(absolutePath string) + func (index *SpecIndex) SetAllowCircularReferenceResolving(allow bool) + func (index *SpecIndex) SetCache(sync *syncmap.Map) + func (index *SpecIndex) SetCircularReferences(refs []*CircularReferenceResult) + func (index *SpecIndex) SetIgnoredArrayCircularReferences(refs []*CircularReferenceResult) + func (index *SpecIndex) SetIgnoredPolymorphicCircularReferences(refs []*CircularReferenceResult) + type SpecIndexConfig struct + AllowFileLookup bool + AllowRemoteLookup bool + AvoidBuildIndex bool + AvoidCircularReferenceCheck bool + BasePath string + BaseURL *url.URL + ExtractRefsSequentially bool + FSHandler fs.FS + IgnoreArrayCircularReferences bool + IgnorePolymorphicCircularReferences bool + Logger *slog.Logger + RemoteURLHandler func(url string) (*http.Response, error) + Rolodex *Rolodex + SkipDocumentCheck bool + SpecAbsolutePath string + SpecInfo *datamodel.SpecInfo + func CreateClosedAPIIndexConfig() *SpecIndexConfig + func CreateOpenAPIIndexConfig() *SpecIndexConfig