mirror of https://github.com/OpenVidu/openvidu.git
4.0 KiB
4.0 KiB
Tasks
1. Backend: registry and generator
- 1.1 In
src/api/route-registry.ts, add: - a requiredoperationIdand an optionalrefreshCookie: 'required' | 'optional'toRouteDefinition; -edition?: EditiontoRouteResponse; -tag(name, description)and theeditiongetter toRouteRegistry.register()andreplace()reject a repeatedoperationIdand an undeclared tag. Verify withroute-registry.test.tscases for both rejections. - 1.2 In
src/api/openapi.ts, changeopenApiDocument(registry, { version, basePath, license? })to emit: -servers,info.description,info.licenseandtags(declared and used, in declaration order); -operationId; -400only with input,401forbearerandoptional-bearer, no automatic403; -ApiErroron every error without a schema; - responses filtered byedition; - theIf-None-Matchparameter on operations with304; - therefreshCookiesecurity scheme; and drop the dead locked-route description. Verify withroute-registry.test.tscases for each rule. - 1.3 In
src/lifecycle/startup.tsandsrc/index.ts, add the optionalDashboardOptions.apiLicenseand pass it, with the bound base path, to the document. Verify with the typecheck and theserverscase of 1.2.
2. Backend: parameters and routes
- 2.1 In
src/api/query.ts, describefrom,to,tz,limit,order,cursorandqat the parameter level (after.default()), withtogetting its own example. MakecsvParam()render as an array of its values withstyle: form,explode: false. Verify with a generator unit case on a ranged list query. - 2.2 In every
src/*/*-routes.tsandsrc/api/probes.ts: - declare the module's tags; - give each route itsoperationId; - describe every route-specific parameter; - render the other comma-separated parameters as arrays (features, egressstatus, analyticsmetricsanddimensions); - mark the analytics403asedition: 'ce'; - addrefreshCookieand theSet-Cookieheaders to the auth routes. Verify with the integration test of 3.1. - 2.3 In
src/ingress/ingress-responses.ts, makebyInputTypeaz.objectwithrtmp,whipandurl. Verify with the ingress response unit tests and the mapper checks. - 2.4 In
src/http/errors.ts, makeapiNotFoundname the path ofreq.originalUrl. Verify with the app unit test of the unknown API path, which asserts the message.
3. Tests and docs
- 3.1 Add the integration test
test/integration/openapi-document.test.ts. It boots the CE dashboard in development and reads/api/v1/docs/openapi.json, then asserts: - uniqueoperationIds; - every tag is declared with a description; - every parameter has a description; - every response ≥ 400 hasApiError; - no400on operations without input; - no403PRO_FEATUREoutside the analytics routes; -If-None-Matchwherever there is a304; - the refresh cookie scheme on refresh and logout; -serversandlicense. Verify that./dashboard.sh test-integrationpasses. - 3.2 Lint both a development document and the generated one with Redocly CLI (
recommended, scratch install, not a dependency). Expect no errors, and no warnings other than intentional ones recorded in this file. Verify by running it by hand once. Result: valid. The only warnings areoperation-4xx-responseongetHealth,getReadinessandlogout, which answer no 4xx by design. - 3.3 Update
dashboard-ce/backend/AGENTS.md(route declaration:operationId, tags throughregistry.tag, parameter descriptions, responseedition,refreshCookie), and add theCHANGELOG.mdline of the proposal. Verify that./dashboard.sh checkpasses.
Workflow follow-up
- Move
ce.refin openvidu-pro and document the PRO routes there (PRO change). - Archive when the owner asks.