Skip to content

Commit

Permalink
Merge pull request #657 from swagger-api/codegen-issue-10197
Browse files Browse the repository at this point in the history
Codegen issue 10197
  • Loading branch information
HugoMario authored Apr 22, 2020
2 parents 32551b2 + f007d73 commit ff550ae
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ public void updateCodegenPropertyEnum(CodegenProperty var) {
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
super.postProcessOperations(objs);
if (objs != null) {
boolean hasAuthMethods = false;
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
if (operations != null) {
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
Expand Down Expand Up @@ -583,8 +584,12 @@ public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
}

processOperation(operation);
if (getBooleanValue(operation, CodegenConstants.HAS_AUTH_METHODS_EXT_NAME)) {
hasAuthMethods = true;
}
}
}
objs.put("hasAuthMethods", hasAuthMethods);
}

return objs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using Newtonsoft.Json.Serialization;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
using {{packageName}}.Filters;
using {{packageName}}.Security;
{{#hasAuthMethods}}using {{packageName}}.Security;{{/hasAuthMethods}}

namespace {{packageName}}
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/handlebars/aspnetcore/model.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace {{packageName}}.Models
/// </summary>
[DataContract]
public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}}IEquatable<{{classname}}>
{ {{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}{{>enumClass}}{{/items}}{{/items.isEnum}}
{ {{#vars}}{{#isEnum}}{{^complexType}}{{>enumClass}}{{/complexType}}{{/isEnum}}{{#items.isEnum}}{{#items}}{{^complexType}}{{>enumClass}}{{/complexType}}{{/items}}{{/items.isEnum}}
/// <summary>
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using Newtonsoft.Json.Serialization;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
using {{packageName}}.Filters;
using {{packageName}}.Security;
{{#hasAuthMethods}}using {{packageName}}.Security;{{/hasAuthMethods}}

namespace {{packageName}}
{
Expand Down

0 comments on commit ff550ae

Please sign in to comment.