Skip to content

Commit

Permalink
fix: eol
Browse files Browse the repository at this point in the history
  • Loading branch information
v8tenko committed Feb 6, 2024
1 parent 09d3017 commit d4d0a99
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/includer/traverse/tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,17 @@ export function prepareTableRowData(
}

function prepareComplexDescription(baseDescription: string, value: OpenJSONSchema): string {
let description = baseDescription;
let description = baseDescription + EOL;

const enumValues = value.enum?.map((s) => `\`${s}\``).join(', ');

if (typeof enumValues !== 'undefined') {
description = concatNewLine(
description,
`<span style="color:gray;">Enum</span>: ${enumValues}`,
);
}

if (typeof value.default !== 'undefined') {
description = concatNewLine(
description,
Expand All @@ -216,6 +219,7 @@ function prepareComplexDescription(baseDescription: string, value: OpenJSONSchem
`<span style="color:gray;">Min length</span>: \`${value.minLength}\``,
);
}

if (typeof value.maxLength !== 'undefined') {
description = concatNewLine(
description,
Expand Down
7 changes: 5 additions & 2 deletions src/includer/ui/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ function table(data: any[][]) {
const [names, ...rest] = data;

/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
const colgen = (col: any) =>
Array.isArray(col) ? `${EOL}${table(col)}${EOL}` : escapeTableColContent(` ${col} `);
const colgen = (col: any) => {
const content = Array.isArray(col) ? table(col) : escapeTableColContent(` ${col} `);

return `${EOL}${content}${EOL}`
}
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
const rowgen = (row: any) => `||${row.map(colgen).join('|')}||`;

Expand Down

0 comments on commit d4d0a99

Please sign in to comment.