Skip to content

Commit be5af8a

Browse files
Merge branch 'master' into ts-fetch-tests
2 parents 1f65e57 + ff550ae commit be5af8a

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

src/main/java/io/swagger/codegen/v3/generators/dotnet/AbstractCSharpCodegen.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ public void updateCodegenPropertyEnum(CodegenProperty var) {
535535
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
536536
super.postProcessOperations(objs);
537537
if (objs != null) {
538+
boolean hasAuthMethods = false;
538539
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
539540
if (operations != null) {
540541
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
@@ -583,8 +584,12 @@ public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
583584
}
584585

585586
processOperation(operation);
587+
if (getBooleanValue(operation, CodegenConstants.HAS_AUTH_METHODS_EXT_NAME)) {
588+
hasAuthMethods = true;
589+
}
586590
}
587591
}
592+
objs.put("hasAuthMethods", hasAuthMethods);
588593
}
589594

590595
return objs;

src/main/resources/handlebars/aspnetcore/3.0/Startup.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ using Newtonsoft.Json.Serialization;
1414
using Swashbuckle.AspNetCore.Swagger;
1515
using Swashbuckle.AspNetCore.SwaggerGen;
1616
using {{packageName}}.Filters;
17-
using {{packageName}}.Security;
17+
{{#hasAuthMethods}}using {{packageName}}.Security;{{/hasAuthMethods}}
1818

1919
namespace {{packageName}}
2020
{

src/main/resources/handlebars/aspnetcore/model.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace {{packageName}}.Models
1919
/// </summary>
2020
[DataContract]
2121
public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}}IEquatable<{{classname}}>
22-
{ {{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}{{>enumClass}}{{/items}}{{/items.isEnum}}
22+
{ {{#vars}}{{#isEnum}}{{^complexType}}{{>enumClass}}{{/complexType}}{{/isEnum}}{{#items.isEnum}}{{#items}}{{^complexType}}{{>enumClass}}{{/complexType}}{{/items}}{{/items.isEnum}}
2323
/// <summary>
2424
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
2525
/// </summary>

src/main/resources/mustache/aspnetcore/3.0/Startup.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ using Newtonsoft.Json.Serialization;
1414
using Swashbuckle.AspNetCore.Swagger;
1515
using Swashbuckle.AspNetCore.SwaggerGen;
1616
using {{packageName}}.Filters;
17-
using {{packageName}}.Security;
17+
{{#hasAuthMethods}}using {{packageName}}.Security;{{/hasAuthMethods}}
1818

1919
namespace {{packageName}}
2020
{

0 commit comments

Comments
 (0)