Skip to content

Commit

Permalink
Update schema2Markdown.js
Browse files Browse the repository at this point in the history
Co-authored-by: Kris West <kris.west@interop.io>
  • Loading branch information
TheJuanAndOnly99 and kriswest authored Apr 11, 2024
1 parent 0b13c7a commit 2f8bd00
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions schema2Markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,18 @@ function generateObjectMD(schema, title, schemaFolderName, filePath, version) {
markdownContent += `ref: ${ref}\n\n`;
}

if (schema.examples) {
markdownContent += `## Examples\n\n`;
markdownContent += '```json\n';
markdownContent += JSON.stringify(schema.examples, null, 2);
markdownContent += '\n```\n\n';
if (schema.examples && schema.examples.length > 0) {
if (schema.examples.length > 1){
markdownContent += `## Examples\n\n`;
} else {
markdownContent += `## Example\n\n`;
}

schema.examples.forEach((example) => {
markdownContent += '```json\n';
markdownContent += JSON.stringify(example, null, 2);
markdownContent += '\n```\n\n';
});
}
const url = filePath.replace("schemas/", `https://github.com/finos/FDC3/tree/master/schemas/`);
markdownContent += `Generated from ${url}`;
Expand Down

0 comments on commit 2f8bd00

Please sign in to comment.