Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
Log a better warning when generating operation ID (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeguerin authored Dec 15, 2020
1 parent 2736459 commit 020c306
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions modelerfour/src/modeler/interpretations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,23 +306,16 @@ export class Interpretations {

// synthesize from tags.
if (original.tags && length(original.tags) > 0) {
switch (length(original.tags)) {
case 0:
break;
case 1:
this.session.warning(
`Generating 'operationId' for '${httpMethod}' operation on path '${path}' `,
["Interpretations"],
original,
);
return this.splitOpId(`${original.tags[0]}`);
}
const newOperationId = length(original.tags) === 1
? `${original.tags[0]}`
: `${original.tags[0]}_${original.tags[1]}`;

this.session.warning(
`Generating 'operationId' for '${httpMethod}' operation on path '${path}' `,
`Generating 'operationId' to '${newOperationId}' for '${httpMethod}' operation on path '${path}' `,
["Interpretations"],
original,
);
return this.splitOpId(`${original.tags[0]}_${original.tags[1]}`);
return this.splitOpId(newOperationId);
}
this.session.error(
`NEED 'operationId' for '${httpMethod}' operation on path '${path}' `,
Expand Down

0 comments on commit 020c306

Please sign in to comment.