forked from loafle/openapi-generator-original
fix c# net35 issue, add xml doc to new C# class (#5756)
This commit is contained in:
parent
98684d872c
commit
08a11c1d75
@ -212,6 +212,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
additionalProperties.remove("supportsAsync");
|
||||
}
|
||||
additionalProperties.put("validatable", false);
|
||||
additionalProperties.put("net35", true);
|
||||
} else if (NETSTANDARD.equals(this.targetFramework)){
|
||||
setTargetFrameworkNuget("netstandard1.3");
|
||||
setSupportsAsync(Boolean.TRUE);
|
||||
|
@ -1,7 +1,9 @@
|
||||
{{>partial_header}}
|
||||
using System;
|
||||
using System.Reflection;
|
||||
{{^net35}}
|
||||
using System.Collections.Concurrent;
|
||||
{{/net35}}
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@ -107,9 +109,9 @@ namespace {{packageName}}.Client
|
||||
{
|
||||
UserAgent = "{{#httpUserAgent}}{{.}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{packageVersion}}/csharp{{/httpUserAgent}}";
|
||||
BasePath = "{{{basePath}}}";
|
||||
DefaultHeader = new ConcurrentDictionary<string, string>();
|
||||
ApiKey = new ConcurrentDictionary<string, string>();
|
||||
ApiKeyPrefix = new ConcurrentDictionary<string, string>();
|
||||
DefaultHeader = new {{^net35}}Concurrent{{/net35}}Dictionary<string, string>();
|
||||
ApiKey = new {{^net35}}Concurrent{{/net35}}Dictionary<string, string>();
|
||||
ApiKeyPrefix = new {{^net35}}Concurrent{{/net35}}Dictionary<string, string>();
|
||||
|
||||
// Setting Timeout has side effects (forces ApiClient creation).
|
||||
Timeout = 100000;
|
||||
@ -124,7 +126,7 @@ namespace {{packageName}}.Client
|
||||
IDictionary<string, string> apiKeyPrefix,
|
||||
string basePath = "{{{basePath}}}") : this()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(basePath))
|
||||
if (string.{{^net35}}IsNullOrWhiteSpace{{/net35}}{{#net35}}IsNullOrEmpty{{/net35}}(basePath))
|
||||
throw new ArgumentException("The provided basePath is invalid.", "basePath");
|
||||
if (defaultHeader == null)
|
||||
throw new ArgumentNullException("defaultHeader");
|
||||
@ -264,11 +266,11 @@ namespace {{packageName}}.Client
|
||||
public virtual string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the access token for OAuth2 authentication.
|
||||
/// Gets the API key with prefix.
|
||||
/// </summary>
|
||||
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
|
||||
/// <returns>API key with prefix.</returns>
|
||||
public string GetApiKeyWithPrefix (string apiKeyIdentifier)
|
||||
public string GetApiKeyWithPrefix(string apiKeyIdentifier)
|
||||
{
|
||||
var apiKeyValue = "";
|
||||
ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
|
||||
|
@ -9,18 +9,77 @@ namespace {{packageName}}.Client
|
||||
/// </summary>
|
||||
public interface IReadableConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the access token.
|
||||
/// </summary>
|
||||
/// <value>Access token.</value>
|
||||
string AccessToken { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API key.
|
||||
/// </summary>
|
||||
/// <value>API key.</value>
|
||||
IDictionary<string, string> ApiKey { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API key prefix.
|
||||
/// </summary>
|
||||
/// <value>API key prefix.</value>
|
||||
IDictionary<string, string> ApiKeyPrefix { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base path.
|
||||
/// </summary>
|
||||
/// <value>Base path.</value>
|
||||
string BasePath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date time format.
|
||||
/// </summary>
|
||||
/// <value>Date time foramt.</value>
|
||||
string DateTimeFormat { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default header.
|
||||
/// </summary>
|
||||
/// <value>Default header.</value>
|
||||
IDictionary<string, string> DefaultHeader { get; }
|
||||
string Password { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the temp folder path.
|
||||
/// </summary>
|
||||
/// <value>Temp folder path.</value>
|
||||
string TempFolderPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HTTP connection timeout (in milliseconds)
|
||||
/// </summary>
|
||||
/// <value>HTTP connection timeout.</value>
|
||||
int Timeout { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user agent.
|
||||
/// </summary>
|
||||
/// <value>User agent.</value>
|
||||
string UserAgent { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the username.
|
||||
/// </summary>
|
||||
/// <value>Username.</value>
|
||||
string Username { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the password.
|
||||
/// </summary>
|
||||
/// <value>Password.</value>
|
||||
string Password { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API key with prefix.
|
||||
/// </summary>
|
||||
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
|
||||
/// <returns>API key with prefix.</returns>
|
||||
string GetApiKeyWithPrefix(string apiKeyIdentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ namespace {{packageName}}.{{apiPackage}}
|
||||
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
|
||||
public IDictionary<String, String> DefaultHeader()
|
||||
{
|
||||
return new ReadOnlyDictionary<string, string>(this.Configuration.DefaultHeader);
|
||||
return new {{^net35}}ReadOnly{{/net35}}Dictionary<string, string>(this.Configuration.DefaultHeader);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -293,9 +293,9 @@ namespace Example
|
||||
public void main()
|
||||
{
|
||||
// Configure API key authorization: api_key
|
||||
Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY");
|
||||
Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY");
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer");
|
||||
// Configuration.Default.AddApiKeyPrefix("api_key", "Bearer");
|
||||
|
||||
var apiInstance = new PetApi();
|
||||
var petId = 789; // long? | ID of pet to return
|
||||
|
@ -93,9 +93,9 @@ namespace Example
|
||||
public void main()
|
||||
{
|
||||
// Configure API key authorization: api_key
|
||||
Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY");
|
||||
Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY");
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer");
|
||||
// Configuration.Default.AddApiKeyPrefix("api_key", "Bearer");
|
||||
|
||||
var apiInstance = new StoreApi();
|
||||
|
||||
|
@ -272,11 +272,11 @@ namespace IO.Swagger.Client
|
||||
public virtual string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the access token for OAuth2 authentication.
|
||||
/// Gets the API key with prefix.
|
||||
/// </summary>
|
||||
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
|
||||
/// <returns>API key with prefix.</returns>
|
||||
public string GetApiKeyWithPrefix (string apiKeyIdentifier)
|
||||
public string GetApiKeyWithPrefix(string apiKeyIdentifier)
|
||||
{
|
||||
var apiKeyValue = "";
|
||||
ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
|
||||
|
@ -18,18 +18,77 @@ namespace IO.Swagger.Client
|
||||
/// </summary>
|
||||
public interface IReadableConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the access token.
|
||||
/// </summary>
|
||||
/// <value>Access token.</value>
|
||||
string AccessToken { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API key.
|
||||
/// </summary>
|
||||
/// <value>API key.</value>
|
||||
IDictionary<string, string> ApiKey { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API key prefix.
|
||||
/// </summary>
|
||||
/// <value>API key prefix.</value>
|
||||
IDictionary<string, string> ApiKeyPrefix { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base path.
|
||||
/// </summary>
|
||||
/// <value>Base path.</value>
|
||||
string BasePath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date time format.
|
||||
/// </summary>
|
||||
/// <value>Date time foramt.</value>
|
||||
string DateTimeFormat { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default header.
|
||||
/// </summary>
|
||||
/// <value>Default header.</value>
|
||||
IDictionary<string, string> DefaultHeader { get; }
|
||||
string Password { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the temp folder path.
|
||||
/// </summary>
|
||||
/// <value>Temp folder path.</value>
|
||||
string TempFolderPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HTTP connection timeout (in milliseconds)
|
||||
/// </summary>
|
||||
/// <value>HTTP connection timeout.</value>
|
||||
int Timeout { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user agent.
|
||||
/// </summary>
|
||||
/// <value>User agent.</value>
|
||||
string UserAgent { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the username.
|
||||
/// </summary>
|
||||
/// <value>Username.</value>
|
||||
string Username { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the password.
|
||||
/// </summary>
|
||||
/// <value>Password.</value>
|
||||
string Password { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API key with prefix.
|
||||
/// </summary>
|
||||
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
|
||||
/// <returns>API key with prefix.</returns>
|
||||
string GetApiKeyWithPrefix(string apiKeyIdentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -293,9 +293,9 @@ namespace Example
|
||||
public void main()
|
||||
{
|
||||
// Configure API key authorization: api_key
|
||||
Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY");
|
||||
Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY");
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer");
|
||||
// Configuration.Default.AddApiKeyPrefix("api_key", "Bearer");
|
||||
|
||||
var apiInstance = new PetApi();
|
||||
var petId = 789; // long? | ID of pet to return
|
||||
|
@ -93,9 +93,9 @@ namespace Example
|
||||
public void main()
|
||||
{
|
||||
// Configure API key authorization: api_key
|
||||
Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY");
|
||||
Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY");
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer");
|
||||
// Configuration.Default.AddApiKeyPrefix("api_key", "Bearer");
|
||||
|
||||
var apiInstance = new StoreApi();
|
||||
|
||||
|
@ -267,11 +267,11 @@ namespace IO.Swagger.Client
|
||||
public virtual string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the access token for OAuth2 authentication.
|
||||
/// Gets the API key with prefix.
|
||||
/// </summary>
|
||||
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
|
||||
/// <returns>API key with prefix.</returns>
|
||||
public string GetApiKeyWithPrefix (string apiKeyIdentifier)
|
||||
public string GetApiKeyWithPrefix(string apiKeyIdentifier)
|
||||
{
|
||||
var apiKeyValue = "";
|
||||
ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
|
||||
|
@ -18,18 +18,77 @@ namespace IO.Swagger.Client
|
||||
/// </summary>
|
||||
public interface IReadableConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the access token.
|
||||
/// </summary>
|
||||
/// <value>Access token.</value>
|
||||
string AccessToken { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API key.
|
||||
/// </summary>
|
||||
/// <value>API key.</value>
|
||||
IDictionary<string, string> ApiKey { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API key prefix.
|
||||
/// </summary>
|
||||
/// <value>API key prefix.</value>
|
||||
IDictionary<string, string> ApiKeyPrefix { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base path.
|
||||
/// </summary>
|
||||
/// <value>Base path.</value>
|
||||
string BasePath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date time format.
|
||||
/// </summary>
|
||||
/// <value>Date time foramt.</value>
|
||||
string DateTimeFormat { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default header.
|
||||
/// </summary>
|
||||
/// <value>Default header.</value>
|
||||
IDictionary<string, string> DefaultHeader { get; }
|
||||
string Password { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the temp folder path.
|
||||
/// </summary>
|
||||
/// <value>Temp folder path.</value>
|
||||
string TempFolderPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HTTP connection timeout (in milliseconds)
|
||||
/// </summary>
|
||||
/// <value>HTTP connection timeout.</value>
|
||||
int Timeout { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user agent.
|
||||
/// </summary>
|
||||
/// <value>User agent.</value>
|
||||
string UserAgent { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the username.
|
||||
/// </summary>
|
||||
/// <value>Username.</value>
|
||||
string Username { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the password.
|
||||
/// </summary>
|
||||
/// <value>Password.</value>
|
||||
string Password { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API key with prefix.
|
||||
/// </summary>
|
||||
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
|
||||
/// <returns>API key with prefix.</returns>
|
||||
string GetApiKeyWithPrefix(string apiKeyIdentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -293,9 +293,9 @@ namespace Example
|
||||
public void main()
|
||||
{
|
||||
// Configure API key authorization: api_key
|
||||
Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY");
|
||||
Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY");
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer");
|
||||
// Configuration.Default.AddApiKeyPrefix("api_key", "Bearer");
|
||||
|
||||
var apiInstance = new PetApi();
|
||||
var petId = 789; // long? | ID of pet to return
|
||||
|
@ -93,9 +93,9 @@ namespace Example
|
||||
public void main()
|
||||
{
|
||||
// Configure API key authorization: api_key
|
||||
Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY");
|
||||
Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY");
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer");
|
||||
// Configuration.Default.AddApiKeyPrefix("api_key", "Bearer");
|
||||
|
||||
var apiInstance = new StoreApi();
|
||||
|
||||
|
@ -272,11 +272,11 @@ namespace IO.Swagger.Client
|
||||
public virtual string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the access token for OAuth2 authentication.
|
||||
/// Gets the API key with prefix.
|
||||
/// </summary>
|
||||
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
|
||||
/// <returns>API key with prefix.</returns>
|
||||
public string GetApiKeyWithPrefix (string apiKeyIdentifier)
|
||||
public string GetApiKeyWithPrefix(string apiKeyIdentifier)
|
||||
{
|
||||
var apiKeyValue = "";
|
||||
ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
|
||||
|
@ -18,18 +18,77 @@ namespace IO.Swagger.Client
|
||||
/// </summary>
|
||||
public interface IReadableConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the access token.
|
||||
/// </summary>
|
||||
/// <value>Access token.</value>
|
||||
string AccessToken { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API key.
|
||||
/// </summary>
|
||||
/// <value>API key.</value>
|
||||
IDictionary<string, string> ApiKey { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API key prefix.
|
||||
/// </summary>
|
||||
/// <value>API key prefix.</value>
|
||||
IDictionary<string, string> ApiKeyPrefix { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base path.
|
||||
/// </summary>
|
||||
/// <value>Base path.</value>
|
||||
string BasePath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date time format.
|
||||
/// </summary>
|
||||
/// <value>Date time foramt.</value>
|
||||
string DateTimeFormat { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default header.
|
||||
/// </summary>
|
||||
/// <value>Default header.</value>
|
||||
IDictionary<string, string> DefaultHeader { get; }
|
||||
string Password { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the temp folder path.
|
||||
/// </summary>
|
||||
/// <value>Temp folder path.</value>
|
||||
string TempFolderPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HTTP connection timeout (in milliseconds)
|
||||
/// </summary>
|
||||
/// <value>HTTP connection timeout.</value>
|
||||
int Timeout { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user agent.
|
||||
/// </summary>
|
||||
/// <value>User agent.</value>
|
||||
string UserAgent { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the username.
|
||||
/// </summary>
|
||||
/// <value>Username.</value>
|
||||
string Username { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the password.
|
||||
/// </summary>
|
||||
/// <value>Password.</value>
|
||||
string Password { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API key with prefix.
|
||||
/// </summary>
|
||||
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
|
||||
/// <returns>API key with prefix.</returns>
|
||||
string GetApiKeyWithPrefix(string apiKeyIdentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user