Skip to content

Commit

Permalink
remove api schemas and render type at top level and skip under proper…
Browse files Browse the repository at this point in the history
…ties section
  • Loading branch information
TheJuanAndOnly99 committed Apr 11, 2024
1 parent 2f8bd00 commit 1950f73
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions schema2Markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function processProperty(propertyName, propertyDetails, schemaExamples, required
//skip rendering the type property as it should be rendered at the top level
return markdownContent;
}
markdownContent += `### ${\`${propertyName}\`}\n\n`;
markdownContent += `### \`${propertyName}\`}\n\n`;
if (required) { markdownContent += `**(required)**\n`; }

if (propertyDetails.description != null) {
Expand Down Expand Up @@ -118,16 +118,19 @@ function generateObjectMD(schema, title, schemaFolderName, filePath, version) {
}

const properties = root.properties;
const required = root.required;
const typeString = properties?.type?.const;
const ref = root.$ref;


markdownContent += `## Type\n\n`;
markdownContent += `\`${typeString}\`\n\n`;
markdownContent += `## Properties\n\n`;

for (const [propertyName, propertyDetails] of Object.entries(properties)) {
markdownContent += processProperty(propertyName, propertyDetails, schema.examples, required.includes(propertyName));
if (propertyName != "type"){
markdownContent += processProperty(propertyName, propertyDetails, schema.examples);
}
}


if (ref) {
markdownContent += `ref: ${ref}\n\n`;
}
Expand Down Expand Up @@ -163,7 +166,7 @@ function generateObjectMD(schema, title, schemaFolderName, filePath, version) {
}

function escape(text) {
return text.replace(/>/g, '\\>').replace(/@experimental/g, '[@experiemental](/docs/fdc3-compliance#experimental-features)';
return text.replace(/>/g, '\\>').replace(/@experimental/g, '[@experiemental](/docs/fdc3-compliance#experimental-features)');
}

function generateFrontMatter(title, description) {
Expand Down Expand Up @@ -222,14 +225,6 @@ function main() {
"items": []
}

let sidebarApiObject = {
"type": "category",
"label": "API Schemas Part",
"items": []
}

sidebarContextObject.items = parseSchemaFolder('context', version);

if (sidebarObject.docs["FDC3 Standard"] == null) {
sidebarObject.docs["FDC3 Standard"] = [];
}
Expand Down

0 comments on commit 1950f73

Please sign in to comment.