diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java
index dd4b3e9f27cf..eecc93de1d30 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java
@@ -312,6 +312,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
clientPackageDir, "ApiResponse.cs"));
supportingFiles.add(new SupportingFile("ExceptionFactory.mustache",
clientPackageDir, "ExceptionFactory.cs"));
+
if(Boolean.FALSE.equals(this.netStandard) && Boolean.FALSE.equals(this.netCoreProjectFileFlag)) {
supportingFiles.add(new SupportingFile("compile.mustache", "", "build.bat"));
supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "build.sh"));
@@ -324,6 +325,11 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("project.json.mustache", packageFolder + File.separator, "project.json"));
}
+ supportingFiles.add(new SupportingFile("IReadableConfiguration.mustache",
+ clientPackageDir, "IReadableConfiguration.cs"));
+ supportingFiles.add(new SupportingFile("GlobalConfiguration.mustache",
+ clientPackageDir, "GlobalConfiguration.cs"));
+
// Only write out test related files if excludeTests is unset or explicitly set to false (see start of this method)
if(Boolean.FALSE.equals(excludeTests)) {
// shell script to run the nunit test
diff --git a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache
index 875fdcc09da6..6bef6f4ec66a 100644
--- a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache
+++ b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache
@@ -49,11 +49,11 @@ namespace {{packageName}}.Client
///
/// Initializes a new instance of the class
- /// with default configuration and base path ({{{basePath}}}).
+ /// with default configuration.
///
public ApiClient()
{
- Configuration = Configuration.Default;
+ Configuration = {{packageName}}.Client.Configuration.Default;
RestClient = new RestClient("{{{basePath}}}");
{{#netStandard}}
RestClient.IgnoreResponseStatusCode = true;
@@ -65,14 +65,11 @@ namespace {{packageName}}.Client
/// with default base path ({{{basePath}}}).
///
/// An instance of Configuration.
- public ApiClient(Configuration config = null)
+ public ApiClient(Configuration config)
{
- if (config == null)
- Configuration = Configuration.Default;
- else
- Configuration = config;
+ Configuration = config ?? {{packageName}}.Client.Configuration.Default;
- RestClient = new RestClient("{{{basePath}}}");
+ RestClient = new RestClient(Configuration.BasePath);
{{#netStandard}}
RestClient.IgnoreResponseStatusCode = true;
{{/netStandard}}
@@ -92,7 +89,7 @@ namespace {{packageName}}.Client
{{#netStandard}}
RestClient.IgnoreResponseStatusCode = true;
{{/netStandard}}
- Configuration = Configuration.Default;
+ Configuration = Client.Configuration.Default;
}
///
@@ -103,10 +100,15 @@ namespace {{packageName}}.Client
public static ApiClient Default;
///
- /// Gets or sets the Configuration.
+ /// Gets or sets an instance of the IReadableConfiguration.
///
- /// An instance of the Configuration.
- public Configuration Configuration { get; set; }
+ /// An instance of the IReadableConfiguration.
+ ///
+ /// helps us to avoid modifying possibly global
+ /// configuration values from within a given client. It does not gaurantee thread-safety
+ /// of the instance in any way.
+ ///
+ public IReadableConfiguration Configuration { get; set; }
///
/// Gets or sets the RestClient.
@@ -210,7 +212,8 @@ namespace {{packageName}}.Client
pathParams, contentType);
// set timeout
- RestClient.Timeout = Configuration.Timeout;
+ {{#netStandard}}RestClient.Timeout = TimeSpan.FromMilliseconds(Configuration.Timeout);{{/netStandard}}
+ {{^netStandard}}RestClient.Timeout = Configuration.Timeout;{{/netStandard}}
// set user agent
RestClient.UserAgent = Configuration.UserAgent;
@@ -334,6 +337,7 @@ namespace {{packageName}}.Client
return response.RawBytes;
}
+ // TODO: ? if (type.IsAssignableFrom(typeof(Stream)))
if (type == typeof(Stream))
{
if (headers != null)
diff --git a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache
index c4133bcc6819..e7aafa2c3279 100644
--- a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache
+++ b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache
@@ -1,6 +1,7 @@
{{>partial_header}}
using System;
using System.Reflection;
+using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -11,10 +12,147 @@ namespace {{packageName}}.Client
///
/// Represents a set of configuration settings
///
- {{>visibility}} class Configuration
+ {{>visibility}} class Configuration : IReadableConfiguration
{
+ #region Constants
+
///
- /// Initializes a new instance of the Configuration class with different settings
+ /// Version of the package.
+ ///
+ /// Version of the package.
+ public const string Version = "{{packageVersion}}";
+
+ ///
+ /// Identifier for ISO 8601 DateTime Format
+ ///
+ /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information.
+ // ReSharper disable once InconsistentNaming
+ public const string ISO8601_DATETIME_FORMAT = "o";
+
+ #endregion Constants
+
+ #region Static Members
+
+ private static readonly object GlobalConfigSync = new { };
+ private static Configuration _globalConfiguration;
+
+ ///
+ /// Default creation of exceptions for a given method name and response object
+ ///
+ public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) =>
+ {
+ var status = (int)response.StatusCode;
+ if (status >= 400)
+ {
+ return new ApiException(status,
+ string.Format("Error calling {0}: {1}", methodName, response.Content),
+ response.Content);
+ }
+ {{^netStandard}}if (status == 0)
+ {
+ return new ApiException(status,
+ string.Format("Error calling {0}: {1}", methodName, response.ErrorMessage), response.ErrorMessage);
+ }{{/netStandard}}
+ return null;
+ };
+
+ ///
+ /// Gets or sets the default Configuration.
+ ///
+ /// Configuration.
+ public static Configuration Default
+ {
+ get { return _globalConfiguration; }
+ set
+ {
+ lock (GlobalConfigSync)
+ {
+ _globalConfiguration = value;
+ }
+ }
+ }
+
+ #endregion Static Members
+
+ #region Private Members
+
+ ///
+ /// Gets or sets the API key based on the authentication name.
+ ///
+ /// The API key.
+ private IDictionary _apiKey = null;
+
+ ///
+ /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
+ ///
+ /// The prefix of the API key.
+ private IDictionary _apiKeyPrefix = null;
+
+ private string _dateTimeFormat = ISO8601_DATETIME_FORMAT;
+ private string _tempFolderPath = Path.GetTempPath();
+
+ #endregion Private Members
+
+ #region Constructors
+
+ static Configuration()
+ {
+ _globalConfiguration = new GlobalConfiguration();
+ }
+
+ ///
+ /// Initializes a new instance of the class
+ ///
+ public Configuration()
+ {
+ UserAgent = "{{#httpUserAgent}}{{.}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{packageVersion}}/csharp{{/httpUserAgent}}";
+ BasePath = "{{{basePath}}}";
+ DefaultHeader = new ConcurrentDictionary();
+ ApiKey = new ConcurrentDictionary();
+ ApiKeyPrefix = new ConcurrentDictionary();
+
+ // Setting Timeout has side effects (forces ApiClient creation).
+ Timeout = 100000;
+ }
+
+ ///
+ /// Initializes a new instance of the class
+ ///
+ public Configuration(
+ IDictionary defaultHeader,
+ IDictionary apiKey,
+ IDictionary apiKeyPrefix,
+ string basePath = "{{{basePath}}}") : this()
+ {
+ if (string.IsNullOrWhiteSpace(basePath))
+ throw new ArgumentException("The provided basePath is invalid.", "basePath");
+ if (defaultHeader == null)
+ throw new ArgumentNullException("defaultHeader");
+ if (apiKey == null)
+ throw new ArgumentNullException("apiKey");
+ if (apiKeyPrefix == null)
+ throw new ArgumentNullException("apiKeyPrefix");
+
+ BasePath = basePath;
+
+ foreach (var keyValuePair in defaultHeader)
+ {
+ DefaultHeader.Add(keyValuePair);
+ }
+
+ foreach (var keyValuePair in apiKey)
+ {
+ ApiKey.Add(keyValuePair);
+ }
+
+ foreach (var keyValuePair in apiKeyPrefix)
+ {
+ ApiKeyPrefix.Add(keyValuePair);
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the class with different settings
///
/// Api client
/// Dictionary of default HTTP header
@@ -27,131 +165,225 @@ namespace {{packageName}}.Client
/// DateTime format string
/// HTTP connection timeout (in milliseconds)
/// HTTP user agent
- public Configuration(ApiClient apiClient = null,
- Dictionary defaultHeader = null,
- string username = null,
- string password = null,
- string accessToken = null,
- Dictionary apiKey = null,
- Dictionary apiKeyPrefix = null,
- string tempFolderPath = null,
- string dateTimeFormat = null,
- int timeout = 100000,
- string userAgent = "{{#httpUserAgent}}{{.}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{packageVersion}}/csharp{{/httpUserAgent}}"
- )
+ [Obsolete("Use explicit object construction and setting of properties.", true)]
+ public Configuration(
+ // ReSharper disable UnusedParameter.Local
+ ApiClient apiClient = null,
+ IDictionary defaultHeader = null,
+ string username = null,
+ string password = null,
+ string accessToken = null,
+ IDictionary apiKey = null,
+ IDictionary apiKeyPrefix = null,
+ string tempFolderPath = null,
+ string dateTimeFormat = null,
+ int timeout = 100000,
+ string userAgent = "{{#httpUserAgent}}{{.}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{packageVersion}}/csharp{{/httpUserAgent}}"
+ // ReSharper restore UnusedParameter.Local
+ )
{
- setApiClientUsingDefault(apiClient);
- Username = username;
- Password = password;
- AccessToken = accessToken;
- UserAgent = userAgent;
-
- if (defaultHeader != null)
- DefaultHeader = defaultHeader;
- if (apiKey != null)
- ApiKey = apiKey;
- if (apiKeyPrefix != null)
- ApiKeyPrefix = apiKeyPrefix;
-
- TempFolderPath = tempFolderPath;
- DateTimeFormat = dateTimeFormat;
- Timeout = {{#netStandard}}TimeSpan.FromMilliseconds({{/netStandard}}timeout{{#netStandard}}){{/netStandard}};
}
///
/// Initializes a new instance of the Configuration class.
///
/// Api client.
+ [Obsolete("This constructor caused unexpected sharing of static data. It is no longer supported.", true)]
+ // ReSharper disable once UnusedParameter.Local
public Configuration(ApiClient apiClient)
{
- setApiClientUsingDefault(apiClient);
+
}
- ///
- /// Version of the package.
- ///
- /// Version of the package.
- public const string Version = "{{packageVersion}}";
+ #endregion Constructors
- ///
- /// Gets or sets the default Configuration.
- ///
- /// Configuration.
- public static Configuration Default = new Configuration();
+ #region Properties
+
+ private ApiClient _apiClient = null;
///
- /// Default creation of exceptions for a given method name and response object
+ /// Gets an instance of an ApiClient for this configuration
///
- public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) =>
+ public virtual ApiClient ApiClient
{
- int status = (int) response.StatusCode;
- if (status >= 400) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.Content), response.Content);
- {{^netStandard}}
- if (status == 0) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.ErrorMessage), response.ErrorMessage);
- {{/netStandard}}
- return null;
- };
-
- ///
- /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
- ///
- /// Timeout.
- public {{^netStandard}}int{{/netStandard}}{{#netStandard}}TimeSpan?{{/netStandard}} Timeout
- {
- get { return ApiClient.RestClient.Timeout; }
-
- set
+ get
{
- if (ApiClient != null)
- ApiClient.RestClient.Timeout = value;
+ if (_apiClient == null) _apiClient = CreateApiClient();
+ return _apiClient;
}
}
+ private String _basePath = null;
///
- /// Gets or sets the default API client for making HTTP calls.
+ /// Gets or sets the base path for API access.
///
- /// The API client.
- public ApiClient ApiClient;
-
- ///
- /// Set the ApiClient using Default or ApiClient instance.
- ///
- /// An instance of ApiClient.
- ///
- public void setApiClientUsingDefault (ApiClient apiClient = null)
- {
- if (apiClient == null)
- {
- if (Default != null && Default.ApiClient == null)
- Default.ApiClient = new ApiClient();
-
- ApiClient = Default != null ? Default.ApiClient : new ApiClient();
- }
- else
- {
- if (Default != null && Default.ApiClient == null)
- Default.ApiClient = apiClient;
-
- ApiClient = apiClient;
+ public virtual string BasePath {
+ get { return _basePath; }
+ set {
+ _basePath = value;
+ // pass-through to ApiClient if it's set.
+ if(_apiClient != null) {
+ _apiClient.RestClient.BaseUrl = new Uri(_basePath);
+ }
}
}
- private Dictionary _defaultHeaderMap = new Dictionary();
-
///
/// Gets or sets the default header.
///
- public Dictionary DefaultHeader
+ public virtual IDictionary DefaultHeader { get; set; }
+
+ ///
+ /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
+ ///
+ public virtual int Timeout
{
- get { return _defaultHeaderMap; }
+ {{#netStandard}}get { return (int)ApiClient.RestClient.Timeout.GetValueOrDefault(TimeSpan.FromSeconds(0)).TotalMilliseconds; }
+ set { ApiClient.RestClient.Timeout = TimeSpan.FromMilliseconds(value); }{{/netStandard}}{{^netStandard}}
+ get { return ApiClient.RestClient.Timeout; }
+ set { ApiClient.RestClient.Timeout = value; }{{/netStandard}}
+ }
+
+ ///
+ /// Gets or sets the HTTP user agent.
+ ///
+ /// Http user agent.
+ public virtual string UserAgent { get; set; }
+
+ ///
+ /// Gets or sets the username (HTTP basic authentication).
+ ///
+ /// The username.
+ public virtual string Username { get; set; }
+
+ ///
+ /// Gets or sets the password (HTTP basic authentication).
+ ///
+ /// The password.
+ public virtual string Password { get; set; }
+
+ ///
+ /// Gets or sets the access token for OAuth2 authentication.
+ ///
+ /// API key identifier (authentication scheme).
+ /// API key with prefix.
+ public string GetApiKeyWithPrefix (string apiKeyIdentifier)
+ {
+ var apiKeyValue = "";
+ ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
+ var apiKeyPrefix = "";
+ if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix))
+ return apiKeyPrefix + " " + apiKeyValue;
+ else
+ return apiKeyValue;
+ }
+
+ ///
+ /// Gets or sets the access token for OAuth2 authentication.
+ ///
+ /// The access token.
+ public virtual string AccessToken { get; set; }
+
+ ///
+ /// Gets or sets the temporary folder path to store the files downloaded from the server.
+ ///
+ /// Folder path.
+ public virtual string TempFolderPath
+ {
+ get { return _tempFolderPath; }
set
{
- _defaultHeaderMap = value;
+ if (string.IsNullOrEmpty(value))
+ {
+ // Possible breaking change since swagger-codegen 2.2.1, enforce a valid temporary path on set.
+ _tempFolderPath = Path.GetTempPath();
+ return;
+ }
+
+ // create the directory if it does not exist
+ if (!Directory.Exists(value))
+ {
+ Directory.CreateDirectory(value);
+ }
+
+ // check if the path contains directory separator at the end
+ if (value[value.Length - 1] == Path.DirectorySeparatorChar)
+ {
+ _tempFolderPath = value;
+ }
+ else
+ {
+ _tempFolderPath = value + Path.DirectorySeparatorChar;
+ }
}
}
+ ///
+ /// Gets or sets the the date time format used when serializing in the ApiClient
+ /// By default, it's set to ISO 8601 - "o", for others see:
+ /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
+ /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
+ /// No validation is done to ensure that the string you're providing is valid
+ ///
+ /// The DateTimeFormat string
+ public virtual string DateTimeFormat
+ {
+ get { return _dateTimeFormat; }
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ // Never allow a blank or null string, go back to the default
+ _dateTimeFormat = ISO8601_DATETIME_FORMAT;
+ return;
+ }
+
+ // Caution, no validation when you choose date time format other than ISO 8601
+ // Take a look at the above links
+ _dateTimeFormat = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
+ ///
+ /// The prefix of the API key.
+ public virtual IDictionary ApiKeyPrefix
+ {
+ get { return _apiKeyPrefix; }
+ set
+ {
+ if (value == null)
+ {
+ throw new InvalidOperationException("ApiKeyPrefix collection may not be null.");
+ }
+ _apiKeyPrefix = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the API key based on the authentication name.
+ ///
+ /// The API key.
+ public virtual IDictionary ApiKey
+ {
+ get { return _apiKey; }
+ set
+ {
+ if (value == null)
+ {
+ throw new InvalidOperationException("ApiKey collection may not be null.");
+ }
+ _apiKey = value;
+ }
+ }
+
+ #endregion Properties
+
+ #region Methods
+
///
/// Add default header.
///
@@ -160,7 +392,38 @@ namespace {{packageName}}.Client
///
public void AddDefaultHeader(string key, string value)
{
- _defaultHeaderMap[key] = value;
+ DefaultHeader[key] = value;
+ }
+
+ ///
+ /// Creates a new based on this instance.
+ ///
+ ///
+ public ApiClient CreateApiClient()
+ {
+ return new ApiClient(BasePath) { Configuration = this };
+ }
+
+
+ ///
+ /// Returns a string with essential information for debugging.
+ ///
+ public static String ToDebugReport()
+ {
+ String report = "C# SDK ({{{packageName}}}) Debug Report:\n";
+ {{^netStandard}}
+ {{^supportsUWP}}
+ report += " OS: " + System.Environment.OSVersion + "\n";
+ report += " .NET Framework Version: " + System.Environment.Version + "\n";
+ {{/supportsUWP}}
+ {{/netStandard}}
+ {{#netStandard}}
+ report += " OS: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription + "\n";
+ {{/netStandard}}
+ report += " Version of the API: {{{version}}}\n";
+ report += " SDK Package Version: {{{packageVersion}}}\n";
+
+ return report;
}
///
@@ -184,151 +447,6 @@ namespace {{packageName}}.Client
ApiKeyPrefix[key] = value;
}
- ///
- /// Gets or sets the HTTP user agent.
- ///
- /// Http user agent.
- public String UserAgent { get; set; }
-
- ///
- /// Gets or sets the username (HTTP basic authentication).
- ///
- /// The username.
- public String Username { get; set; }
-
- ///
- /// Gets or sets the password (HTTP basic authentication).
- ///
- /// The password.
- public String Password { get; set; }
-
- ///
- /// Gets or sets the access token for OAuth2 authentication.
- ///
- /// The access token.
- public String AccessToken { get; set; }
-
- ///
- /// Gets or sets the API key based on the authentication name.
- ///
- /// The API key.
- public Dictionary ApiKey = new Dictionary();
-
- ///
- /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
- ///
- /// The prefix of the API key.
- public Dictionary ApiKeyPrefix = new Dictionary();
-
- ///
- /// Get the API key with prefix.
- ///
- /// API key identifier (authentication scheme).
- /// API key with prefix.
- public string GetApiKeyWithPrefix (string apiKeyIdentifier)
- {
- var apiKeyValue = "";
- ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
- var apiKeyPrefix = "";
- if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix))
- return apiKeyPrefix + " " + apiKeyValue;
- else
- return apiKeyValue;
- }
-
- private string _tempFolderPath;
-
- ///
- /// Gets or sets the temporary folder path to store the files downloaded from the server.
- ///
- /// Folder path.
- public String TempFolderPath
- {
- get
- {
- // default to Path.GetTempPath() if _tempFolderPath is not set
- if (String.IsNullOrEmpty(_tempFolderPath))
- {
- _tempFolderPath = Path.GetTempPath();
- }
- return _tempFolderPath;
- }
-
- set
- {
- if (String.IsNullOrEmpty(value))
- {
- _tempFolderPath = value;
- return;
- }
-
- // create the directory if it does not exist
- if (!Directory.Exists(value))
- Directory.CreateDirectory(value);
-
- // check if the path contains directory separator at the end
- if (value[value.Length - 1] == Path.DirectorySeparatorChar)
- _tempFolderPath = value;
- else
- _tempFolderPath = value + Path.DirectorySeparatorChar;
- }
- }
-
- private const string ISO8601_DATETIME_FORMAT = "o";
-
- private string _dateTimeFormat = ISO8601_DATETIME_FORMAT;
-
- ///
- /// Gets or sets the the date time format used when serializing in the ApiClient
- /// By default, it's set to ISO 8601 - "o", for others see:
- /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
- /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
- /// No validation is done to ensure that the string you're providing is valid
- ///
- /// The DateTimeFormat string
- public String DateTimeFormat
- {
- get
- {
- return _dateTimeFormat;
- }
- set
- {
- if (string.IsNullOrEmpty(value))
- {
- // Never allow a blank or null string, go back to the default
- _dateTimeFormat = ISO8601_DATETIME_FORMAT;
- return;
- }
-
- // Caution, no validation when you choose date time format other than ISO 8601
- // Take a look at the above links
- _dateTimeFormat = value;
- }
- }
-
- ///
- /// Returns a string with essential information for debugging.
- ///
- public static String ToDebugReport()
- {
- String report = "C# SDK ({{{packageName}}}) Debug Report:\n";
- {{^netStandard}}
- {{^supportsUWP}}
- report += " OS: " + Environment.OSVersion + "\n";
- report += " .NET Framework Version: " + Assembly
- .GetExecutingAssembly()
- .GetReferencedAssemblies()
- .Where(x => x.Name == "System.Core").First().Version.ToString() + "\n";
- {{/supportsUWP}}
- {{/netStandard}}
- {{#netStandard}}
- report += " OS: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription + "\n";
- {{/netStandard}}
- report += " Version of the API: {{{version}}}\n";
- report += " SDK Package Version: {{{packageVersion}}}\n";
-
- return report;
- }
+ #endregion Methods
}
}
diff --git a/modules/swagger-codegen/src/main/resources/csharp/GlobalConfiguration.mustache b/modules/swagger-codegen/src/main/resources/csharp/GlobalConfiguration.mustache
new file mode 100644
index 000000000000..b218d5cc3497
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/csharp/GlobalConfiguration.mustache
@@ -0,0 +1,25 @@
+{{>partial_header}}
+
+using System;
+using System.Reflection;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+
+namespace {{packageName}}.Client
+{
+ ///
+ /// provides a compile-time extension point for globally configuring
+ /// API Clients.
+ ///
+ ///
+ /// A customized implementation via partial class may reside in another file and may
+ /// be excluded from automatic generation via a .swagger-codegen-ignore file.
+ ///
+ public partial class GlobalConfiguration : Configuration
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/csharp/IReadableConfiguration.mustache b/modules/swagger-codegen/src/main/resources/csharp/IReadableConfiguration.mustache
new file mode 100644
index 000000000000..ae2692f5d4ab
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/csharp/IReadableConfiguration.mustache
@@ -0,0 +1,26 @@
+{{>partial_header}}
+
+using System.Collections.Generic;
+
+namespace {{packageName}}.Client
+{
+ ///
+ /// Represents a readable-only configuration contract.
+ ///
+ public interface IReadableConfiguration
+ {
+ string AccessToken { get; }
+ IDictionary ApiKey { get; }
+ IDictionary ApiKeyPrefix { get; }
+ string BasePath { get; }
+ string DateTimeFormat { get; }
+ IDictionary DefaultHeader { get; }
+ string Password { get; }
+ string TempFolderPath { get; }
+ int Timeout { get; }
+ string UserAgent { get; }
+ string Username { get; }
+
+ string GetApiKeyWithPrefix(string apiKeyIdentifier);
+ }
+}
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/csharp/api.mustache b/modules/swagger-codegen/src/main/resources/csharp/api.mustache
index aef9b78ed4f8..4ea57bca477d 100644
--- a/modules/swagger-codegen/src/main/resources/csharp/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/csharp/api.mustache
@@ -88,15 +88,9 @@ namespace {{packageName}}.{{apiPackage}}
///
public {{classname}}(String basePath)
{
- this.Configuration = new Configuration(new ApiClient(basePath));
+ this.Configuration = new Configuration { BasePath = basePath };
ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory;
-
- // ensure API client has configuration ready
- if (Configuration.ApiClient.Configuration == null)
- {
- this.Configuration.ApiClient.Configuration = this.Configuration;
- }
}
///
@@ -113,12 +107,6 @@ namespace {{packageName}}.{{apiPackage}}
this.Configuration = configuration;
ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory;
-
- // ensure API client has configuration ready
- if (Configuration.ApiClient.Configuration == null)
- {
- this.Configuration.ApiClient.Configuration = this.Configuration;
- }
}
///
@@ -167,9 +155,9 @@ namespace {{packageName}}.{{apiPackage}}
///
/// Dictionary of HTTP header
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
- public Dictionary DefaultHeader()
+ public IDictionary DefaultHeader()
{
- return this.Configuration.DefaultHeader;
+ return new ReadOnlyDictionary(this.Configuration.DefaultHeader);
}
///
diff --git a/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache b/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache
index ff3cf4fc60ac..60bde9985e64 100644
--- a/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache
+++ b/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache
@@ -41,9 +41,9 @@ namespace Example
{{/isBasic}}
{{#isApiKey}}
// Configure API key authorization: {{{name}}}
- Configuration.Default.ApiKey.Add("{{{keyParamName}}}", "YOUR_API_KEY");
+ Configuration.Default.AddApiKey("{{{keyParamName}}}", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
- // Configuration.Default.ApiKeyPrefix.Add("{{{keyParamName}}}", "Bearer");
+ // Configuration.Default.AddApiKeyPrefix("{{{keyParamName}}}", "Bearer");
{{/isApiKey}}
{{#isOAuth}}
// Configure OAuth2 access token for authorization: {{{name}}}
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs
index 7f537b165588..283eec5a1450 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs
@@ -1,3 +1,25 @@
+/*
+ * Swagger Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
using System;
using System.IO;
using System.Collections.Generic;
@@ -9,6 +31,7 @@ using NUnit.Framework;
using IO.Swagger.Client;
using IO.Swagger.Api;
+using IO.Swagger.Model;
namespace IO.Swagger.Test
{
@@ -30,7 +53,7 @@ namespace IO.Swagger.Test
[SetUp]
public void Init()
{
- instance = new FakeApi();
+ instance = new FakeApi();
}
///
@@ -48,32 +71,57 @@ namespace IO.Swagger.Test
[Test]
public void InstanceTest()
{
- Assert.IsInstanceOfType(typeof(FakeApi), instance, "instance is a FakeApi");
+ // TODO uncomment below to test 'IsInstanceOfType' FakeApi
+ //Assert.IsInstanceOfType(typeof(FakeApi), instance, "instance is a FakeApi");
}
+ ///
+ /// Test TestClientModel
+ ///
+ [Test]
+ public void TestClientModelTest()
+ {
+ // TODO uncomment below to test the method and replace null with proper value
+ //ModelClient body = null;
+ //var response = instance.TestClientModel(body);
+ //Assert.IsInstanceOf (response, "response is ModelClient");
+ }
+
///
/// Test TestEndpointParameters
///
[Test]
public void TestEndpointParametersTest()
{
- /* comment out the following as the endpiont is fake
- // TODO: add unit test for the method 'TestEndpointParameters'
- double? number = 12.3; // TODO: replace null with proper value
- double? _double = 34.5; // TODO: replace null with proper value
- string _string = "charp test"; // TODO: replace null with proper value
- byte[] _byte = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };; // TODO: replace null with proper value
- int? integer = 3; // TODO: replace null with proper value
- int? int32 = 2; // TODO: replace null with proper value
- long? int64 = 1; // TODO: replace null with proper value
- float? _float = 7.8F; // TODO: replace null with proper value
- byte[] binary = null; // TODO: replace null with proper value
- DateTime? date = null; // TODO: replace null with proper value
- DateTime? dateTime = null; // TODO: replace null with proper value
- string password = null; // TODO: replace null with proper value
- instance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
- */
+ // TODO uncomment below to test the method and replace null with proper value
+ //decimal? number = null;
+ //double? _double = null;
+ //string _string = null;
+ //byte[] _byte = null;
+ //int? integer = null;
+ //int? int32 = null;
+ //long? int64 = null;
+ //float? _float = null;
+ //byte[] binary = null;
+ //DateTime? date = null;
+ //DateTime? dateTime = null;
+ //string password = null;
+ //instance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
+
+ }
+
+ ///
+ /// Test TestEnumQueryParameters
+ ///
+ [Test]
+ public void TestEnumQueryParametersTest()
+ {
+ // TODO uncomment below to test the method and replace null with proper value
+ //string enumQueryString = null;
+ //decimal? enumQueryInteger = null;
+ //double? enumQueryDouble = null;
+ //instance.TestEnumQueryParameters(enumQueryString, enumQueryInteger, enumQueryDouble);
}
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs
index 0d517af68b5a..a512676b08c5 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs
@@ -1,3 +1,25 @@
+/*
+ * Swagger Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
using System;
using System.IO;
using System.Collections.Generic;
@@ -25,45 +47,6 @@ namespace IO.Swagger.Test
{
private PetApi instance;
- private long petId = 11088;
-
- ///
- /// Create a Pet object
- ///
- private Pet createPet()
- {
- // create pet
- Pet p = new Pet(Name: "Csharp test", PhotoUrls: new List { "http://petstore.com/csharp_test" });
- p.Id = petId;
- //p.Name = "Csharp test";
- p.Status = Pet.StatusEnum.Available;
- // create Category object
- Category category = new Category();
- category.Id = 56;
- category.Name = "sample category name2";
- List photoUrls = new List(new String[] {"sample photoUrls"});
- // create Tag object
- Tag tag = new Tag();
- tag.Id = petId;
- tag.Name = "csharp sample tag name1";
- List tags = new List(new Tag[] {tag});
- p.Tags = tags;
- p.Category = category;
- p.PhotoUrls = photoUrls;
-
- return p;
- }
-
- ///
- /// Convert string to byte array
- ///
- private byte[] GetBytes(string str)
- {
- byte[] bytes = new byte[str.Length * sizeof(char)];
- System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
- return bytes;
- }
-
///
/// Setup before each unit test
///
@@ -71,13 +54,6 @@ namespace IO.Swagger.Test
public void Init()
{
instance = new PetApi();
-
- // create pet
- Pet p = createPet();
-
- // add pet before testing
- PetApi petApi = new PetApi("http://petstore.swagger.io/v2/");
- petApi.AddPet (p);
}
///
@@ -86,9 +62,7 @@ namespace IO.Swagger.Test
[TearDown]
public void Cleanup()
{
- // remove the pet after testing
- PetApi petApi = new PetApi ();
- petApi.DeletePet(petId, "test key");
+
}
///
@@ -97,7 +71,8 @@ namespace IO.Swagger.Test
[Test]
public void InstanceTest()
{
- Assert.IsInstanceOfType(typeof(PetApi), instance, "instance is a PetApi");
+ // TODO uncomment below to test 'IsInstanceOfType' PetApi
+ //Assert.IsInstanceOfType(typeof(PetApi), instance, "instance is a PetApi");
}
@@ -107,10 +82,10 @@ namespace IO.Swagger.Test
[Test]
public void AddPetTest()
{
- // create pet
- Pet p = createPet();
-
- instance.AddPet(p);
+ // TODO uncomment below to test the method and replace null with proper value
+ //Pet body = null;
+ //instance.AddPet(body);
+
}
///
@@ -119,7 +94,11 @@ namespace IO.Swagger.Test
[Test]
public void DeletePetTest()
{
- // no need to test as it'c covered by Cleanup() already
+ // TODO uncomment below to test the method and replace null with proper value
+ //long? petId = null;
+ //string apiKey = null;
+ //instance.DeletePet(petId, apiKey);
+
}
///
@@ -128,15 +107,10 @@ namespace IO.Swagger.Test
[Test]
public void FindPetsByStatusTest()
{
- PetApi petApi = new PetApi ();
- List tagsList = new List(new String[] {"available"});
-
- List listPet = petApi.FindPetsByTags (tagsList);
- foreach (Pet pet in listPet) // Loop through List with foreach.
- {
- Assert.IsInstanceOfType(typeof(Pet), pet, "Response is a Pet");
- Assert.AreEqual ("csharp sample tag name1", pet.Tags[0]);
- }
+ // TODO uncomment below to test the method and replace null with proper value
+ //List status = null;
+ //var response = instance.FindPetsByStatus(status);
+ //Assert.IsInstanceOf> (response, "response is List");
}
///
@@ -145,9 +119,10 @@ namespace IO.Swagger.Test
[Test]
public void FindPetsByTagsTest()
{
- List tags = new List(new String[] {"pet"});
- var response = instance.FindPetsByTags(tags);
- Assert.IsInstanceOfType(typeof(List), response, "response is List");
+ // TODO uncomment below to test the method and replace null with proper value
+ //List tags = null;
+ //var response = instance.FindPetsByTags(tags);
+ //Assert.IsInstanceOf> (response, "response is List");
}
///
@@ -156,96 +131,22 @@ namespace IO.Swagger.Test
[Test]
public void GetPetByIdTest()
{
- // set timeout to 10 seconds
- Configuration c1 = new Configuration (timeout: 10000, userAgent: "TEST_USER_AGENT");
-
- PetApi petApi = new PetApi (c1);
- Pet response = petApi.GetPetById (petId);
- Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet");
-
- Assert.AreEqual ("Csharp test", response.Name);
- Assert.AreEqual (Pet.StatusEnum.Available, response.Status);
-
- Assert.IsInstanceOfType(typeof(List), response.Tags, "Response.Tags is a Array");
- Assert.AreEqual (petId, response.Tags [0].Id);
- Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name);
-
- Assert.IsInstanceOfType(typeof(List), response.PhotoUrls, "Response.PhotoUrls is a Array");
- Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]);
-
- Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category");
- Assert.AreEqual (56, response.Category.Id);
- Assert.AreEqual ("sample category name2", response.Category.Name);
+ // TODO uncomment below to test the method and replace null with proper value
+ //long? petId = null;
+ //var response = instance.GetPetById(petId);
+ //Assert.IsInstanceOf (response, "response is Pet");
}
-
- ///
- /// Test GetPetByIdAsync
- ///
- [Test ()]
- public void TestGetPetByIdAsync ()
- {
- PetApi petApi = new PetApi ();
- var task = petApi.GetPetByIdAsync (petId);
- Pet response = task.Result;
- Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet");
-
- Assert.AreEqual ("Csharp test", response.Name);
- Assert.AreEqual (Pet.StatusEnum.Available, response.Status);
-
- Assert.IsInstanceOfType(typeof(List), response.Tags, "Response.Tags is a Array");
- Assert.AreEqual (petId, response.Tags [0].Id);
- Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name);
-
- Assert.IsInstanceOfType(typeof(List), response.PhotoUrls, "Response.PhotoUrls is a Array");
- Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]);
-
- Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category");
- Assert.AreEqual (56, response.Category.Id);
- Assert.AreEqual ("sample category name2", response.Category.Name);
-
- }
- ///
- /// Test GetPetByIdAsyncWithHttpInfo
- ///
- [Test ()]
- public void TestGetPetByIdAsyncWithHttpInfo ()
- {
- PetApi petApi = new PetApi ();
- var task = petApi.GetPetByIdAsyncWithHttpInfo (petId);
-
- Assert.AreEqual (200, task.Result.StatusCode);
- Assert.IsTrue (task.Result.Headers.ContainsKey("Content-Type"));
- Assert.AreEqual (task.Result.Headers["Content-Type"], "application/json");
-
- Pet response = task.Result.Data;
- Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet");
-
- Assert.AreEqual ("Csharp test", response.Name);
- Assert.AreEqual (Pet.StatusEnum.Available, response.Status);
-
- Assert.IsInstanceOfType(typeof(List), response.Tags, "Response.Tags is a Array");
- Assert.AreEqual (petId, response.Tags [0].Id);
- Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name);
-
- Assert.IsInstanceOfType(typeof(List), response.PhotoUrls, "Response.PhotoUrls is a Array");
- Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]);
-
- Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category");
- Assert.AreEqual (56, response.Category.Id);
- Assert.AreEqual ("sample category name2", response.Category.Name);
-
- }
-
///
/// Test UpdatePet
///
[Test]
public void UpdatePetTest()
{
- // create pet
- Pet p = createPet();
- instance.UpdatePet(p);
+ // TODO uncomment below to test the method and replace null with proper value
+ //Pet body = null;
+ //instance.UpdatePet(body);
+
}
///
@@ -254,24 +155,12 @@ namespace IO.Swagger.Test
[Test]
public void UpdatePetWithFormTest()
{
- PetApi petApi = new PetApi ();
- petApi.UpdatePetWithForm (petId, "new form name", "pending");
-
- Pet response = petApi.GetPetById (petId);
- Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet");
- Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category");
- Assert.IsInstanceOfType(typeof(List), response.Tags, "Response.Tags is a Array");
-
- Assert.AreEqual ("new form name", response.Name);
- Assert.AreEqual (Pet.StatusEnum.Pending, response.Status);
-
- Assert.AreEqual (petId, response.Tags [0].Id);
- Assert.AreEqual (56, response.Category.Id);
-
- // test optional parameter
- petApi.UpdatePetWithForm (petId, "new form name2");
- Pet response2 = petApi.GetPetById (petId);
- Assert.AreEqual ("new form name2", response2.Name);
+ // TODO uncomment below to test the method and replace null with proper value
+ //long? petId = null;
+ //string name = null;
+ //string status = null;
+ //instance.UpdatePetWithForm(petId, name, status);
+
}
///
@@ -280,45 +169,13 @@ namespace IO.Swagger.Test
[Test]
public void UploadFileTest()
{
- Assembly _assembly = Assembly.GetExecutingAssembly();
- Stream _imageStream = _assembly.GetManifestResourceStream("IO.Swagger.Test.swagger-logo.png");
- PetApi petApi = new PetApi ();
- // test file upload with form parameters
- petApi.UploadFile(petId, "new form name", _imageStream);
-
- // test file upload without any form parameters
- // using optional parameter syntax introduced at .net 4.0
- petApi.UploadFile(petId: petId, file: _imageStream);
-
+ // TODO uncomment below to test the method and replace null with proper value
+ //long? petId = null;
+ //string additionalMetadata = null;
+ //System.IO.Stream file = null;
+ //var response = instance.UploadFile(petId, additionalMetadata, file);
+ //Assert.IsInstanceOf (response, "response is ApiResponse");
}
-
- ///
- /// Test status code
- ///
- [Test ()]
- public void TestStatusCodeAndHeader ()
- {
- PetApi petApi = new PetApi ();
- var response = petApi.GetPetByIdWithHttpInfo (petId);
- Assert.AreEqual (response.StatusCode, 200);
- Assert.IsTrue (response.Headers.ContainsKey("Content-Type"));
- Assert.AreEqual (response.Headers["Content-Type"], "application/json");
- }
-
- ///
- /// Test default header (should be deprecated
- ///
- [Test ()]
- public void TestDefaultHeader ()
- {
- PetApi petApi = new PetApi ();
- // commented out the warning test below as it's confirmed the warning is working as expected
- // there should be a warning for using AddDefaultHeader (deprecated) below
- //petApi.AddDefaultHeader ("header_key", "header_value");
- // the following should be used instead as suggested in the doc
- petApi.Configuration.AddDefaultHeader ("header_key2", "header_value2");
-
- }
}
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs
index 2ca3b35f30df..b7de1d862dcf 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs
@@ -1,3 +1,25 @@
+/*
+ * Swagger Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
using System;
using System.IO;
using System.Collections.Generic;
@@ -6,7 +28,6 @@ using System.Linq;
using System.Reflection;
using RestSharp;
using NUnit.Framework;
-using Newtonsoft.Json;
using IO.Swagger.Client;
using IO.Swagger.Api;
@@ -32,7 +53,7 @@ namespace IO.Swagger.Test
[SetUp]
public void Init()
{
- instance = new StoreApi();
+ instance = new StoreApi();
}
///
@@ -50,7 +71,8 @@ namespace IO.Swagger.Test
[Test]
public void InstanceTest()
{
- Assert.IsInstanceOfType(typeof(StoreApi), instance, "instance is a StoreApi");
+ // TODO uncomment below to test 'IsInstanceOfType' StoreApi
+ //Assert.IsInstanceOfType(typeof(StoreApi), instance, "instance is a StoreApi");
}
@@ -60,8 +82,8 @@ namespace IO.Swagger.Test
[Test]
public void DeleteOrderTest()
{
- // TODO: add unit test for the method 'DeleteOrder'
- //string orderId = null; // TODO: replace null with proper value
+ // TODO uncomment below to test the method and replace null with proper value
+ //string orderId = null;
//instance.DeleteOrder(orderId);
}
@@ -72,20 +94,9 @@ namespace IO.Swagger.Test
[Test]
public void GetInventoryTest()
{
- // TODO: add unit test for the method 'GetInventory'
+ // TODO uncomment below to test the method and replace null with proper value
//var response = instance.GetInventory();
//Assert.IsInstanceOf> (response, "response is Dictionary");
-
- // set timeout to 10 seconds
- Configuration c1 = new Configuration (timeout: 10000);
-
- StoreApi storeApi = new StoreApi (c1);
- Dictionary response = storeApi.GetInventory ();
-
- foreach(KeyValuePair entry in response)
- {
- Assert.IsInstanceOfType(typeof(int?), entry.Value);
- }
}
///
@@ -94,8 +105,8 @@ namespace IO.Swagger.Test
[Test]
public void GetOrderByIdTest()
{
- // TODO: add unit test for the method 'GetOrderById'
- //long? orderId = null; // TODO: replace null with proper value
+ // TODO uncomment below to test the method and replace null with proper value
+ //long? orderId = null;
//var response = instance.GetOrderById(orderId);
//Assert.IsInstanceOf (response, "response is Order");
}
@@ -106,42 +117,12 @@ namespace IO.Swagger.Test
[Test]
public void PlaceOrderTest()
{
- // TODO: add unit test for the method 'PlaceOrder'
- //Order body = null; // TODO: replace null with proper value
+ // TODO uncomment below to test the method and replace null with proper value
+ //Order body = null;
//var response = instance.PlaceOrder(body);
//Assert.IsInstanceOf (response, "response is Order");
}
- ///
- /// Test Enum
- ///
- [Test ()]
- public void TestEnum ()
- {
- Assert.AreEqual (Order.StatusEnum.Approved.ToString(), "Approved");
- }
-
- ///
- /// Test deserialization of JSON to Order and its readonly property
- ///
- [Test ()]
- public void TesOrderDeserialization()
- {
- string json = @"{
-'id': 1982,
-'petId': 1020,
-'quantity': 1,
-'status': 'placed',
-'complete': true,
-}";
- var o = JsonConvert.DeserializeObject(json);
- Assert.AreEqual (1982, o.Id);
- Assert.AreEqual (1020, o.PetId);
- Assert.AreEqual (1, o.Quantity);
- Assert.AreEqual (Order.StatusEnum.Placed, o.Status);
- Assert.AreEqual (true, o.Complete);
-
- }
}
}
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs
index 31edf4929234..ff5fdf17ad82 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs
@@ -1,3 +1,25 @@
+/*
+ * Swagger Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
using System;
using System.IO;
using System.Collections.Generic;
@@ -31,7 +53,7 @@ namespace IO.Swagger.Test
[SetUp]
public void Init()
{
- instance = new UserApi();
+ instance = new UserApi();
}
///
@@ -49,7 +71,8 @@ namespace IO.Swagger.Test
[Test]
public void InstanceTest()
{
- Assert.IsInstanceOfType(typeof(UserApi), instance, "instance is a UserApi");
+ // TODO uncomment below to test 'IsInstanceOfType' UserApi
+ //Assert.IsInstanceOfType(typeof(UserApi), instance, "instance is a UserApi");
}
@@ -59,8 +82,8 @@ namespace IO.Swagger.Test
[Test]
public void CreateUserTest()
{
- // TODO: add unit test for the method 'CreateUser'
- //User body = null; // TODO: replace null with proper value
+ // TODO uncomment below to test the method and replace null with proper value
+ //User body = null;
//instance.CreateUser(body);
}
@@ -71,8 +94,8 @@ namespace IO.Swagger.Test
[Test]
public void CreateUsersWithArrayInputTest()
{
- // TODO: add unit test for the method 'CreateUsersWithArrayInput'
- //List body = null; // TODO: replace null with proper value
+ // TODO uncomment below to test the method and replace null with proper value
+ //List body = null;
//instance.CreateUsersWithArrayInput(body);
}
@@ -83,8 +106,8 @@ namespace IO.Swagger.Test
[Test]
public void CreateUsersWithListInputTest()
{
- // TODO: add unit test for the method 'CreateUsersWithListInput'
- //List body = null; // TODO: replace null with proper value
+ // TODO uncomment below to test the method and replace null with proper value
+ //List body = null;
//instance.CreateUsersWithListInput(body);
}
@@ -95,8 +118,8 @@ namespace IO.Swagger.Test
[Test]
public void DeleteUserTest()
{
- // TODO: add unit test for the method 'DeleteUser'
- //string username = null; // TODO: replace null with proper value
+ // TODO uncomment below to test the method and replace null with proper value
+ //string username = null;
//instance.DeleteUser(username);
}
@@ -107,8 +130,8 @@ namespace IO.Swagger.Test
[Test]
public void GetUserByNameTest()
{
- // TODO: add unit test for the method 'GetUserByName'
- //string username = null; // TODO: replace null with proper value
+ // TODO uncomment below to test the method and replace null with proper value
+ //string username = null;
//var response = instance.GetUserByName(username);
//Assert.IsInstanceOf (response, "response is User");
}
@@ -119,9 +142,9 @@ namespace IO.Swagger.Test
[Test]
public void LoginUserTest()
{
- // TODO: add unit test for the method 'LoginUser'
- //string username = null; // TODO: replace null with proper value
- //string password = null; // TODO: replace null with proper value
+ // TODO uncomment below to test the method and replace null with proper value
+ //string username = null;
+ //string password = null;
//var response = instance.LoginUser(username, password);
//Assert.IsInstanceOf (response, "response is string");
}
@@ -132,7 +155,7 @@ namespace IO.Swagger.Test
[Test]
public void LogoutUserTest()
{
- // TODO: add unit test for the method 'LogoutUser'
+ // TODO uncomment below to test the method and replace null with proper value
//instance.LogoutUser();
}
@@ -143,9 +166,9 @@ namespace IO.Swagger.Test
[Test]
public void UpdateUserTest()
{
- // TODO: add unit test for the method 'UpdateUser'
- //string username = null; // TODO: replace null with proper value
- //User body = null; // TODO: replace null with proper value
+ // TODO uncomment below to test the method and replace null with proper value
+ //string username = null;
+ //User body = null;
//instance.UpdateUser(username, body);
}
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs
index 4f31bc0b3028..8b10afdeb0e6 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs
@@ -13,6 +13,13 @@ namespace IO.Swagger.Test
{
}
+ [SetUp()]
+ public void BeforeEach()
+ {
+ var config = new GlobalConfiguration();
+ Configuration.Default = config;
+ }
+
[TearDown()]
public void TearDown()
{
@@ -117,33 +124,5 @@ namespace IO.Swagger.Test
Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename(".\\sun.gif"));
}
-
- [Test ()]
- public void TestApiClientInstance ()
- {
- PetApi p1 = new PetApi ();
- PetApi p2 = new PetApi ();
-
- Configuration c1 = new Configuration (); // using default ApiClient
- PetApi p3 = new PetApi (c1);
-
- ApiClient a1 = new ApiClient();
- Configuration c2 = new Configuration (a1); // using "a1" as the ApiClient
- PetApi p4 = new PetApi (c2);
-
-
- // ensure both using the same default ApiClient
- Assert.AreSame(p1.Configuration.ApiClient, p2.Configuration.ApiClient);
- Assert.AreSame(p1.Configuration.ApiClient, Configuration.Default.ApiClient);
-
- // ensure both using the same default ApiClient
- Assert.AreSame(p3.Configuration.ApiClient, c1.ApiClient);
- Assert.AreSame(p3.Configuration.ApiClient, Configuration.Default.ApiClient);
-
- // ensure it's not using the default ApiClient
- Assert.AreSame(p4.Configuration.ApiClient, c2.ApiClient);
- Assert.AreNotSame(p4.Configuration.ApiClient, Configuration.Default.ApiClient);
-
- }
}
}
\ No newline at end of file
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs
index 936751317abc..f2af87bb2426 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs
@@ -13,9 +13,12 @@ namespace IO.Swagger.Test
{
}
- [TearDown ()]
- public void TearDown ()
+ [SetUp()]
+ public void BeforeEach()
{
+ var config = new GlobalConfiguration();
+ Configuration.Default = config;
+
// Reset to default, just in case
Configuration.Default.DateTimeFormat = "o";
}
@@ -35,7 +38,7 @@ namespace IO.Swagger.Test
[Test ()]
public void TestBasePath ()
- {
+ {
PetApi p = new PetApi ("http://new-basepath.com");
Assert.AreEqual (p.Configuration.ApiClient.RestClient.BaseUrl, "http://new-basepath.com");
// Given that PetApi is initailized with a base path, a new configuration (with a new ApiClient)
@@ -59,10 +62,20 @@ namespace IO.Swagger.Test
Assert.AreEqual("u", Configuration.Default.DateTimeFormat);
}
- [Test ()]
- public void TestConstructor()
+ [Test()]
+ public void TestDateTimeFormat_UType_NonGlobal()
{
- Configuration c = new Configuration (username: "test username", password: "test password");
+ Configuration configuration = new Configuration();
+ configuration.DateTimeFormat = "u";
+
+ Assert.AreEqual("u", configuration.DateTimeFormat);
+ Assert.AreNotEqual("u", Configuration.Default.DateTimeFormat);
+ }
+
+ [Test ()]
+ public void TestConstruction()
+ {
+ Configuration c = new Configuration { Username = "test username", Password = "test password" };
Assert.AreEqual (c.Username, "test username");
Assert.AreEqual (c.Password, "test password");
@@ -70,7 +83,7 @@ namespace IO.Swagger.Test
[Test ()]
public void TestDefautlConfiguration ()
- {
+ {
PetApi p1 = new PetApi ();
PetApi p2 = new PetApi ();
Assert.AreSame (p1.Configuration, p2.Configuration);
@@ -92,7 +105,7 @@ namespace IO.Swagger.Test
public void TestUsage ()
{
// basic use case using default base URL
- PetApi p1 = new PetApi ();
+ PetApi p1 = new PetApi ();
Assert.AreSame (p1.Configuration, Configuration.Default, "PetApi should use default configuration");
// using a different base URL
@@ -104,11 +117,11 @@ namespace IO.Swagger.Test
PetApi p3 = new PetApi (c1);
Assert.AreSame (p3.Configuration, c1);
- // using a different base URL via a new ApiClient
- ApiClient a1 = new ApiClient ("http://new-api-client.com");
- Configuration c2 = new Configuration (a1);
+ // using a different base URL via a new Configuration
+ String newApiClientUrl = "http://new-api-client.com";
+ Configuration c2 = new Configuration { BasePath = newApiClientUrl };
PetApi p4 = new PetApi (c2);
- Assert.AreSame (p4.Configuration.ApiClient, a1);
+ Assert.AreEqual(p4.Configuration.ApiClient.RestClient.BaseUrl, new Uri(newApiClientUrl));
}
[Test ()]
@@ -120,10 +133,39 @@ namespace IO.Swagger.Test
c1.Timeout = 50000;
Assert.AreEqual (50000, c1.Timeout);
- Configuration c2 = new Configuration (timeout: 20000);
+ Configuration c2 = new Configuration { Timeout = 20000 };
Assert.AreEqual (20000, c2.Timeout);
}
+ [Test()]
+ public void TestAddingInstanceHeadersDoesNotModifyGlobal()
+ {
+ // Arrange
+ Configuration.Default.DefaultHeader.Add("Content-Type", "application/json");
+ Configuration.Default.ApiKey.Add("api_key_identifier", "1233456778889900");
+ Configuration.Default.ApiKeyPrefix.Add("api_key_identifier", "PREFIX");
+
+ Configuration c = new Configuration(
+ Configuration.Default.DefaultHeader,
+ Configuration.Default.ApiKey,
+ Configuration.Default.ApiKeyPrefix
+ );
+
+ // sanity
+ CollectionAssert.AreEquivalent(c.DefaultHeader, Configuration.Default.DefaultHeader);
+ CollectionAssert.AreEquivalent(c.ApiKey, Configuration.Default.ApiKey);
+ CollectionAssert.AreEquivalent(c.ApiKeyPrefix, Configuration.Default.ApiKeyPrefix);
+
+ // Act
+ Configuration.Default.DefaultHeader["Content-Type"] = "application/xml";
+ Configuration.Default.ApiKey["api_key_identifier"] = "00000000000001234";
+ Configuration.Default.ApiKeyPrefix["api_key_identifier"] = "MODIFIED";
+
+ // Assert
+ CollectionAssert.AreNotEquivalent(c.DefaultHeader, Configuration.Default.DefaultHeader);
+ CollectionAssert.AreNotEquivalent(c.ApiKey, Configuration.Default.ApiKey);
+ CollectionAssert.AreNotEquivalent(c.ApiKeyPrefix, Configuration.Default.ApiKeyPrefix);
+ }
}
}
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj
index 3122ce1f81ca..ca11ccbf6153 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj
@@ -7,6 +7,18 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod
OpenAPI spec version: 1.0.0
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-->
@@ -75,7 +87,7 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git
- {1230F4B8-71F8-4A8C-966F-2E10106EA239}
+ {391DEE9D-C48B-4846-838D-E96F4BC01E1D}
IO.Swagger
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs
index 9cedd3045da6..a44a589dc88d 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs
@@ -416,15 +416,9 @@ namespace IO.Swagger.Api
///
public FakeApi(String basePath)
{
- this.Configuration = new Configuration(new ApiClient(basePath));
+ this.Configuration = new Configuration { BasePath = basePath };
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
-
- // ensure API client has configuration ready
- if (Configuration.ApiClient.Configuration == null)
- {
- this.Configuration.ApiClient.Configuration = this.Configuration;
- }
}
///
@@ -441,12 +435,6 @@ namespace IO.Swagger.Api
this.Configuration = configuration;
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
-
- // ensure API client has configuration ready
- if (Configuration.ApiClient.Configuration == null)
- {
- this.Configuration.ApiClient.Configuration = this.Configuration;
- }
}
///
@@ -495,9 +483,9 @@ namespace IO.Swagger.Api
///
/// Dictionary of HTTP header
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
- public Dictionary DefaultHeader()
+ public IDictionary DefaultHeader()
{
- return this.Configuration.DefaultHeader;
+ return new ReadOnlyDictionary(this.Configuration.DefaultHeader);
}
///
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/Fake_classname_tags123Api.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/Fake_classname_tags123Api.cs
index a2ac952b00a7..72d9b04836b3 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/Fake_classname_tags123Api.cs
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/Fake_classname_tags123Api.cs
@@ -84,15 +84,9 @@ namespace IO.Swagger.Api
///
public Fake_classname_tags123Api(String basePath)
{
- this.Configuration = new Configuration(new ApiClient(basePath));
+ this.Configuration = new Configuration { BasePath = basePath };
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
-
- // ensure API client has configuration ready
- if (Configuration.ApiClient.Configuration == null)
- {
- this.Configuration.ApiClient.Configuration = this.Configuration;
- }
}
///
@@ -109,12 +103,6 @@ namespace IO.Swagger.Api
this.Configuration = configuration;
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
-
- // ensure API client has configuration ready
- if (Configuration.ApiClient.Configuration == null)
- {
- this.Configuration.ApiClient.Configuration = this.Configuration;
- }
}
///
@@ -163,9 +151,9 @@ namespace IO.Swagger.Api
///
/// Dictionary of HTTP header
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
- public Dictionary DefaultHeader()
+ public IDictionary DefaultHeader()
{
- return this.Configuration.DefaultHeader;
+ return new ReadOnlyDictionary(this.Configuration.DefaultHeader);
}
///
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/PetApi.cs
index 3d1f1ea9c608..6ebddb476f46 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/PetApi.cs
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/PetApi.cs
@@ -398,15 +398,9 @@ namespace IO.Swagger.Api
///
public PetApi(String basePath)
{
- this.Configuration = new Configuration(new ApiClient(basePath));
+ this.Configuration = new Configuration { BasePath = basePath };
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
-
- // ensure API client has configuration ready
- if (Configuration.ApiClient.Configuration == null)
- {
- this.Configuration.ApiClient.Configuration = this.Configuration;
- }
}
///
@@ -423,12 +417,6 @@ namespace IO.Swagger.Api
this.Configuration = configuration;
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
-
- // ensure API client has configuration ready
- if (Configuration.ApiClient.Configuration == null)
- {
- this.Configuration.ApiClient.Configuration = this.Configuration;
- }
}
///
@@ -477,9 +465,9 @@ namespace IO.Swagger.Api
///
/// Dictionary of HTTP header
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
- public Dictionary DefaultHeader()
+ public IDictionary DefaultHeader()
{
- return this.Configuration.DefaultHeader;
+ return new ReadOnlyDictionary(this.Configuration.DefaultHeader);
}
///
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/StoreApi.cs
index 04cd66ef1172..1317209a857c 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/StoreApi.cs
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/StoreApi.cs
@@ -206,15 +206,9 @@ namespace IO.Swagger.Api
///
public StoreApi(String basePath)
{
- this.Configuration = new Configuration(new ApiClient(basePath));
+ this.Configuration = new Configuration { BasePath = basePath };
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
-
- // ensure API client has configuration ready
- if (Configuration.ApiClient.Configuration == null)
- {
- this.Configuration.ApiClient.Configuration = this.Configuration;
- }
}
///
@@ -231,12 +225,6 @@ namespace IO.Swagger.Api
this.Configuration = configuration;
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
-
- // ensure API client has configuration ready
- if (Configuration.ApiClient.Configuration == null)
- {
- this.Configuration.ApiClient.Configuration = this.Configuration;
- }
}
///
@@ -285,9 +273,9 @@ namespace IO.Swagger.Api
///
/// Dictionary of HTTP header
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
- public Dictionary DefaultHeader()
+ public IDictionary DefaultHeader()
{
- return this.Configuration.DefaultHeader;
+ return new ReadOnlyDictionary(this.Configuration.DefaultHeader);
}
///
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs
index 81e0a6fb4c7f..8fe02dff0ec1 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs
@@ -382,15 +382,9 @@ namespace IO.Swagger.Api
///
public UserApi(String basePath)
{
- this.Configuration = new Configuration(new ApiClient(basePath));
+ this.Configuration = new Configuration { BasePath = basePath };
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
-
- // ensure API client has configuration ready
- if (Configuration.ApiClient.Configuration == null)
- {
- this.Configuration.ApiClient.Configuration = this.Configuration;
- }
}
///
@@ -407,12 +401,6 @@ namespace IO.Swagger.Api
this.Configuration = configuration;
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
-
- // ensure API client has configuration ready
- if (Configuration.ApiClient.Configuration == null)
- {
- this.Configuration.ApiClient.Configuration = this.Configuration;
- }
}
///
@@ -461,9 +449,9 @@ namespace IO.Swagger.Api
///
/// Dictionary of HTTP header
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
- public Dictionary DefaultHeader()
+ public IDictionary DefaultHeader()
{
- return this.Configuration.DefaultHeader;
+ return new ReadOnlyDictionary(this.Configuration.DefaultHeader);
}
///
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs
index 6531cc1a0261..32545398ce45 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs
@@ -48,11 +48,11 @@ namespace IO.Swagger.Client
///
/// Initializes a new instance of the class
- /// with default configuration and base path (http://petstore.swagger.io:80/v2).
+ /// with default configuration.
///
public ApiClient()
{
- Configuration = Configuration.Default;
+ Configuration = IO.Swagger.Client.Configuration.Default;
RestClient = new RestClient("http://petstore.swagger.io:80/v2");
}
@@ -61,14 +61,11 @@ namespace IO.Swagger.Client
/// with default base path (http://petstore.swagger.io:80/v2).
///
/// An instance of Configuration.
- public ApiClient(Configuration config = null)
+ public ApiClient(Configuration config)
{
- if (config == null)
- Configuration = Configuration.Default;
- else
- Configuration = config;
+ Configuration = config ?? IO.Swagger.Client.Configuration.Default;
- RestClient = new RestClient("http://petstore.swagger.io:80/v2");
+ RestClient = new RestClient(Configuration.BasePath);
}
///
@@ -82,7 +79,7 @@ namespace IO.Swagger.Client
throw new ArgumentException("basePath cannot be empty");
RestClient = new RestClient(basePath);
- Configuration = Configuration.Default;
+ Configuration = Client.Configuration.Default;
}
///
@@ -93,10 +90,15 @@ namespace IO.Swagger.Client
public static ApiClient Default;
///
- /// Gets or sets the Configuration.
+ /// Gets or sets an instance of the IReadableConfiguration.
///
- /// An instance of the Configuration.
- public Configuration Configuration { get; set; }
+ /// An instance of the IReadableConfiguration.
+ ///
+ /// helps us to avoid modifying possibly global
+ /// configuration values from within a given client. It does not gaurantee thread-safety
+ /// of the instance in any way.
+ ///
+ public IReadableConfiguration Configuration { get; set; }
///
/// Gets or sets the RestClient.
@@ -174,6 +176,7 @@ namespace IO.Swagger.Client
pathParams, contentType);
// set timeout
+
RestClient.Timeout = Configuration.Timeout;
// set user agent
RestClient.UserAgent = Configuration.UserAgent;
@@ -286,6 +289,7 @@ namespace IO.Swagger.Client
return response.RawBytes;
}
+ // TODO: ? if (type.IsAssignableFrom(typeof(Stream)))
if (type == typeof(Stream))
{
if (headers != null)
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs
index fce50ae0b743..1e1e12c35229 100644
--- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs
@@ -10,6 +10,7 @@
using System;
using System.Reflection;
+using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -20,10 +21,147 @@ namespace IO.Swagger.Client
///
/// Represents a set of configuration settings
///
- public class Configuration
+ public class Configuration : IReadableConfiguration
{
+ #region Constants
+
///
- /// Initializes a new instance of the Configuration class with different settings
+ /// Version of the package.
+ ///
+ /// Version of the package.
+ public const string Version = "1.0.0";
+
+ ///
+ /// Identifier for ISO 8601 DateTime Format
+ ///
+ /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information.
+ // ReSharper disable once InconsistentNaming
+ public const string ISO8601_DATETIME_FORMAT = "o";
+
+ #endregion Constants
+
+ #region Static Members
+
+ private static readonly object GlobalConfigSync = new { };
+ private static Configuration _globalConfiguration;
+
+ ///
+ /// Default creation of exceptions for a given method name and response object
+ ///
+ public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) =>
+ {
+ var status = (int)response.StatusCode;
+ if (status >= 400)
+ {
+ return new ApiException(status,
+ string.Format("Error calling {0}: {1}", methodName, response.Content),
+ response.Content);
+ }
+ if (status == 0)
+ {
+ return new ApiException(status,
+ string.Format("Error calling {0}: {1}", methodName, response.ErrorMessage), response.ErrorMessage);
+ }
+ return null;
+ };
+
+ ///
+ /// Gets or sets the default Configuration.
+ ///
+ /// Configuration.
+ public static Configuration Default
+ {
+ get { return _globalConfiguration; }
+ set
+ {
+ lock (GlobalConfigSync)
+ {
+ _globalConfiguration = value;
+ }
+ }
+ }
+
+ #endregion Static Members
+
+ #region Private Members
+
+ ///
+ /// Gets or sets the API key based on the authentication name.
+ ///
+ /// The API key.
+ private IDictionary _apiKey = null;
+
+ ///
+ /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
+ ///
+ /// The prefix of the API key.
+ private IDictionary _apiKeyPrefix = null;
+
+ private string _dateTimeFormat = ISO8601_DATETIME_FORMAT;
+ private string _tempFolderPath = Path.GetTempPath();
+
+ #endregion Private Members
+
+ #region Constructors
+
+ static Configuration()
+ {
+ _globalConfiguration = new GlobalConfiguration();
+ }
+
+ ///
+ /// Initializes a new instance of the class
+ ///
+ public Configuration()
+ {
+ UserAgent = "Swagger-Codegen/1.0.0/csharp";
+ BasePath = "http://petstore.swagger.io:80/v2";
+ DefaultHeader = new ConcurrentDictionary();
+ ApiKey = new ConcurrentDictionary();
+ ApiKeyPrefix = new ConcurrentDictionary();
+
+ // Setting Timeout has side effects (forces ApiClient creation).
+ Timeout = 100000;
+ }
+
+ ///
+ /// Initializes a new instance of the class
+ ///
+ public Configuration(
+ IDictionary defaultHeader,
+ IDictionary apiKey,
+ IDictionary apiKeyPrefix,
+ string basePath = "http://petstore.swagger.io:80/v2") : this()
+ {
+ if (string.IsNullOrWhiteSpace(basePath))
+ throw new ArgumentException("The provided basePath is invalid.", "basePath");
+ if (defaultHeader == null)
+ throw new ArgumentNullException("defaultHeader");
+ if (apiKey == null)
+ throw new ArgumentNullException("apiKey");
+ if (apiKeyPrefix == null)
+ throw new ArgumentNullException("apiKeyPrefix");
+
+ BasePath = basePath;
+
+ foreach (var keyValuePair in defaultHeader)
+ {
+ DefaultHeader.Add(keyValuePair);
+ }
+
+ foreach (var keyValuePair in apiKey)
+ {
+ ApiKey.Add(keyValuePair);
+ }
+
+ foreach (var keyValuePair in apiKeyPrefix)
+ {
+ ApiKeyPrefix.Add(keyValuePair);
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the class with different settings
///
/// Api client
/// Dictionary of default HTTP header
@@ -36,129 +174,224 @@ namespace IO.Swagger.Client
/// DateTime format string
/// HTTP connection timeout (in milliseconds)
/// HTTP user agent
- public Configuration(ApiClient apiClient = null,
- Dictionary defaultHeader = null,
- string username = null,
- string password = null,
- string accessToken = null,
- Dictionary apiKey = null,
- Dictionary apiKeyPrefix = null,
- string tempFolderPath = null,
- string dateTimeFormat = null,
- int timeout = 100000,
- string userAgent = "Swagger-Codegen/1.0.0/csharp"
- )
+ [Obsolete("Use explicit object construction and setting of properties.", true)]
+ public Configuration(
+ // ReSharper disable UnusedParameter.Local
+ ApiClient apiClient = null,
+ IDictionary defaultHeader = null,
+ string username = null,
+ string password = null,
+ string accessToken = null,
+ IDictionary apiKey = null,
+ IDictionary apiKeyPrefix = null,
+ string tempFolderPath = null,
+ string dateTimeFormat = null,
+ int timeout = 100000,
+ string userAgent = "Swagger-Codegen/1.0.0/csharp"
+ // ReSharper restore UnusedParameter.Local
+ )
{
- setApiClientUsingDefault(apiClient);
- Username = username;
- Password = password;
- AccessToken = accessToken;
- UserAgent = userAgent;
-
- if (defaultHeader != null)
- DefaultHeader = defaultHeader;
- if (apiKey != null)
- ApiKey = apiKey;
- if (apiKeyPrefix != null)
- ApiKeyPrefix = apiKeyPrefix;
-
- TempFolderPath = tempFolderPath;
- DateTimeFormat = dateTimeFormat;
- Timeout = timeout;
}
///
/// Initializes a new instance of the Configuration class.
///
/// Api client.
+ [Obsolete("This constructor caused unexpected sharing of static data. It is no longer supported.", true)]
+ // ReSharper disable once UnusedParameter.Local
public Configuration(ApiClient apiClient)
{
- setApiClientUsingDefault(apiClient);
+
}
- ///
- /// Version of the package.
- ///
- /// Version of the package.
- public const string Version = "1.0.0";
+ #endregion Constructors
- ///
- /// Gets or sets the default Configuration.
- ///
- /// Configuration.
- public static Configuration Default = new Configuration();
+ #region Properties
+
+ private ApiClient _apiClient = null;
///
- /// Default creation of exceptions for a given method name and response object
+ /// Gets an instance of an ApiClient for this configuration
///
- public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) =>
+ public virtual ApiClient ApiClient
{
- int status = (int) response.StatusCode;
- if (status >= 400) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.Content), response.Content);
- if (status == 0) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.ErrorMessage), response.ErrorMessage);
- return null;
- };
-
- ///
- /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
- ///
- /// Timeout.
- public int Timeout
- {
- get { return ApiClient.RestClient.Timeout; }
-
- set
+ get
{
- if (ApiClient != null)
- ApiClient.RestClient.Timeout = value;
+ if (_apiClient == null) _apiClient = CreateApiClient();
+ return _apiClient;
}
}
+ private String _basePath = null;
///
- /// Gets or sets the default API client for making HTTP calls.
+ /// Gets or sets the base path for API access.
///
- /// The API client.
- public ApiClient ApiClient;
-
- ///
- /// Set the ApiClient using Default or ApiClient instance.
- ///
- /// An instance of ApiClient.
- ///
- public void setApiClientUsingDefault (ApiClient apiClient = null)
- {
- if (apiClient == null)
- {
- if (Default != null && Default.ApiClient == null)
- Default.ApiClient = new ApiClient();
-
- ApiClient = Default != null ? Default.ApiClient : new ApiClient();
- }
- else
- {
- if (Default != null && Default.ApiClient == null)
- Default.ApiClient = apiClient;
-
- ApiClient = apiClient;
+ public virtual string BasePath {
+ get { return _basePath; }
+ set {
+ _basePath = value;
+ // pass-through to ApiClient if it's set.
+ if(_apiClient != null) {
+ _apiClient.RestClient.BaseUrl = new Uri(_basePath);
+ }
}
}
- private Dictionary _defaultHeaderMap = new Dictionary();
-
///
/// Gets or sets the default header.
///
- public Dictionary DefaultHeader
+ public virtual IDictionary DefaultHeader { get; set; }
+
+ ///
+ /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
+ ///
+ public virtual int Timeout
{
- get { return _defaultHeaderMap; }
+
+ get { return ApiClient.RestClient.Timeout; }
+ set { ApiClient.RestClient.Timeout = value; }
+ }
+
+ ///
+ /// Gets or sets the HTTP user agent.
+ ///
+ /// Http user agent.
+ public virtual string UserAgent { get; set; }
+
+ ///
+ /// Gets or sets the username (HTTP basic authentication).
+ ///
+ /// The username.
+ public virtual string Username { get; set; }
+
+ ///
+ /// Gets or sets the password (HTTP basic authentication).
+ ///
+ /// The password.
+ public virtual string Password { get; set; }
+
+ ///
+ /// Gets or sets the access token for OAuth2 authentication.
+ ///
+ /// API key identifier (authentication scheme).
+ /// API key with prefix.
+ public string GetApiKeyWithPrefix (string apiKeyIdentifier)
+ {
+ var apiKeyValue = "";
+ ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
+ var apiKeyPrefix = "";
+ if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix))
+ return apiKeyPrefix + " " + apiKeyValue;
+ else
+ return apiKeyValue;
+ }
+
+ ///
+ /// Gets or sets the access token for OAuth2 authentication.
+ ///
+ /// The access token.
+ public virtual string AccessToken { get; set; }
+
+ ///
+ /// Gets or sets the temporary folder path to store the files downloaded from the server.
+ ///
+ /// Folder path.
+ public virtual string TempFolderPath
+ {
+ get { return _tempFolderPath; }
set
{
- _defaultHeaderMap = value;
+ if (string.IsNullOrEmpty(value))
+ {
+ // Possible breaking change since swagger-codegen 2.2.1, enforce a valid temporary path on set.
+ _tempFolderPath = Path.GetTempPath();
+ return;
+ }
+
+ // create the directory if it does not exist
+ if (!Directory.Exists(value))
+ {
+ Directory.CreateDirectory(value);
+ }
+
+ // check if the path contains directory separator at the end
+ if (value[value.Length - 1] == Path.DirectorySeparatorChar)
+ {
+ _tempFolderPath = value;
+ }
+ else
+ {
+ _tempFolderPath = value + Path.DirectorySeparatorChar;
+ }
}
}
+ ///
+ /// Gets or sets the the date time format used when serializing in the ApiClient
+ /// By default, it's set to ISO 8601 - "o", for others see:
+ /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
+ /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
+ /// No validation is done to ensure that the string you're providing is valid
+ ///
+ /// The DateTimeFormat string
+ public virtual string DateTimeFormat
+ {
+ get { return _dateTimeFormat; }
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ // Never allow a blank or null string, go back to the default
+ _dateTimeFormat = ISO8601_DATETIME_FORMAT;
+ return;
+ }
+
+ // Caution, no validation when you choose date time format other than ISO 8601
+ // Take a look at the above links
+ _dateTimeFormat = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
+ ///
+ /// The prefix of the API key.
+ public virtual IDictionary ApiKeyPrefix
+ {
+ get { return _apiKeyPrefix; }
+ set
+ {
+ if (value == null)
+ {
+ throw new InvalidOperationException("ApiKeyPrefix collection may not be null.");
+ }
+ _apiKeyPrefix = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the API key based on the authentication name.
+ ///
+ /// The API key.
+ public virtual IDictionary ApiKey
+ {
+ get { return _apiKey; }
+ set
+ {
+ if (value == null)
+ {
+ throw new InvalidOperationException("ApiKey collection may not be null.");
+ }
+ _apiKey = value;
+ }
+ }
+
+ #endregion Properties
+
+ #region Methods
+
///
/// Add default header.
///
@@ -167,7 +400,31 @@ namespace IO.Swagger.Client
///
public void AddDefaultHeader(string key, string value)
{
- _defaultHeaderMap[key] = value;
+ DefaultHeader[key] = value;
+ }
+
+ ///
+ /// Creates a new based on this instance.
+ ///
+ ///
+ public ApiClient CreateApiClient()
+ {
+ return new ApiClient(BasePath) { Configuration = this };
+ }
+
+
+ ///
+ /// Returns a string with essential information for debugging.
+ ///
+ public static String ToDebugReport()
+ {
+ String report = "C# SDK (IO.Swagger) Debug Report:\n";
+ report += " OS: " + System.Environment.OSVersion + "\n";
+ report += " .NET Framework Version: " + System.Environment.Version + "\n";
+ report += " Version of the API: 1.0.0\n";
+ report += " SDK Package Version: 1.0.0\n";
+
+ return report;
}
///
@@ -191,144 +448,6 @@ namespace IO.Swagger.Client
ApiKeyPrefix[key] = value;
}
- ///
- /// Gets or sets the HTTP user agent.
- ///
- /// Http user agent.
- public String UserAgent { get; set; }
-
- ///
- /// Gets or sets the username (HTTP basic authentication).
- ///
- /// The username.
- public String Username { get; set; }
-
- ///
- /// Gets or sets the password (HTTP basic authentication).
- ///
- /// The password.
- public String Password { get; set; }
-
- ///
- /// Gets or sets the access token for OAuth2 authentication.
- ///
- /// The access token.
- public String AccessToken { get; set; }
-
- ///
- /// Gets or sets the API key based on the authentication name.
- ///
- /// The API key.
- public Dictionary ApiKey = new Dictionary();
-
- ///
- /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
- ///
- /// The prefix of the API key.
- public Dictionary ApiKeyPrefix = new Dictionary();
-
- ///
- /// Get the API key with prefix.
- ///
- /// API key identifier (authentication scheme).
- /// API key with prefix.
- public string GetApiKeyWithPrefix (string apiKeyIdentifier)
- {
- var apiKeyValue = "";
- ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
- var apiKeyPrefix = "";
- if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix))
- return apiKeyPrefix + " " + apiKeyValue;
- else
- return apiKeyValue;
- }
-
- private string _tempFolderPath;
-
- ///
- /// Gets or sets the temporary folder path to store the files downloaded from the server.
- ///
- /// Folder path.
- public String TempFolderPath
- {
- get
- {
- // default to Path.GetTempPath() if _tempFolderPath is not set
- if (String.IsNullOrEmpty(_tempFolderPath))
- {
- _tempFolderPath = Path.GetTempPath();
- }
- return _tempFolderPath;
- }
-
- set
- {
- if (String.IsNullOrEmpty(value))
- {
- _tempFolderPath = value;
- return;
- }
-
- // create the directory if it does not exist
- if (!Directory.Exists(value))
- Directory.CreateDirectory(value);
-
- // check if the path contains directory separator at the end
- if (value[value.Length - 1] == Path.DirectorySeparatorChar)
- _tempFolderPath = value;
- else
- _tempFolderPath = value + Path.DirectorySeparatorChar;
- }
- }
-
- private const string ISO8601_DATETIME_FORMAT = "o";
-
- private string _dateTimeFormat = ISO8601_DATETIME_FORMAT;
-
- ///
- /// Gets or sets the the date time format used when serializing in the ApiClient
- /// By default, it's set to ISO 8601 - "o", for others see:
- /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
- /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
- /// No validation is done to ensure that the string you're providing is valid
- ///
- /// The DateTimeFormat string
- public String DateTimeFormat
- {
- get
- {
- return _dateTimeFormat;
- }
- set
- {
- if (string.IsNullOrEmpty(value))
- {
- // Never allow a blank or null string, go back to the default
- _dateTimeFormat = ISO8601_DATETIME_FORMAT;
- return;
- }
-
- // Caution, no validation when you choose date time format other than ISO 8601
- // Take a look at the above links
- _dateTimeFormat = value;
- }
- }
-
- ///
- /// Returns a string with essential information for debugging.
- ///
- public static String ToDebugReport()
- {
- String report = "C# SDK (IO.Swagger) Debug Report:\n";
- report += " OS: " + Environment.OSVersion + "\n";
- report += " .NET Framework Version: " + Assembly
- .GetExecutingAssembly()
- .GetReferencedAssemblies()
- .Where(x => x.Name == "System.Core").First().Version.ToString() + "\n";
- report += " Version of the API: 1.0.0\n";
- report += " SDK Package Version: 1.0.0\n";
-
- return report;
- }
+ #endregion Methods
}
}
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/GlobalConfiguration.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/GlobalConfiguration.cs
new file mode 100644
index 000000000000..d8b196fc3e8b
--- /dev/null
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/GlobalConfiguration.cs
@@ -0,0 +1,34 @@
+/*
+ * Swagger Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ */
+
+
+using System;
+using System.Reflection;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+
+namespace IO.Swagger.Client
+{
+ ///
+ /// provides a compile-time extension point for globally configuring
+ /// API Clients.
+ ///
+ ///
+ /// A customized implementation via partial class may reside in another file and may
+ /// be excluded from automatic generation via a .swagger-codegen-ignore file.
+ ///
+ public partial class GlobalConfiguration : Configuration
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/IReadableConfiguration.cs
new file mode 100644
index 000000000000..ed1b6eddeacf
--- /dev/null
+++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/IReadableConfiguration.cs
@@ -0,0 +1,35 @@
+/*
+ * Swagger Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ */
+
+
+using System.Collections.Generic;
+
+namespace IO.Swagger.Client
+{
+ ///
+ /// Represents a readable-only configuration contract.
+ ///
+ public interface IReadableConfiguration
+ {
+ string AccessToken { get; }
+ IDictionary ApiKey { get; }
+ IDictionary ApiKeyPrefix { get; }
+ string BasePath { get; }
+ string DateTimeFormat { get; }
+ IDictionary DefaultHeader { get; }
+ string Password { get; }
+ string TempFolderPath { get; }
+ int Timeout { get; }
+ string UserAgent { get; }
+ string Username { get; }
+
+ string GetApiKeyWithPrefix(string apiKeyIdentifier);
+ }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/.swagger-codegen/VERSION b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/.swagger-codegen/VERSION
new file mode 100644
index 000000000000..f9f7450d1359
--- /dev/null
+++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/.swagger-codegen/VERSION
@@ -0,0 +1 @@
+2.3.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md
index 2ffa0ef9f643..669dc91ea83d 100644
--- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md
+++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md
@@ -47,7 +47,7 @@ namespace Example
{
public void main()
{
-
+
var apiInstance = new FakeApi();
var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional)
@@ -60,6 +60,7 @@ namespace Example
{
Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message );
}
+
}
}
}
@@ -79,6 +80,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model
*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters
+*Fake_classname_tags123Api* | [**TestClassname**](docs/Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case
*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
@@ -112,10 +114,8 @@ Class | Method | HTTP request | Description
- [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [Model.ArrayTest](docs/ArrayTest.md)
- [Model.Capitalization](docs/Capitalization.md)
- - [Model.Cat](docs/Cat.md)
- [Model.Category](docs/Category.md)
- [Model.ClassModel](docs/ClassModel.md)
- - [Model.Dog](docs/Dog.md)
- [Model.EnumArrays](docs/EnumArrays.md)
- [Model.EnumClass](docs/EnumClass.md)
- [Model.EnumTest](docs/EnumTest.md)
@@ -140,6 +140,8 @@ Class | Method | HTTP request | Description
- [Model.SpecialModelName](docs/SpecialModelName.md)
- [Model.Tag](docs/Tag.md)
- [Model.User](docs/User.md)
+ - [Model.Cat](docs/Cat.md)
+ - [Model.Dog](docs/Dog.md)
diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md
index 1277461eb1d2..41bddd87b494 100644
--- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md
+++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md
@@ -35,7 +35,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new FakeApi();
var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional)
@@ -96,7 +95,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new FakeApi();
var body = new OuterComposite(); // OuterComposite | Input composite as post body (optional)
@@ -157,7 +155,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new FakeApi();
var body = new OuterNumber(); // OuterNumber | Input number as post body (optional)
@@ -218,7 +215,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new FakeApi();
var body = new OuterString(); // OuterString | Input string as post body (optional)
@@ -279,7 +275,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new FakeApi();
var body = new ModelClient(); // ModelClient | client model
@@ -341,7 +336,6 @@ namespace Example
{
public void main()
{
-
// Configure HTTP basic authorization: http_basic_test
Configuration.Default.Username = "YOUR_USERNAME";
Configuration.Default.Password = "YOUR_PASSWORD";
@@ -432,7 +426,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new FakeApi();
var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional)
var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg)
diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Fake_classname_tags123Api.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/Fake_classname_tags123Api.md
similarity index 99%
rename from samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Fake_classname_tags123Api.md
rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/Fake_classname_tags123Api.md
index eba49c5a842f..9db41af1c5d5 100644
--- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Fake_classname_tags123Api.md
+++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/Fake_classname_tags123Api.md
@@ -27,7 +27,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new Fake_classname_tags123Api();
var body = new ModelClient(); // ModelClient | client model
diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/AnimalFarm.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterBoolean.md
similarity index 89%
rename from samples/client/petstore/csharp/SwaggerClientNetStanard/docs/AnimalFarm.md
rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterBoolean.md
index 4d1cccb0cefe..84845b35e545 100644
--- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/AnimalFarm.md
+++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterBoolean.md
@@ -1,4 +1,4 @@
-# IO.Swagger.Model.AnimalFarm
+# IO.Swagger.Model.OuterBoolean
## Properties
Name | Type | Description | Notes
diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/AdditionalPropertiesClass.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterComposite.md
similarity index 53%
rename from samples/client/petstore/csharp/SwaggerClientNetStanard/docs/AdditionalPropertiesClass.md
rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterComposite.md
index ac4f9d10798e..41fae66f1363 100644
--- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/AdditionalPropertiesClass.md
+++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterComposite.md
@@ -1,10 +1,11 @@
-# IO.Swagger.Model.AdditionalPropertiesClass
+# IO.Swagger.Model.OuterComposite
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
-**MapProperty** | **Dictionary<string, string>** | | [optional]
-**MapOfMapProperty** | **Dictionary<string, Dictionary<string, string>>** | | [optional]
+**MyNumber** | [**OuterNumber**](OuterNumber.md) | | [optional]
+**MyString** | [**OuterString**](OuterString.md) | | [optional]
+**MyBoolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/EnumClass.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterNumber.md
similarity index 89%
rename from samples/client/petstore/csharp/SwaggerClientNetStanard/docs/EnumClass.md
rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterNumber.md
index d936aad6f0b2..7c88274d6ee8 100644
--- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/EnumClass.md
+++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterNumber.md
@@ -1,4 +1,4 @@
-# IO.Swagger.Model.EnumClass
+# IO.Swagger.Model.OuterNumber
## Properties
Name | Type | Description | Notes
diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/OuterEnum.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterString.md
similarity index 89%
rename from samples/client/petstore/csharp/SwaggerClientNetStanard/docs/OuterEnum.md
rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterString.md
index 55eb118a3496..524423a5dab2 100644
--- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/OuterEnum.md
+++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterString.md
@@ -1,4 +1,4 @@
-# IO.Swagger.Model.OuterEnum
+# IO.Swagger.Model.OuterString
## Properties
Name | Type | Description | Notes
diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/PetApi.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/PetApi.md
index f3f49f5ed5b8..148d49b8b88c 100644
--- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/PetApi.md
+++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/PetApi.md
@@ -36,7 +36,6 @@ namespace Example
{
public void main()
{
-
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
@@ -100,7 +99,6 @@ namespace Example
{
public void main()
{
-
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
@@ -166,7 +164,6 @@ namespace Example
{
public void main()
{
-
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
@@ -231,7 +228,6 @@ namespace Example
{
public void main()
{
-
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
@@ -296,7 +292,6 @@ namespace Example
{
public void main()
{
-
// Configure API key authorization: api_key
Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
@@ -363,7 +358,6 @@ namespace Example
{
public void main()
{
-
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
@@ -427,7 +421,6 @@ namespace Example
{
public void main()
{
-
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
@@ -495,7 +488,6 @@ namespace Example
{
public void main()
{
-
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/StoreApi.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/StoreApi.md
index bf2fdb1ed6d5..1509a03158fa 100644
--- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/StoreApi.md
+++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/StoreApi.md
@@ -32,7 +32,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new StoreApi();
var orderId = orderId_example; // string | ID of the order that needs to be deleted
@@ -93,7 +92,6 @@ namespace Example
{
public void main()
{
-
// Configure API key authorization: api_key
Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
@@ -156,7 +154,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new StoreApi();
var orderId = 789; // long? | ID of pet that needs to be fetched
@@ -218,7 +215,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new StoreApi();
var body = new Order(); // Order | order placed for purchasing the pet
diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/UserApi.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/UserApi.md
index 78553f5b3854..0ddde3f669c8 100644
--- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/UserApi.md
+++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/UserApi.md
@@ -36,7 +36,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new UserApi();
var body = new User(); // User | Created user object
@@ -97,7 +96,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new UserApi();
var body = new List(); // List | List of user object
@@ -158,7 +156,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new UserApi();
var body = new List(); // List | List of user object
@@ -219,7 +216,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new UserApi();
var username = username_example; // string | The name that needs to be deleted
@@ -280,7 +276,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new UserApi();
var username = username_example; // string | The name that needs to be fetched. Use user1 for testing.
@@ -342,7 +337,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new UserApi();
var username = username_example; // string | The user name for login
var password = password_example; // string | The password for login in clear text
@@ -406,7 +400,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new UserApi();
try
@@ -463,7 +456,6 @@ namespace Example
{
public void main()
{
-
var apiInstance = new UserApi();
var username = username_example; // string | name that need to be deleted
var body = new User(); // User | Updated user object
diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs
index dff670d8a6c9..2a053d7821a0 100644
--- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs
+++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs
@@ -416,15 +416,9 @@ namespace IO.Swagger.Api
///
public FakeApi(String basePath)
{
- this.Configuration = new Configuration(new ApiClient(basePath));
+ this.Configuration = new Configuration { BasePath = basePath };
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
-
- // ensure API client has configuration ready
- if (Configuration.ApiClient.Configuration == null)
- {
- this.Configuration.ApiClient.Configuration = this.Configuration;
- }
}
///
@@ -441,12 +435,6 @@ namespace IO.Swagger.Api
this.Configuration = configuration;
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
-
- // ensure API client has configuration ready
- if (Configuration.ApiClient.Configuration == null)
- {
- this.Configuration.ApiClient.Configuration = this.Configuration;
- }
}
///
@@ -495,9 +483,9 @@ namespace IO.Swagger.Api
///
/// Dictionary of HTTP header
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
- public Dictionary DefaultHeader()
+ public IDictionary DefaultHeader()
{
- return this.Configuration.DefaultHeader;
+ return new ReadOnlyDictionary(this.Configuration.DefaultHeader);
}
///
@@ -535,7 +523,7 @@ namespace IO.Swagger.Api
var localVarPath = "./fake/outer/boolean";
var localVarPathParams = new Dictionary();
- var localVarQueryParams = new Dictionary();
+ var localVarQueryParams = new List>();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary();
var localVarFileParams = new Dictionary();
@@ -579,7 +567,6 @@ namespace IO.Swagger.Api
return new ApiResponse(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
(OuterBoolean) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterBoolean)));
-
}
///
@@ -606,7 +593,7 @@ namespace IO.Swagger.Api
var localVarPath = "./fake/outer/boolean";
var localVarPathParams = new Dictionary();
- var localVarQueryParams = new Dictionary();
+ var localVarQueryParams = new List>();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary();
var localVarFileParams = new Dictionary();
@@ -650,7 +637,6 @@ namespace IO.Swagger.Api
return new ApiResponse(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
(OuterBoolean) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterBoolean)));
-
}
///
@@ -676,7 +662,7 @@ namespace IO.Swagger.Api
var localVarPath = "./fake/outer/composite";
var localVarPathParams = new Dictionary();
- var localVarQueryParams = new Dictionary();
+ var localVarQueryParams = new List>();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary();
var localVarFileParams = new Dictionary();
@@ -720,7 +706,6 @@ namespace IO.Swagger.Api
return new ApiResponse(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
(OuterComposite) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterComposite)));
-
}
///
@@ -747,7 +732,7 @@ namespace IO.Swagger.Api
var localVarPath = "./fake/outer/composite";
var localVarPathParams = new Dictionary();
- var localVarQueryParams = new Dictionary();
+ var localVarQueryParams = new List>();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary();
var localVarFileParams = new Dictionary();
@@ -791,7 +776,6 @@ namespace IO.Swagger.Api
return new ApiResponse(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
(OuterComposite) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterComposite)));
-
}
///
@@ -817,7 +801,7 @@ namespace IO.Swagger.Api
var localVarPath = "./fake/outer/number";
var localVarPathParams = new Dictionary();
- var localVarQueryParams = new Dictionary();
+ var localVarQueryParams = new List>();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary();
var localVarFileParams = new Dictionary();
@@ -861,7 +845,6 @@ namespace IO.Swagger.Api
return new ApiResponse(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
(OuterNumber) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterNumber)));
-
}
///
@@ -888,7 +871,7 @@ namespace IO.Swagger.Api
var localVarPath = "./fake/outer/number";
var localVarPathParams = new Dictionary();
- var localVarQueryParams = new Dictionary();
+ var localVarQueryParams = new List>();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary();
var localVarFileParams = new Dictionary();
@@ -932,7 +915,6 @@ namespace IO.Swagger.Api
return new ApiResponse(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
(OuterNumber) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterNumber)));
-
}
///
@@ -958,7 +940,7 @@ namespace IO.Swagger.Api
var localVarPath = "./fake/outer/string";
var localVarPathParams = new Dictionary();
- var localVarQueryParams = new Dictionary();
+ var localVarQueryParams = new List>();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary();
var localVarFileParams = new Dictionary();
@@ -1002,7 +984,6 @@ namespace IO.Swagger.Api
return new ApiResponse(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
(OuterString) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterString)));
-
}
///
@@ -1029,7 +1010,7 @@ namespace IO.Swagger.Api
var localVarPath = "./fake/outer/string";
var localVarPathParams = new Dictionary();
- var localVarQueryParams = new Dictionary();
+ var localVarQueryParams = new List>();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary();
var localVarFileParams = new Dictionary();
@@ -1073,7 +1054,6 @@ namespace IO.Swagger.Api
return new ApiResponse(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
(OuterString) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterString)));
-
}
///
@@ -1102,7 +1082,7 @@ namespace IO.Swagger.Api
var localVarPath = "./fake";
var localVarPathParams = new Dictionary();
- var localVarQueryParams = new Dictionary();
+ var localVarQueryParams = new List>();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary();
var localVarFileParams = new Dictionary();
@@ -1177,7 +1157,7 @@ namespace IO.Swagger.Api
var localVarPath = "./fake";
var localVarPathParams = new Dictionary();
- var localVarQueryParams = new Dictionary();
+ var localVarQueryParams = new List>();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary();
var localVarFileParams = new Dictionary();
@@ -1285,7 +1265,7 @@ namespace IO.Swagger.Api
var localVarPath = "./fake";
var localVarPathParams = new Dictionary();
- var localVarQueryParams = new Dictionary();
+ var localVarQueryParams = new List>();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary();
var localVarFileParams = new Dictionary();
@@ -1409,7 +1389,7 @@ namespace IO.Swagger.Api
var localVarPath = "./fake";
var localVarPathParams = new Dictionary();
- var localVarQueryParams = new Dictionary();
+ var localVarQueryParams = new List>();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary();
var localVarFileParams = new Dictionary();
@@ -1507,7 +1487,7 @@ namespace IO.Swagger.Api
var localVarPath = "./fake";
var localVarPathParams = new Dictionary();
- var localVarQueryParams = new Dictionary();
+ var localVarQueryParams = new List>();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary();
var localVarFileParams = new Dictionary();
@@ -1527,9 +1507,9 @@ namespace IO.Swagger.Api
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
- if (enumQueryStringArray != null) localVarQueryParams.Add("enum_query_string_array", Configuration.ApiClient.ParameterToString(enumQueryStringArray)); // query parameter
- if (enumQueryString != null) localVarQueryParams.Add("enum_query_string", Configuration.ApiClient.ParameterToString(enumQueryString)); // query parameter
- if (enumQueryInteger != null) localVarQueryParams.Add("enum_query_integer", Configuration.ApiClient.ParameterToString(enumQueryInteger)); // query parameter
+ if (enumQueryStringArray != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "enum_query_string_array", enumQueryStringArray)); // query parameter
+ if (enumQueryString != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_string", enumQueryString)); // query parameter
+ if (enumQueryInteger != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_integer", enumQueryInteger)); // query parameter
if (enumHeaderStringArray != null) localVarHeaderParams.Add("enum_header_string_array", Configuration.ApiClient.ParameterToString(enumHeaderStringArray)); // header parameter
if (enumHeaderString != null) localVarHeaderParams.Add("enum_header_string", Configuration.ApiClient.ParameterToString(enumHeaderString)); // header parameter
if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", Configuration.ApiClient.ParameterToString(enumFormStringArray)); // form parameter
@@ -1592,7 +1572,7 @@ namespace IO.Swagger.Api
var localVarPath = "./fake";
var localVarPathParams = new Dictionary();
- var localVarQueryParams = new Dictionary();
+ var localVarQueryParams = new List>();
var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary