Documentation
¶
Overview ¶
Package openapi provides search functionality over a pre-processed Microsoft Graph OpenAPI index.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFTSDatabase ¶ added in v1.0.14
func BuildFTSDatabase(endpoints []FullEndpoint, dbPath string) error
BuildFTSDatabase creates a SQLite FTS5 database from the full endpoint data extracted from the OpenAPI spec. The database contains both a content table (for returning results) and an FTS5 virtual table (for full-text search with Porter stemming).
func FormatFTSResults ¶ added in v1.0.14
func FormatFTSResults(results []FTSSearchResult) interface{}
FormatFTSResults converts a slice of FTSSearchResult into the standard JSON output format.
Types ¶
type Endpoint ¶
type Endpoint struct {
Path string `json:"path"`
Method string `json:"method"`
Summary string `json:"summary"`
Description string `json:"description,omitempty"`
Scopes []string `json:"scopes,omitempty"`
Resource string `json:"resource,omitempty"` // e.g. "users", "groups", "messages"
}
Endpoint represents a single API endpoint in the index.
type FTSIndex ¶ added in v1.0.14
type FTSIndex struct {
// contains filtered or unexported fields
}
FTSIndex provides full-text search over a SQLite FTS5 database containing OpenAPI endpoint data.
func LoadFTSIndex ¶ added in v1.0.14
LoadFTSIndex opens a SQLite FTS database for searching. Callers must call Close() when done.
type FTSSearchResult ¶ added in v1.0.14
type FTSSearchResult struct {
Path string `json:"path"`
Method string `json:"method"`
OperationID string `json:"operationId,omitempty"`
Summary string `json:"summary"`
Description string `json:"description,omitempty"`
Resource string `json:"resource,omitempty"`
PathDescription string `json:"pathDescription,omitempty"`
Tags string `json:"tags,omitempty"`
Scopes string `json:"scopes,omitempty"`
Deprecated bool `json:"deprecated,omitempty"`
DocURL string `json:"docUrl,omitempty"`
OperationType string `json:"operationType,omitempty"`
Pageable bool `json:"pageable,omitempty"`
Parameters string `json:"parameters,omitempty"`
RequestBodyRef string `json:"requestBodyRef,omitempty"`
RequestBodyDesc string `json:"requestBodyDesc,omitempty"`
ResponseRef string `json:"responseRef,omitempty"`
MatchReason string `json:"matchReason"`
Score float64 `json:"score,omitempty"`
}
FTSSearchResult contains a search result with all available fields.
func (*FTSSearchResult) SearchResultCompat ¶ added in v1.0.14
func (r *FTSSearchResult) SearchResultCompat() SearchResult
SearchResultCompat converts an FTSSearchResult to the legacy SearchResult format for backward compatibility with the JSON output format.
func (*FTSSearchResult) ToOutputMap ¶ added in v1.0.14
func (r *FTSSearchResult) ToOutputMap() map[string]interface{}
ToOutputMap converts an FTSSearchResult to a map for JSON output, including all available fields. Empty fields are omitted.
type FullEndpoint ¶ added in v1.0.14
type FullEndpoint struct {
Path string `json:"path"`
Method string `json:"method"`
OperationID string `json:"operationId,omitempty"`
Summary string `json:"summary"`
Description string `json:"description,omitempty"`
Resource string `json:"resource,omitempty"`
Scopes []string `json:"scopes,omitempty"`
Tags []string `json:"tags,omitempty"`
// Documentation
DocURL string `json:"docUrl,omitempty"`
PathDescription string `json:"pathDescription,omitempty"`
// Deprecation
Deprecated bool `json:"deprecated,omitempty"`
DeprecationDate string `json:"deprecationDate,omitempty"`
DeprecationRemovalDate string `json:"deprecationRemovalDate,omitempty"`
DeprecationDescription string `json:"deprecationDescription,omitempty"`
// Operation metadata
OperationType string `json:"operationType,omitempty"` // operation, action, function
Pageable bool `json:"pageable,omitempty"`
// Parameters
Parameters []Parameter `json:"parameters,omitempty"`
// Request/Response schema references
RequestBodyRef string `json:"requestBodyRef,omitempty"`
RequestBodyDesc string `json:"requestBodyDesc,omitempty"`
ResponseRef string `json:"responseRef,omitempty"`
}
FullEndpoint contains all data extracted from the OpenAPI spec for a single operation, without truncation. This is the rich representation stored in the SQLite FTS database.
type Index ¶
type Index struct {
Endpoints []Endpoint `json:"endpoints"`
}
Index holds the full searchable OpenAPI index.
type Parameter ¶ added in v1.0.14
Parameter represents an API parameter extracted from the OpenAPI spec.
type SearchResult ¶
SearchResult wraps an endpoint with a relevance indicator.