Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test ClientRuntime fix 3503 #2488

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added cr/net452/Microsoft.Rest.ClientRuntime.dll
Binary file not shown.
3 changes: 3 additions & 0 deletions cr/net452/Microsoft.Rest.ClientRuntime.runtimeconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"runtimeOptions": {}
}
2,237 changes: 2,237 additions & 0 deletions cr/net452/Microsoft.Rest.ClientRuntime.xml

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"runtimeOptions": {}
}
2,129 changes: 2,129 additions & 0 deletions cr/netstandard1.4/Microsoft.Rest.ClientRuntime.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@
"yauzl": "^2.7.0"
},
"dependencies": {}
}
}
43 changes: 43 additions & 0 deletions src/dev/TestServer/server/routes/complex.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,39 @@ var complex = function (coverage) {
}
]
};
var rawSalmon =
{
'fishtype': 'smart_salmon',
'location': 'alaska',
'iswild': true,
'species': 'king',
'length': 1.0,
'siblings': [
{
'fishtype': 'shark',
'age': 6,
'birthday': '2012-01-05T01:00:00Z',
'length': 20.0,
'species': 'predator',
},
{
'fishtype': 'sawshark',
'age': 105,
'birthday': '1900-01-05T01:00:00Z',
'length': 10.0,
'picture': new Buffer([255, 255, 255, 255, 254]).toString('base64'),
'species': 'dangerous',
},
{
'fishtype': 'goblin',
'age': 1,
'birthday': '2015-08-08T00:00:00Z',
'length': 30.0,
'species': 'scary',
'jawsize': 5
}
]
};

