Documentation
¶
Index ¶
- func DeepCloneYAML(n *yaml.Node) *yaml.Node
- func FindYAMLReferences(docNode *yaml.Node, openAPIRoot *yaml.Node) (*yaml.Node, error)
- func GetChildNodeByJSONPath(root *yaml.Node, jsonPath string) (*yaml.Node, error)
- func GetChildNodeByJSONPathOrDefault(root *yaml.Node, jsonPath string, def *yaml.Node) (*yaml.Node, error)
- func GetChildNodesByJSONPath(root *yaml.Node, jsonPath string) ([]*yaml.Node, error)
- func InlineYAMLReferences(docNode *yaml.Node, rootDoc *yaml.Node) (*yaml.Node, error)
- func JSONPointerToJSONPath(refPath string) (string, error)
- func OAS3ToMCPValues(file string) (mcpValuesMap map[string]any, err error)
- func ResolveYAMLReference(refPath string, openAPIRoot *yaml.Node) (*yaml.Node, error)
- type AuthServerInfo
- type AuthorizationServer
- type OIDCAuthServerInfo
- type SecurityRequirement
- type Tool
- type ToolTarget
- type ValuesFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepCloneYAML ¶
DeepCloneYAML creates a full, recursive copy of a yaml.Node.
func FindYAMLReferences ¶
FindYAMLReferences uses a recursive approach combined with JSONPath to find all references starting from docNode, resolving nested $refs against the provided openAPIRoot (which contains the components/schemas section). It returns a single yaml.MappingNode containing the collected and rewritten schemas.
func GetChildNodeByJSONPath ¶
GetChildNodeByJSONPath finds a single YAML node within the root node using a JSONPath expression. If no node is found, it returns (nil, nil). If more than one node is found, it returns an error.
func GetChildNodeByJSONPathOrDefault ¶
func GetChildNodeByJSONPathOrDefault(root *yaml.Node, jsonPath string, def *yaml.Node) (*yaml.Node, error)
GetChildNodeByJSONPathOrDefault finds a single YAML node within the root node using a JSONPath expression. If no node is found, it returns the provided default node. If more than one node is found, it returns an error.
func GetChildNodesByJSONPath ¶
GetChildNodesByJSONPath finds all YAML nodes within the root node that match the given JSONPath expression.
func InlineYAMLReferences ¶
InlineYAMLReferences deep clones the document, then performs a single-pass recursive inlining of all references from rootDoc, ensuring no $refs remain and correctly handling cycles.
func JSONPointerToJSONPath ¶ added in v1.1.1
JSONPointerToJSONPath converts a JSON Pointer (like "#/a/b") to a JSONPath expression (like "$['a']['b']"). This correctly handles segments containing special characters like dots (e.g., "$['a.b']"). It also correctly unescapes JSON Pointer's ~0 and ~1 sequences.
Types ¶
type AuthServerInfo ¶
type AuthServerInfo struct {
AuthType string `yaml:"type"`
IssuerURL string `yaml:"issuer_url"`
AuthorizationURL string `yaml:"authorization_url,omitempty"`
TokenURL string `yaml:"token_url,omitempty"`
Scopes []string `yaml:"scopes"`
Flows []string `yaml:"flows"`
}
AuthServerInfo holds the consolidated information for a single OAuth2 authorization server.
func (*AuthServerInfo) Type ¶
func (a *AuthServerInfo) Type() string
type AuthorizationServer ¶
type AuthorizationServer interface {
Type() string
}
AuthorizationServer is an interface representing a generic authorization server.
func SelectAuthorizationServer ¶
func SelectAuthorizationServer(root *yaml.Node) (AuthorizationServer, error)
SelectAuthorizationServer finds the authorization server corresponding to the highest priority security requirement. The selection is prioritized: 1. A requirement defined at the top-level of the document. 2. The requirement that is used most frequently across all operations.
type OIDCAuthServerInfo ¶
type OIDCAuthServerInfo struct {
AuthType string `yaml:"type"`
IssuerURL string `yaml:"issuer_url"`
OpenIdConnectUrl string `yaml:"openIdConnectUrl"`
}
OIDCAuthServerInfo holds the consolidated information for a single OpenID Connect server.
func (*OIDCAuthServerInfo) Type ¶
func (o *OIDCAuthServerInfo) Type() string
type SecurityRequirement ¶
SecurityRequirement holds a security scheme name and the scopes required.
type ToolTarget ¶
type ToolTarget struct {
Verb string `yaml:"verb"`
PathSuffix string `yaml:"pathSuffix"`
ContentType string `yaml:"contentType"`
Accept string `yaml:"accept"`
QueryParams []string `yaml:"queryParams"`
HeaderParams []string `yaml:"headerParams"`
PathParams []string `yaml:"pathParams"`
PayloadParam string `yaml:"payloadParam"`
PayloadSchema *yaml.Node `yaml:"payloadSchema"`
ResponseSchema *yaml.Node `yaml:"responseSchema"`
}
type ValuesFile ¶
type ValuesFile struct {
ToolsList []*Tool `yaml:"tools_list"`
ToolsTargets map[string]*ToolTarget `yaml:"tools_targets"`
AuthServer AuthorizationServer `yaml:"auth_server"`
}