platformplatform / PlatformPlatform

Alpha state. A platform designed for building enterprise-grade, multi-tenant products using Azure, .NET, React, TypeScript, Infrastructure as Code, etc.
https://platformplatform.github.io
MIT License
253 stars 26 forks source link

Aggregate OpenAPI for all self-contained systems using Scalar #601

Closed tjementum closed 1 month ago

tjementum commented 1 month ago

Summary & Motivation

Aggregate OpenAPI specifications for all self-contained systems into a unified UI. Previously, each system had its own SwaggerUI, accessible only on internal endpoints and not in production. The YARP AppGateway now fetches OpenAPI.json from each self-contained system and combines them into a single OpenAPI contract.

With the upcoming removal of Swagger in .NET 9, the UI for the aggregated API uses Scalar, an open-source alternative (https://github.com/scalar/scalar), accessible at /openapi/v1.

Because self-contained systems can be deployed independently of the AppGateway, the aggregation cannot occur during AppGateway startup. Instead, the OpenAPI contracts are fetched dynamically from each system. For performance optimization, the contract is cached for 5 minutes using standard .NET output caching, which only impacts the UI. API updates are applied immediately upon deployment of the self-contained systems.

As part of the aggregation, all endpoints under /internal-api/ are removed since they are not publicly available.

Checklist

linear[bot] commented 1 month ago

PP-217 Aggregate OpenAPI endpoints for all self-contained systems

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
2.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud