forked from loafle/openapi-generator-original
better code injection handling for c#
This commit is contained in:
@@ -656,4 +656,16 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
public String testPackageName() {
|
||||
return this.packageName + ".Test";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeQuotationMark(String input) {
|
||||
// remove " to avoid code injection
|
||||
return input.replace("\"", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeUnsafeCharacters(String input) {
|
||||
return input.replace("*/", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,17 +41,17 @@ namespace {{packageName}}.Client
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ApiClient" /> class
|
||||
/// with default configuration and base path ({{basePath}}).
|
||||
/// with default configuration and base path ({{{basePath}}}).
|
||||
/// </summary>
|
||||
public ApiClient()
|
||||
{
|
||||
Configuration = Configuration.Default;
|
||||
RestClient = new RestClient("{{basePath}}");
|
||||
RestClient = new RestClient("{{{basePath}}}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ApiClient" /> class
|
||||
/// with default base path ({{basePath}}).
|
||||
/// with default base path ({{{basePath}}}).
|
||||
/// </summary>
|
||||
/// <param name="config">An instance of Configuration.</param>
|
||||
public ApiClient(Configuration config = null)
|
||||
@@ -61,7 +61,7 @@ namespace {{packageName}}.Client
|
||||
else
|
||||
Configuration = config;
|
||||
|
||||
RestClient = new RestClient("{{basePath}}");
|
||||
RestClient = new RestClient("{{{basePath}}}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -69,7 +69,7 @@ namespace {{packageName}}.Client
|
||||
/// with default configuration.
|
||||
/// </summary>
|
||||
/// <param name="basePath">The base path.</param>
|
||||
public ApiClient(String basePath = "{{basePath}}")
|
||||
public ApiClient(String basePath = "{{{basePath}}}")
|
||||
{
|
||||
if (String.IsNullOrEmpty(basePath))
|
||||
throw new ArgumentException("basePath cannot be empty");
|
||||
|
||||
@@ -281,7 +281,7 @@ namespace {{packageName}}.Client
|
||||
/// </summary>
|
||||
public static String ToDebugReport()
|
||||
{
|
||||
String report = "C# SDK ({{packageName}}) Debug Report:\n";
|
||||
String report = "C# SDK ({{{packageName}}}) Debug Report:\n";
|
||||
{{^supportsUWP}}
|
||||
report += " OS: " + Environment.OSVersion + "\n";
|
||||
report += " .NET Framework Version: " + Assembly
|
||||
@@ -289,8 +289,8 @@ namespace {{packageName}}.Client
|
||||
.GetReferencedAssemblies()
|
||||
.Where(x => x.Name == "System.Core").First().Version.ToString() + "\n";
|
||||
{{/supportsUWP}}
|
||||
report += " Version of the API: {{version}}\n";
|
||||
report += " SDK Package Version: {{packageVersion}}\n";
|
||||
report += " Version of the API: {{{version}}}\n";
|
||||
report += " SDK Package Version: {{{packageVersion}}}\n";
|
||||
|
||||
return report;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Example
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
All URIs are relative to *{{{basePath}}}*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# {{packageName}}.Api.{{classname}}{{#description}}
|
||||
{{description}}{{/description}}
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
All URIs are relative to *{{{basePath}}}*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
|
||||
Reference in New Issue
Block a user