Skip to content

Commit 9c582c2

Browse files
committed
added file as reserved words for dotnet generators
1 parent fc72545 commit 9c582c2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public AbstractCSharpCodegen() {
9090
// set "client" as a reserved word to avoid conflicts with IO.Swagger.Client
9191
// this is a workaround and can be removed if c# api client is updated to use
9292
// fully qualified name
93-
"Client", "client", "parameter",
93+
"Client", "client", "parameter", "File", "file",
9494
// local variable names in API methods (endpoints)
9595
"localVarPath", "localVarPathParams", "localVarQueryParams", "localVarHeaderParams",
9696
"localVarFormParams", "localVarFileParams", "localVarStatusCode", "localVarResponse",
@@ -468,6 +468,14 @@ private void postProcessEnumRefs(final Map<String, Object> models) {
468468
}
469469
}
470470

471+
public CodegenModel fromModel(String name, Model model, Map<String, Model> allDefinitions) {
472+
final CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
473+
if (typeMapping.containsKey(name.toLowerCase()) && isReservedWord(name)) {
474+
typeMapping.remove(name.toLowerCase());
475+
}
476+
return codegenModel;
477+
}
478+
471479
/**
472480
* Update codegen property's enum by adding "enumVars" (with name and value)
473481
*

0 commit comments

Comments
 (0)