Skip to content

Commit

Permalink
small formatOutput clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvuka1 committed May 20, 2024
1 parent 1edfa3e commit 6d4b538
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 35 deletions.
52 changes: 25 additions & 27 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions src/formatOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ export const formatOutput = (
const matchesWithInconsistencies = failOutput
.flatMap(fail => {
if (fail.type !== 'match-with-inconsistenties') return [];
const inconsistencies = fail.inconsistencies
.map(i => {
const inconsistencies = [
`- | Inconsistency type | Open API specification <br /> [\`${fail.oasEndpoint.method.toUpperCase()} ${oasPathPartsToPath(fail.oasEndpoint.pathParts)}\`](${options.oasPath}) | Documentation <br /> [\`${fail.docEndpoint.method.toUpperCase()} ${fail.docEndpoint.originalPath}\`](${options.docPath}?plain=1#L${fail.docEndpoint.line}) |`,
'| --- | --- | --- |',
...fail.inconsistencies.map(i => {
switch (i.type) {
case 'method-mismatch':
return `| Method mismatch | \`${fail.oasEndpoint.method.toUpperCase()}\` | \`${fail.docEndpoint.method.toUpperCase()}\` |`;
Expand Down Expand Up @@ -87,13 +89,9 @@ export const formatOutput = (
'Doc scheme not supported by oas server not implemented',
);
}
})
.join('\n\t\t');
return [
`- | Inconsistency type | Open API specification <br /> [\`${fail.oasEndpoint.method.toUpperCase()} ${oasPathPartsToPath(fail.oasEndpoint.pathParts)}\`](${options.oasPath}) | Documentation <br /> [\`${fail.docEndpoint.method.toUpperCase()} ${fail.docEndpoint.originalPath}\`](${options.docPath}?plain=1#L${fail.docEndpoint.line}) |`,
'| --- | --- | --- |',
inconsistencies,
}),
].join('\n\t\t');
return inconsistencies;
})
.join('\n\t');

Expand Down

0 comments on commit 6d4b538

Please sign in to comment.