forked from loafle/openapi-generator-original
[csharp] fixes for netstandard (json serializing and project files) (#5590)
This commit is contained in:
parent
fd3cae6c4b
commit
5a257a0558
@ -122,6 +122,10 @@ namespace {{packageName}}.Client
|
||||
String contentType)
|
||||
{
|
||||
var request = new RestRequest(path, method);
|
||||
{{#netStandard}}
|
||||
// disable ResetSharp.Portable built-in serialization
|
||||
request.Serializer = null;
|
||||
{{/netStandard}}
|
||||
|
||||
// add path parameter, if any
|
||||
foreach(var param in pathParams)
|
||||
@ -161,11 +165,21 @@ namespace {{packageName}}.Client
|
||||
{
|
||||
if (postBody.GetType() == typeof(String))
|
||||
{
|
||||
{{#netStandard}}
|
||||
request.AddParameter(new Parameter { Value = postBody, Type = ParameterType.RequestBody, ContentType = "application/json" });
|
||||
{{/netStandard}}
|
||||
{{^netStandard}}
|
||||
request.AddParameter("application/json", postBody, ParameterType.RequestBody);
|
||||
{{/netStandard}}
|
||||
}
|
||||
else if (postBody.GetType() == typeof(byte[]))
|
||||
{
|
||||
{{#netStandard}}
|
||||
request.AddParameter(new Parameter { Value = postBody, Type = ParameterType.RequestBody, ContentType = contentType });
|
||||
{{/netStandard}}
|
||||
{{^netStandard}}
|
||||
request.AddParameter(contentType, postBody, ParameterType.RequestBody);
|
||||
{{/netStandard}}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,10 @@
|
||||
{{/netStandard}}
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="**\*.cs"/>
|
||||
<Compile Include="Api\**\*.cs"/>
|
||||
<Compile Include="Client\**\*.cs"/>
|
||||
<Compile Include="Model\**\*.cs"/>
|
||||
<Compile Include="Properties\**\*.cs"/>
|
||||
</ItemGroup>
|
||||
{{^netStandard}}
|
||||
<ItemGroup>
|
||||
|
@ -216,7 +216,7 @@ namespace IO.Swagger.Api
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
"application/json",
|
||||
"application/json",
|
||||
"*_/ ' =end - - "
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
@ -239,7 +239,6 @@ namespace IO.Swagger.Api
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
|
||||
return new ApiResponse<Object>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
||||
null);
|
||||
@ -283,7 +282,7 @@ namespace IO.Swagger.Api
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
"application/json",
|
||||
"application/json",
|
||||
"*_/ ' =end - - "
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
@ -306,7 +305,6 @@ namespace IO.Swagger.Api
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
|
||||
return new ApiResponse<Object>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
||||
null);
|
||||
|
@ -62,7 +62,10 @@ Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
||||
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="**\*.cs"/>
|
||||
<Compile Include="Api\**\*.cs"/>
|
||||
<Compile Include="Client\**\*.cs"/>
|
||||
<Compile Include="Model\**\*.cs"/>
|
||||
<Compile Include="Properties\**\*.cs"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
@ -119,7 +119,7 @@ namespace IO.Swagger.Model
|
||||
/// <param name="validationContext">Validation context</param>
|
||||
/// <returns>Validation Result</returns>
|
||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||
{
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,10 @@ Contact: apiteam@swagger.io
|
||||
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="**\*.cs"/>
|
||||
<Compile Include="Api\**\*.cs"/>
|
||||
<Compile Include="Client\**\*.cs"/>
|
||||
<Compile Include="Model\**\*.cs"/>
|
||||
<Compile Include="Properties\**\*.cs"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
@ -115,6 +115,8 @@ namespace IO.Swagger.Client
|
||||
String contentType)
|
||||
{
|
||||
var request = new RestRequest(path, method);
|
||||
// disable ResetSharp.Portable built-in serialization
|
||||
request.Serializer = null;
|
||||
|
||||
// add path parameter, if any
|
||||
foreach(var param in pathParams)
|
||||
@ -142,11 +144,11 @@ namespace IO.Swagger.Client
|
||||
{
|
||||
if (postBody.GetType() == typeof(String))
|
||||
{
|
||||
request.AddParameter("application/json", postBody, ParameterType.RequestBody);
|
||||
request.AddParameter(new Parameter { Value = postBody, Type = ParameterType.RequestBody, ContentType = "application/json" });
|
||||
}
|
||||
else if (postBody.GetType() == typeof(byte[]))
|
||||
{
|
||||
request.AddParameter(contentType, postBody, ParameterType.RequestBody);
|
||||
request.AddParameter(new Parameter { Value = postBody, Type = ParameterType.RequestBody, ContentType = contentType });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,10 @@ Contact: apiteam@swagger.io
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="**\*.cs"/>
|
||||
<Compile Include="Api\**\*.cs"/>
|
||||
<Compile Include="Client\**\*.cs"/>
|
||||
<Compile Include="Model\**\*.cs"/>
|
||||
<Compile Include="Properties\**\*.cs"/>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
|
@ -64,7 +64,10 @@ Contact: apiteam@swagger.io
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="**\*.cs"/>
|
||||
<Compile Include="Api\**\*.cs"/>
|
||||
<Compile Include="Client\**\*.cs"/>
|
||||
<Compile Include="Model\**\*.cs"/>
|
||||
<Compile Include="Properties\**\*.cs"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user