router.put('/polymorphism/:scenario', function (req, res, next) {
if (req.params.scenario === 'valid') {
Expand All @@ -352,6 +385,14 @@ var complex = function (coverage) {
} else {
utils.send400(res, next, "Did not like complex polymorphism req " + util.inspect(req.body));
}
} else if (req.params.scenario === 'validx') {
console.log(JSON.stringify(req.body, null, 4));
console.log(JSON.stringify(rawSalmon, null, 4));
if (_.isEqual(utils.coerceDate(req.body), rawSalmon)) {
res.status(200).end();
} else {
utils.send400(res, next, "Did not like complex polymorphism req " + util.inspect(req.body));
}
} else {
utils.send400(res, next, 'Must provide a valid scenario.');
}
Expand All @@ -361,6 +402,8 @@ var complex = function (coverage) {
if (req.params.scenario === 'valid') {
coverage['getComplexPolymorphismValid']++;
res.status(200).end(JSON.stringify(rawFish));
} else if (req.params.scenario === 'validx') {
res.status(200).end(JSON.stringify(rawSalmon));
} else {
utils.send400(res, next, 'Must provide a valid scenario.');
}
Expand Down
80 changes: 74 additions & 6 deletions src/dev/TestServer/swagger/body-complex.json
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,50 @@
}
}
},
"/complex/polymorphism/validx": {
"get": {
"operationId": "polymorphism_getValidx",
"description": "Get complex types that are polymorphic, but not at the root of the hierarchy",
"responses": {
"200": {
"schema": {
"$ref": "#/definitions/salmon"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"put": {
"operationId": "polymorphism_putValidx",
"description": "Put complex types that are polymorphic, but not at the root of the hierarchy",
"parameters": [
{
"name": "complexBody",
"in": "body",
"schema": {
"$ref": "#/definitions/salmon"
},
"required": true
}
],
"responses": {
"200": {
"description": "Empty Response"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/complex/polymorphism/missingrequired/invalid": {
"put": {
"operationId": "polymorphism_putValidMissingRequired",
Expand Down Expand Up @@ -1102,7 +1146,7 @@
"$ref": "#/definitions/Error"
}
}
}
}
}
}
},
Expand Down Expand Up @@ -1130,7 +1174,12 @@
},
"color": {
"type": "string",
"enum": [ "cyan", "Magenta", "YELLOW", "blacK" ],
"enum": [
"cyan",
"Magenta",
"YELLOW",
"blacK"
],
"x-ms-enum": {
"name": "CMYKColors",
"modelAsString": true
Expand Down Expand Up @@ -1192,7 +1241,10 @@
},
"Fish": {
"discriminator": "fishtype",
"required": [ "fishtype", "length" ],
"required": [
"fishtype",
"length"
],
"properties": {
"fishtype": {
"type": "string"
Expand Down Expand Up @@ -1227,13 +1279,27 @@
}
}
},
"smart_salmon": {
"allOf": [
{
"$ref": "#/definitions/salmon"
}
],
"properties": {
"college_degree": {
"type": "string"
}
}
},
"shark": {
"allOf": [
{
"$ref": "#/definitions/Fish"
}
],
"required": [ "birthday" ],
"required": [
"birthday"
],
"properties": {
"age": {
"type": "integer",
Expand Down Expand Up @@ -1440,7 +1506,9 @@
"description": "API ID.",
"required": true,
"type": "string",
"enum": [ "2014-04-01-preview" ]
"enum": [
"2014-04-01-preview"
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.2" />
<PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Rest.ClientRuntime">
<HintPath>..\..\..\cr\netstandard1.4\Microsoft.Rest.ClientRuntime.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionDir)src/core/AutoRest.Core/AutoRest.Core.csproj" />
<ProjectReference Include="$(SolutionDir)src/core/AutoRest.Extensions/AutoRest.Extensions.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.8" />
<Reference Include="Microsoft.Rest.ClientRuntime">
<HintPath>..\..\..\cr\netstandard1.4\Microsoft.Rest.ClientRuntime.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" />
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.8" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,42 @@ public partial interface IPolymorphismOperations
/// </exception>
Task<AzureOperationResponse> PutValidWithHttpMessagesAsync(FishInner complexBody, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Get complex types that are polymorphic, but not at the root of the
/// hierarchy
/// </summary>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="ErrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
Task<AzureOperationResponse<SalmonInner>> GetValidxWithHttpMessagesAsync(Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Put complex types that are polymorphic, but not at the root of the
/// hierarchy
/// </summary>
/// <param name='complexBody'>
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="ErrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse> PutValidxWithHttpMessagesAsync(SalmonInner complexBody, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Put complex types that are polymorphic, attempting to omit required
/// 'birthday' field - the request should not be allowed from the
/// client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ namespace Fixtures.AcceptanceTestsAzureCompositeModelClient.Models
using System.Linq;

[Newtonsoft.Json.JsonObject("salmon")]
public partial class Salmon : FishInner
public partial class SalmonInner : FishInner
{
/// <summary>
/// Initializes a new instance of the Salmon class.
/// Initializes a new instance of the SalmonInner class.
/// </summary>
public Salmon()
public SalmonInner()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the Salmon class.
/// Initializes a new instance of the SalmonInner class.
/// </summary>
public Salmon(double length, string species = default(string), IList<FishInner> siblings = default(IList<FishInner>), string location = default(string), bool? iswild = default(bool?))
public SalmonInner(double length, string species = default(string), IList<FishInner> siblings = default(IList<FishInner>), string location = default(string), bool? iswild = default(bool?))
: base(length, species, siblings)
{
Location = location;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>

namespace Fixtures.AcceptanceTestsAzureCompositeModelClient.Models
{
using Fixtures.AcceptanceTestsAzureCompositeModelClient;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

[Newtonsoft.Json.JsonObject("smart_salmon")]
public partial class SmartSalmon : SalmonInner
{
/// <summary>
/// Initializes a new instance of the SmartSalmon class.
/// </summary>
public SmartSalmon()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the SmartSalmon class.
/// </summary>
public SmartSalmon(double length, string species = default(string), IList<FishInner> siblings = default(IList<FishInner>), string location = default(string), bool? iswild = default(bool?), string collegeDegree = default(string))
: base(length, species, siblings, location, iswild)
{
CollegeDegree = collegeDegree;
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "college_degree")]
public string CollegeDegree { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}
Loading