diff --git a/lib/operation.ts b/lib/operation.ts index c89ed88..4affaf1 100644 --- a/lib/operation.ts +++ b/lib/operation.ts @@ -170,9 +170,12 @@ export class Operation { } } } - if (map.size < 2) { - map.clear(); + if (map.size === 0) { map.set('', null); + } else if (map.size === 1) { + const content = [...map.values()][0]; + map.clear(); + map.set('', content); } return map; } diff --git a/lib/request-body.ts b/lib/request-body.ts index e510b4c..e2ee640 100644 --- a/lib/request-body.ts +++ b/lib/request-body.ts @@ -16,7 +16,7 @@ export class RequestBody { public content: Content[], public options: Options) { - this.tsComments = tsComments(spec.description, 1); + this.tsComments = tsComments(spec.description, 2); this.required = spec.required === true; } diff --git a/templates/operationParameters.handlebars b/templates/operationParameters.handlebars index 3c37899..cf6199e 100644 --- a/templates/operationParameters.handlebars +++ b/templates/operationParameters.handlebars @@ -1,6 +1,5 @@ params{{^operation.parametersRequired}}?{{/operation.parametersRequired}}: { {{#operation.parameters}}{{tsComments}}{{var}}{{^required}}?{{/required}}: {{{type}}};{{#tsComments}} -{{/tsComments}}{{/operation.parameters}}{{#requestBody}} - {{{../operation.requestBody.tsComments}}}body{{^../operation.requestBody.required}}?{{/../operation.requestBody.required +{{/tsComments}}{{/operation.parameters}}{{#requestBody}} {{{../operation.requestBody.tsComments}}}body{{^../operation.requestBody.required}}?{{/../operation.requestBody.required }}: {{{type}}}{{/requestBody}} } \ No newline at end of file