fix warning, remove trailing spaces (#7659)

This commit is contained in:
William Cheng
2020-10-13 10:32:43 +08:00
committed by GitHub
parent 0cfe02348b
commit a5083398de
32 changed files with 97 additions and 70 deletions

View File

@@ -11,6 +11,9 @@ namespace {{packageName}}.{{modelPackage}}
/// </summary>
{{>visibility}} abstract partial class AbstractOpenAPISchema
{
/// <summary>
/// Custom JSON serializer
/// </summary>
protected readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings
{
// OpenAPI generated types generally hide default constructors.

View File

@@ -435,7 +435,7 @@ namespace {{packageName}}.Client
InterceptRequest(req);
IRestResponse<T> response;
if (RetryConfiguration.RetryPolicy != null)
if (RetryConfiguration.RetryPolicy != null)
{
var policy = RetryConfiguration.RetryPolicy;
var policyResult = policy.ExecuteAndCapture(() => client.Execute(req));

View File

@@ -143,7 +143,7 @@ namespace {{packageName}}.Client
}
{{/-last}}
{{/enumValues}}
}
}
}{{^-last}},{{/-last}}
{{#-last}}
}
@@ -397,7 +397,7 @@ namespace {{packageName}}.Client
/// Gets or sets the servers.
/// </summary>
/// <value>The servers.</value>
public virtual IList<IReadOnlyDictionary<string, object>> Servers
public virtual IList<IReadOnlyDictionary<string, object>> Servers
{
get { return _servers; }
set
@@ -447,7 +447,7 @@ namespace {{packageName}}.Client
{
IReadOnlyDictionary<string, object> serverVariables = (IReadOnlyDictionary<string, object>)(variable.Value);
if (inputVariables.ContainsKey(variable.Key))
{
if (((List<string>)serverVariables["enum_values"]).Contains(inputVariables[variable.Key]))

View File

@@ -26,10 +26,10 @@ namespace {{packageName}}.Client
SigningAlgorithm = "PKCS1-v15";
}
#endregion
#region Properties
/// <summary>
///Gets the Api keyId
///Gets the Api keyId
/// </summary>
public string KeyId { get; set; }
@@ -141,7 +141,7 @@ namespace {{packageName}}.Client
var dateTime = DateTime.Now;
String Digest = String.Empty;
//get the body
//get the body
string requestBody = string.Empty;
if (requestOptions.Data != null)
{
@@ -296,7 +296,7 @@ namespace {{packageName}}.Client
}
/// <summary>
/// Gets the ECDSA signature
/// Gets the ECDSA signature
/// </summary>
/// <param name="dataToSign"></param>
/// <returns></returns>
@@ -313,16 +313,16 @@ namespace {{packageName}}.Client
var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim();
var keyBytes = System.Convert.FromBase64String(ecKeyBase64String);
var ecdsa = ECDsa.Create();
var bytCount = 0;
#if (NETCOREAPP3_0 || NETCOREAPP3_1 || NET5_0)
var byteCount = 0;
if (configuration.KeyPassPhrase != null)
{
ecdsa.ImportEncryptedPkcs8PrivateKey(keyPassPhrase, keyBytes, out bytCount);
ecdsa.ImportEncryptedPkcs8PrivateKey(keyPassPhrase, keyBytes, out byteCount);
}
else
{
ecdsa.ImportPkcs8PrivateKey(keyBytes, out bytCount);
ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount);
}
var signedBytes = ecdsa.SignHash(dataToSign);
var derBytes = ConvertToECDSAANS1Format(signedBytes);
@@ -339,7 +339,7 @@ namespace {{packageName}}.Client
{
var derBytes = new List<byte>();
byte derLength = 68; //default lenght for ECDSA code signinged bit 0x44
byte rbytesLength = 32; //R length 0x20
byte rbytesLength = 32; //R length 0x20
byte sbytesLength = 32; //S length 0x20
var rBytes = new List<byte>();
var sBytes = new List<byte>();
@@ -610,7 +610,7 @@ namespace {{packageName}}.Client
{
// ---- Now hash consecutively for count times ------
if (j == 0)
result = data00; //initialize
result = data00; //initialize
else
{
Array.Copy(result, hashtarget, result.Length);
@@ -669,8 +669,8 @@ namespace {{packageName}}.Client
var ecPrivateKeyFooter = "END EC PRIVATE KEY";
var rsaPrivateKeyHeader = "BEGIN RSA PRIVATE KEY";
var rsaPrivateFooter = "END RSA PRIVATE KEY";
var pkcs8Header = "BEGIN PRIVATE KEY";
var pkcs8Footer = "END PRIVATE KEY";
//var pkcs8Header = "BEGIN PRIVATE KEY";
//var pkcs8Footer = "END PRIVATE KEY";
var keyType = PrivateKeyType.None;
var key = File.ReadAllLines(keyFilePath);

View File

@@ -89,9 +89,10 @@
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of {{classname}}
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of {{classname}}</returns>
public static {{classname}} FromJson(string jsonString)
{
{{classname}} new{{classname}} = new {{classname}}();

View File

@@ -42,7 +42,6 @@ namespace Org.OpenAPITools.Test
//Assert.IsType<SpecialModelName> (instance, "variable 'instance' is a SpecialModelName");
}
/// <summary>
/// Test the property 'SpecialPropertyName'
/// </summary>
@@ -50,7 +49,7 @@ namespace Org.OpenAPITools.Test
public void SpecialPropertyNameTest()
{
SpecialModelName s = new SpecialModelName();
s.SpecialPropertyName = 123l;
s.SpecialPropertyName = 123L;
Assert.Equal("{\"$special[property.name]\":123}", JsonConvert.SerializeObject(s));
// comment out the following as the result is OS-dependent
//Assert.Equal("{\"id\":123}", s.ToJson());

View File

@@ -439,7 +439,7 @@ namespace Org.OpenAPITools.Client
InterceptRequest(req);
IRestResponse<T> response;
if (RetryConfiguration.RetryPolicy != null)
if (RetryConfiguration.RetryPolicy != null)
{
var policy = RetryConfiguration.RetryPolicy;
var policyResult = policy.ExecuteAndCapture(() => client.Execute(req));

View File

@@ -128,7 +128,7 @@ namespace Org.OpenAPITools.Client
"dev-petstore"
}
}
}
}
},
{
"port", new Dictionary<string, object> {
@@ -140,7 +140,7 @@ namespace Org.OpenAPITools.Client
"8080"
}
}
}
}
}
}
}
@@ -162,7 +162,7 @@ namespace Org.OpenAPITools.Client
"v2"
}
}
}
}
}
}
}
@@ -415,7 +415,7 @@ namespace Org.OpenAPITools.Client
/// Gets or sets the servers.
/// </summary>
/// <value>The servers.</value>
public virtual IList<IReadOnlyDictionary<string, object>> Servers
public virtual IList<IReadOnlyDictionary<string, object>> Servers
{
get { return _servers; }
set
@@ -465,7 +465,7 @@ namespace Org.OpenAPITools.Client
{
IReadOnlyDictionary<string, object> serverVariables = (IReadOnlyDictionary<string, object>)(variable.Value);
if (inputVariables.ContainsKey(variable.Key))
{
if (((List<string>)serverVariables["enum_values"]).Contains(inputVariables[variable.Key]))

View File

@@ -26,10 +26,10 @@ namespace Org.OpenAPITools.Client
SigningAlgorithm = "PKCS1-v15";
}
#endregion
#region Properties
/// <summary>
///Gets the Api keyId
///Gets the Api keyId
/// </summary>
public string KeyId { get; set; }
@@ -141,7 +141,7 @@ namespace Org.OpenAPITools.Client
var dateTime = DateTime.Now;
String Digest = String.Empty;
//get the body
//get the body
string requestBody = string.Empty;
if (requestOptions.Data != null)
{
@@ -296,7 +296,7 @@ namespace Org.OpenAPITools.Client
}
/// <summary>
/// Gets the ECDSA signature
/// Gets the ECDSA signature
/// </summary>
/// <param name="dataToSign"></param>
/// <returns></returns>
@@ -313,16 +313,16 @@ namespace Org.OpenAPITools.Client
var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim();
var keyBytes = System.Convert.FromBase64String(ecKeyBase64String);
var ecdsa = ECDsa.Create();
var bytCount = 0;
#if (NETCOREAPP3_0 || NETCOREAPP3_1 || NET5_0)
var byteCount = 0;
if (configuration.KeyPassPhrase != null)
{
ecdsa.ImportEncryptedPkcs8PrivateKey(keyPassPhrase, keyBytes, out bytCount);
ecdsa.ImportEncryptedPkcs8PrivateKey(keyPassPhrase, keyBytes, out byteCount);
}
else
{
ecdsa.ImportPkcs8PrivateKey(keyBytes, out bytCount);
ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount);
}
var signedBytes = ecdsa.SignHash(dataToSign);
var derBytes = ConvertToECDSAANS1Format(signedBytes);
@@ -339,7 +339,7 @@ namespace Org.OpenAPITools.Client
{
var derBytes = new List<byte>();
byte derLength = 68; //default lenght for ECDSA code signinged bit 0x44
byte rbytesLength = 32; //R length 0x20
byte rbytesLength = 32; //R length 0x20
byte sbytesLength = 32; //S length 0x20
var rBytes = new List<byte>();
var sBytes = new List<byte>();
@@ -610,7 +610,7 @@ namespace Org.OpenAPITools.Client
{
// ---- Now hash consecutively for count times ------
if (j == 0)
result = data00; //initialize
result = data00; //initialize
else
{
Array.Copy(result, hashtarget, result.Length);
@@ -669,8 +669,8 @@ namespace Org.OpenAPITools.Client
var ecPrivateKeyFooter = "END EC PRIVATE KEY";
var rsaPrivateKeyHeader = "BEGIN RSA PRIVATE KEY";
var rsaPrivateFooter = "END RSA PRIVATE KEY";
var pkcs8Header = "BEGIN PRIVATE KEY";
var pkcs8Footer = "END PRIVATE KEY";
//var pkcs8Header = "BEGIN PRIVATE KEY";
//var pkcs8Footer = "END PRIVATE KEY";
var keyType = PrivateKeyType.None;
var key = File.ReadAllLines(keyFilePath);

View File

@@ -19,6 +19,9 @@ namespace Org.OpenAPITools.Model
/// </summary>
public abstract partial class AbstractOpenAPISchema
{
/// <summary>
/// Custom JSON serializer
/// </summary>
protected readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings
{
// OpenAPI generated types generally hide default constructors.

View File

@@ -137,9 +137,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of Fruit
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of Fruit</returns>
public static Fruit FromJson(string jsonString)
{
Fruit newFruit = new Fruit();

View File

@@ -137,9 +137,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of FruitReq
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of FruitReq</returns>
public static FruitReq FromJson(string jsonString)
{
FruitReq newFruitReq = new FruitReq();

View File

@@ -164,9 +164,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of Mammal
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of Mammal</returns>
public static Mammal FromJson(string jsonString)
{
Mammal newMammal = new Mammal();

View File

@@ -138,9 +138,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of NullableShape
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of NullableShape</returns>
public static NullableShape FromJson(string jsonString)
{
NullableShape newNullableShape = new NullableShape();

View File

@@ -138,9 +138,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of Pig
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of Pig</returns>
public static Pig FromJson(string jsonString)
{
Pig newPig = new Pig();

View File

@@ -138,9 +138,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of Quadrilateral
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of Quadrilateral</returns>
public static Quadrilateral FromJson(string jsonString)
{
Quadrilateral newQuadrilateral = new Quadrilateral();

View File

@@ -138,9 +138,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of Shape
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of Shape</returns>
public static Shape FromJson(string jsonString)
{
Shape newShape = new Shape();

View File

@@ -138,9 +138,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of ShapeOrNull
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of ShapeOrNull</returns>
public static ShapeOrNull FromJson(string jsonString)
{
ShapeOrNull newShapeOrNull = new ShapeOrNull();

View File

@@ -164,9 +164,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of Triangle
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of Triangle</returns>
public static Triangle FromJson(string jsonString)
{
Triangle newTriangle = new Triangle();

View File

@@ -440,7 +440,7 @@ namespace Org.OpenAPITools.Client
InterceptRequest(req);
IRestResponse<T> response;
if (RetryConfiguration.RetryPolicy != null)
if (RetryConfiguration.RetryPolicy != null)
{
var policy = RetryConfiguration.RetryPolicy;
var policyResult = policy.ExecuteAndCapture(() => client.Execute(req));

View File

@@ -133,7 +133,7 @@ namespace Org.OpenAPITools.Client
"dev-petstore"
}
}
}
}
},
{
"port", new Dictionary<string, object> {
@@ -145,7 +145,7 @@ namespace Org.OpenAPITools.Client
"8080"
}
}
}
}
}
}
}
@@ -167,7 +167,7 @@ namespace Org.OpenAPITools.Client
"v2"
}
}
}
}
}
}
}
@@ -420,7 +420,7 @@ namespace Org.OpenAPITools.Client
/// Gets or sets the servers.
/// </summary>
/// <value>The servers.</value>
public virtual IList<IReadOnlyDictionary<string, object>> Servers
public virtual IList<IReadOnlyDictionary<string, object>> Servers
{
get { return _servers; }
set
@@ -470,7 +470,7 @@ namespace Org.OpenAPITools.Client
{
IReadOnlyDictionary<string, object> serverVariables = (IReadOnlyDictionary<string, object>)(variable.Value);
if (inputVariables.ContainsKey(variable.Key))
{
if (((List<string>)serverVariables["enum_values"]).Contains(inputVariables[variable.Key]))

View File

@@ -26,10 +26,10 @@ namespace Org.OpenAPITools.Client
SigningAlgorithm = "PKCS1-v15";
}
#endregion
#region Properties
/// <summary>
///Gets the Api keyId
///Gets the Api keyId
/// </summary>
public string KeyId { get; set; }
@@ -141,7 +141,7 @@ namespace Org.OpenAPITools.Client
var dateTime = DateTime.Now;
String Digest = String.Empty;
//get the body
//get the body
string requestBody = string.Empty;
if (requestOptions.Data != null)
{
@@ -296,7 +296,7 @@ namespace Org.OpenAPITools.Client
}
/// <summary>
/// Gets the ECDSA signature
/// Gets the ECDSA signature
/// </summary>
/// <param name="dataToSign"></param>
/// <returns></returns>
@@ -313,16 +313,16 @@ namespace Org.OpenAPITools.Client
var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim();
var keyBytes = System.Convert.FromBase64String(ecKeyBase64String);
var ecdsa = ECDsa.Create();
var bytCount = 0;
#if (NETCOREAPP3_0 || NETCOREAPP3_1 || NET5_0)
var byteCount = 0;
if (configuration.KeyPassPhrase != null)
{
ecdsa.ImportEncryptedPkcs8PrivateKey(keyPassPhrase, keyBytes, out bytCount);
ecdsa.ImportEncryptedPkcs8PrivateKey(keyPassPhrase, keyBytes, out byteCount);
}
else
{
ecdsa.ImportPkcs8PrivateKey(keyBytes, out bytCount);
ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount);
}
var signedBytes = ecdsa.SignHash(dataToSign);
var derBytes = ConvertToECDSAANS1Format(signedBytes);
@@ -339,7 +339,7 @@ namespace Org.OpenAPITools.Client
{
var derBytes = new List<byte>();
byte derLength = 68; //default lenght for ECDSA code signinged bit 0x44
byte rbytesLength = 32; //R length 0x20
byte rbytesLength = 32; //R length 0x20
byte sbytesLength = 32; //S length 0x20
var rBytes = new List<byte>();
var sBytes = new List<byte>();
@@ -610,7 +610,7 @@ namespace Org.OpenAPITools.Client
{
// ---- Now hash consecutively for count times ------
if (j == 0)
result = data00; //initialize
result = data00; //initialize
else
{
Array.Copy(result, hashtarget, result.Length);
@@ -669,8 +669,8 @@ namespace Org.OpenAPITools.Client
var ecPrivateKeyFooter = "END EC PRIVATE KEY";
var rsaPrivateKeyHeader = "BEGIN RSA PRIVATE KEY";
var rsaPrivateFooter = "END RSA PRIVATE KEY";
var pkcs8Header = "BEGIN PRIVATE KEY";
var pkcs8Footer = "END PRIVATE KEY";
//var pkcs8Header = "BEGIN PRIVATE KEY";
//var pkcs8Footer = "END PRIVATE KEY";
var keyType = PrivateKeyType.None;
var key = File.ReadAllLines(keyFilePath);

View File

@@ -19,6 +19,9 @@ namespace Org.OpenAPITools.Model
/// </summary>
public abstract partial class AbstractOpenAPISchema
{
/// <summary>
/// Custom JSON serializer
/// </summary>
protected readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings
{
// OpenAPI generated types generally hide default constructors.

View File

@@ -137,9 +137,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of Fruit
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of Fruit</returns>
public static Fruit FromJson(string jsonString)
{
Fruit newFruit = new Fruit();

View File

@@ -137,9 +137,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of FruitReq
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of FruitReq</returns>
public static FruitReq FromJson(string jsonString)
{
FruitReq newFruitReq = new FruitReq();

View File

@@ -164,9 +164,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of Mammal
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of Mammal</returns>
public static Mammal FromJson(string jsonString)
{
Mammal newMammal = new Mammal();

View File

@@ -138,9 +138,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of NullableShape
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of NullableShape</returns>
public static NullableShape FromJson(string jsonString)
{
NullableShape newNullableShape = new NullableShape();

View File

@@ -138,9 +138,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of Pig
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of Pig</returns>
public static Pig FromJson(string jsonString)
{
Pig newPig = new Pig();

View File

@@ -138,9 +138,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of Quadrilateral
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of Quadrilateral</returns>
public static Quadrilateral FromJson(string jsonString)
{
Quadrilateral newQuadrilateral = new Quadrilateral();

View File

@@ -138,9 +138,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of Shape
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of Shape</returns>
public static Shape FromJson(string jsonString)
{
Shape newShape = new Shape();

View File

@@ -138,9 +138,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of ShapeOrNull
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of ShapeOrNull</returns>
public static ShapeOrNull FromJson(string jsonString)
{
ShapeOrNull newShapeOrNull = new ShapeOrNull();

View File

@@ -164,9 +164,10 @@ namespace Org.OpenAPITools.Model
}
/// <summary>
/// Converts the JSON string into the object
/// Converts the JSON string into an instance of Triangle
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of Triangle</returns>
public static Triangle FromJson(string jsonString)
{
Triangle newTriangle = new Triangle();