{"openapi":"3.0.3","info":{"title":"OpenAPI 3.0 Flattener & RapidAPI Schema Cleaner API","description":"Sub-5ms Ultra-Fast OpenAPI 3.0/3.1 & Swagger 2.0 Pointer Dereferencer, Schema Flattener & RapidAPI Studio Compatibility Sanitizer. Inlines nested $ref, breaks circular cycles safely, and fixes OpenAPI 3.1 breaking changes.","version":"1.0.0","contact":{"name":"TopAISaaS API Engineering","url":"https://github.com/topaisaas-dev/openapi-flattener-api","email":"top.ai.saas@gmail.com"}},"servers":[{"url":"https://openapi-flattener.topaisaas.workers.dev","description":"Cloudflare Edge Production Server (Sub-5ms global latency)"}],"paths":{"/v1/flatten":{"post":{"summary":"Flatten & Dereference OpenAPI Spec","description":"Inlines all local $ref pointers, breaks circular dependencies safely, removes problematic meta fields, and converts OpenAPI 3.1 to 3.0 for RapidAPI Studio and Postman.","operationId":"flattenOpenApiSpec","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"spec":{"type":"object","description":"Raw OpenAPI 3.0/3.1 or Swagger 2.0 document as a JSON object."},"url":{"type":"string","format":"uri","description":"Optional public URL to fetch and flatten an OpenAPI JSON document directly."},"removeComponents":{"type":"boolean","default":true,"description":"Whether to strip redundant inlined components.schemas from the root."},"sanitizeForRapidAPI":{"type":"boolean","default":true,"description":"Whether to adapt OpenAPI 3.1 nullable constructs into 3.0 format for RapidAPI Studio."},"convertOpenAPI31to30":{"type":"boolean","default":true,"description":"Whether to declare openapi 3.0.3 to prevent RapidAPI parser rejection."}}},"example":{"spec":{"openapi":"3.1.0","info":{"title":"PetStore","version":"1.0.0"},"paths":{"/pets":{"get":{"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Pet"}}}}}}}}},"components":{"schemas":{"Pet":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}}}}}}}}},"responses":{"200":{"description":"Flattened and sanitized OpenAPI document","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"flattenedSpec":{"type":"object","description":"The 100% inlined OpenAPI document"},"stats":{"type":"object","properties":{"refsResolved":{"type":"integer"},"cyclesBroken":{"type":"integer"},"cleanedFields":{"type":"array","items":{"type":"string"}},"durationMs":{"type":"number"}}},"warnings":{"type":"array","items":{"type":"string"}},"errors":{"type":"array","items":{"type":"string"}}}}}}},"400":{"description":"Invalid input or empty specification","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/v1/validate":{"post":{"summary":"Audit Spec for RapidAPI Compatibility","description":"Analyzes an OpenAPI document against RapidAPI Studio import requirements. Detects unflattened $ref, OpenAPI 3.1 incompatibilities, and missing metadata.","operationId":"validateRapidApiCompatibility","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"spec":{"type":"object","description":"OpenAPI JSON document to audit."},"url":{"type":"string","format":"uri","description":"Optional URL of the spec to audit."}}}}}},"responses":{"200":{"description":"RapidAPI audit report and readiness score","content":{"application/json":{"schema":{"type":"object","properties":{"valid":{"type":"boolean"},"rapidApiCompatible":{"type":"boolean"},"score":{"type":"integer","description":"Score from 0 to 100"},"totalEndpoints":{"type":"integer"},"totalRefs":{"type":"integer"},"issues":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["error","warning","info"]},"path":{"type":"string"},"message":{"type":"string"},"rule":{"type":"string"}}}}}}}}}}}},"/v1/health":{"get":{"summary":"System Health & Engine Status","description":"Returns uptime, engine version and operational health of the flattener service.","operationId":"getHealthStatus","responses":{"200":{"description":"Service is operational","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"healthy"},"service":{"type":"string","example":"openapi-flattener-api"},"version":{"type":"string","example":"1.0.0"},"uptime":{"type":"number"},"edgeRegion":{"type":"string"}}}}}}}}}}}