Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions v2/api-validator/make-unified-openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion v2/openapi/fb-unified-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down