Documentation
¶
Overview ¶
Package spec_ingester provides API specification parsing and knowledge graph building for ZAP.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GraphBuilder ¶
type GraphBuilder struct {
FalconDir string
}
GraphBuilder is responsible for transforming intermediate ParsedSpec into the final APIKnowledgeGraph used by Falcon.
func NewGraphBuilder ¶
func NewGraphBuilder(falconDir string) *GraphBuilder
func (*GraphBuilder) BuildGraph ¶
func (b *GraphBuilder) BuildGraph(spec *ParsedSpec, context shared.ProjectContext) (*shared.APIKnowledgeGraph, error)
BuildGraph takes parsing results and fuses them into a single graph.
func (*GraphBuilder) LoadGraph ¶
func (b *GraphBuilder) LoadGraph() (*shared.APIKnowledgeGraph, error)
LoadGraph loads the graph from .falcon/spec.yaml.
func (*GraphBuilder) SaveGraph ¶
func (b *GraphBuilder) SaveGraph(graph *shared.APIKnowledgeGraph) error
SaveGraph persists the graph to .falcon/spec.yaml (human-readable YAML).
type IngestParams ¶
type IngestParams struct {
Action string `json:"action"` // "index", "update", "status"
Source string `json:"source"` // file path or URL
}
IngestParams checks inputs for file path or URL
type IngestSpecTool ¶
type IngestSpecTool struct {
// contains filtered or unexported fields
}
IngestSpecTool provides commands to index API specifications
func NewIngestSpecTool ¶
func NewIngestSpecTool(llmClient llm.LLMClient, falconDir string) *IngestSpecTool
NewIngestSpecTool creates a new spec ingestion tool
func (*IngestSpecTool) Description ¶
func (t *IngestSpecTool) Description() string
func (*IngestSpecTool) Name ¶
func (t *IngestSpecTool) Name() string
func (*IngestSpecTool) Parameters ¶
func (t *IngestSpecTool) Parameters() string
type OpenAPIParser ¶
type OpenAPIParser struct{}
OpenAPIParser implements the SpecParser for OpenAPI 3.x and Swagger 2.0
func (*OpenAPIParser) DetectFormat ¶
func (p *OpenAPIParser) DetectFormat(content []byte) bool
func (*OpenAPIParser) Parse ¶
func (p *OpenAPIParser) Parse(content []byte) (*ParsedSpec, error)
type ParsedEndpoint ¶
type ParsedEndpoint struct {
Method string
Path string
Summary string
Description string
Parameters []ParsedParameter
// Simplified representation of request/response for initial indexing
HasBody bool
Responses []int
}
ParsedEndpoint represents a single API operation found in the spec
type ParsedParameter ¶
type ParsedSpec ¶
type ParsedSpec struct {
Format string // "openapi3", "swagger2", "postman2.1"
Version string
Endpoints []ParsedEndpoint
}
ParsedSpec is an intermediate representation of a parsed API spec
type PostmanParser ¶
type PostmanParser struct{}
PostmanParser implements the SpecParser for Postman Collections v2.1
func (*PostmanParser) DetectFormat ¶
func (p *PostmanParser) DetectFormat(content []byte) bool
func (*PostmanParser) Parse ¶
func (p *PostmanParser) Parse(content []byte) (*ParsedSpec, error)
type SpecParser ¶
type SpecParser interface {
// DetectFormat returns true if the parser can handle the given content
DetectFormat(content []byte) bool
// Parse converts the raw content into a unified APIKnowledgeGraph structure
// It basically extracts endpoints and models but returns them in a generic map first
// to be later processed by the GraphBuilder
Parse(content []byte) (*ParsedSpec, error)
}
SpecParser defines the interface for parsing API specifications