Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/cli/generators/openapi/spec-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,13 @@
controllerSpec.methods = entry.operations.map(op =>
buildMethodSpec(controllerSpec, op, options),
);
// Track whether param and requestBody decorators are used
controllerSpec.usesParam = controllerSpec.methods.some(m =>

Check failure on line 459 in packages/cli/generators/openapi/spec-helper.js

View workflow job for this annotation

GitHub Actions / Code Lint

Delete `m·=>`
m.signature && m.signature.includes('@param('),

Check failure on line 460 in packages/cli/generators/openapi/spec-helper.js

View workflow job for this annotation

GitHub Actions / Code Lint

Insert `·m·=>`
);
controllerSpec.usesRequestBody = controllerSpec.methods.some(m =>

Check failure on line 462 in packages/cli/generators/openapi/spec-helper.js

View workflow job for this annotation

GitHub Actions / Code Lint

Delete `m·=>`
m.signature && m.signature.includes('@requestBody('),

Check failure on line 463 in packages/cli/generators/openapi/spec-helper.js

View workflow job for this annotation

GitHub Actions / Code Lint

Insert `·m·=>`
);
controllerSpec.methodMappingObject = printSpecObject(
controllerSpec.methodMapping,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {api, operation, param, requestBody} from '@loopback/rest';<%if (withImplementation) { %>
import {api, operation<% if (usesParam) { %>, param<% } %><% if (usesRequestBody) { %>, requestBody<% } %>} from '@loopback/rest';<%if (withImplementation) { %>
import {inject} from '@loopback/core';

import {<%- serviceClassName %>} from '../services';
Expand Down
Loading