INNER CODE UNIT · Go
normalizeOperations
stacklok/toolhive · cmd/help/openapi-normalize/main.go:321
func normalizeOperations(document map[string]any) error {
paths, ok := object(document["paths"])
if !ok {
return fmt.Errorf("OpenAPI document has no paths object")
}
seen := make(map[string]string)
encountered := make(map[string]bool, len(operationIDs))
for path, pathItem := range paths {
item, ok := object(pathItem)
if !ok {
return fmt.Errorf("path %q is not an object", path)
}
for method, operation := range item {
if !isHTTPMethod(method) {
continue
}
operation, ok := object(operation)
if !ok {