diff --git a/v2/api-validator/make-unified-openapi.ts b/v2/api-validator/make-unified-openapi.ts index 474be0d4..c90eab04 100644 --- a/v2/api-validator/make-unified-openapi.ts +++ b/v2/api-validator/make-unified-openapi.ts @@ -6,6 +6,7 @@ import { dump as dumpYaml, load as loadYaml } from 'js-yaml'; const TARGET_OPENAPI_PATH = config.getUnifiedOpenApiPathname(); const IGNORE_PATH_LABEL = 'Private'; +const README_PLACEHOLDER = 'Placeholder for automatic documentation injection from README.md'; interface OpenAPI { openapi: string; @@ -97,6 +98,12 @@ async function makeUnifiedOpenApi() { console.log(`📦 Component [\x1b[33m ${extractServiceName(openApiPath)} \x1b[0m] added`); } + // Replace placeholder with README reference (same dir as unified spec) + const description = completeOpenAPI.info?.description; + if (typeof description === 'string' && description.trim() === README_PLACEHOLDER) { + completeOpenAPI.info.description = { $ref: 'README.md' }; + } + let resultYaml: string = dumpYaml(completeOpenAPI, { noRefs: true, noCompatMode: true, diff --git a/v2/openapi/fb-unified-openapi.yaml b/v2/openapi/fb-unified-openapi.yaml index 4679ae14..cd2bca15 100644 --- a/v2/openapi/fb-unified-openapi.yaml +++ b/v2/openapi/fb-unified-openapi.yaml @@ -14,7 +14,8 @@ info: license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html - description: Placeholder for automatic documentation injection from README.md + description: + $ref: README.md tags: - name: capabilities description: Server capabilities discovery operations.