INNER CODE UNIT · Go

normalizeOpenAPIResponse

stacklok/toolhive · cmd/help/openapi-normalize/main.go:372

func normalizeOpenAPIResponse(operation map[string]any) error {
	responses, ok := object(operation["responses"])
	if !ok {
		return fmt.Errorf("OpenAPI specification operation has no responses")
	}
	response, ok := object(responses["200"])
	if !ok {
		return fmt.Errorf("OpenAPI specification operation has no 200 response")
	}
	content, ok := object(response["content"])
	if !ok {
		return fmt.Errorf("OpenAPI specification response has no content")
	}
	media, ok := object(content["application/json"])
	if !ok {
		return fmt.Errorf("OpenAPI specification response has no JSON content")
	}
	media["schema"] = map[string]any{"type": "object", "additionalProperties": true}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…