Skip to content

Commit

Permalink
Fixed the condition of hasServiceParams
Browse files Browse the repository at this point in the history
`swagger.security` is a definition for the whole API. It is not necessarily set when there is security on individual methods.

Therefore it is better to refer to `swagger.securityDefinitions` to see if you need ` hasServiceParams`.

`isSecure` judgment also refers to ` swagger.securityDefinitions`.

Ref: https://github.com/wcandillon/swagger-js-codegen/blob/master/lib/codegen.js#L41
  • Loading branch information
7474 authored Dec 9, 2018
1 parent b39ecda commit d4e8b8c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/nodegen.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ function swagger2node(data, options) {
return params.split(',').filter(p => p).some(p => p !== 'body') ? render(content) : '';
};
};
var hasServiceParams = swagger.host === undefined || swagger.security !== undefined;
var hasServiceParams = swagger.host === undefined || swagger.securityDefinitions !== undefined;

// Create node.js
var nodeSourceCode = CodeGen.getCustomCode({
Expand Down

0 comments on commit d4e8b8c

Please sign in to comment.