Conflicts:
	AutoRest/Generators/CSharp/CSharp.Tests/MirrorTests.cs
	ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/project.lock.json
	ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime/project.lock.json
This commit is contained in:
stankovski 2015-11-13 09:03:25 -08:00
Родитель 059d22afee 951804d8b4
Коммит de53fbb4d0
190 изменённых файлов: 8874 добавлений и 548 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -175,3 +175,4 @@ AutoRest/Generators/Ruby/*/RspecTests/Generated/*
#dnx installation
dnx-clr-win-x86*/
dnx-coreclr-win-x86*/
*.lock.json

Просмотреть файл

@ -17,10 +17,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Modeler.Swagger",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Modeler.Swagger.Tests", "AutoRest\Modelers\Swagger.Tests\AutoRest.Modeler.Swagger.Tests.csproj", "{C6C4E139-D7AF-486C-95BA-2B879F58F18D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.Azure.Common.Tests", "AutoRest\Generators\Azure.Common\Azure.Common.Tests\AutoRest.Generator.Azure.Common.Tests.csproj", "{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.Azure.Common", "AutoRest\Generators\Azure.Common\Azure.Common\AutoRest.Generator.Azure.Common.csproj", "{90B943AB-3879-4B64-B9FF-1A21297C0F26}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.Azure.CSharp", "AutoRest\Generators\CSharp\Azure.CSharp\AutoRest.Generator.Azure.CSharp.csproj", "{4899B527-6815-4E89-84B3-DD5A507B205A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.CSharp", "AutoRest\Generators\CSharp\CSharp\AutoRest.Generator.CSharp.csproj", "{CC1EEC95-41EF-44B6-8761-00FA3E647248}"
@ -29,7 +25,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CSharp", "CSharp", "{03E75B
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NodeJS", "NodeJS", "{9B87B0F7-B02C-4498-BB03-B6E282F86557}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Azure.Common", "Azure.Common", "{30F628FD-5739-49E7-B9D9-37EC93F429A9}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{30F628FD-5739-49E7-B9D9-37EC93F429A9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.Azure.NodeJS", "AutoRest\Generators\NodeJS\Azure.NodeJS\AutoRest.Generator.Azure.NodeJS.csproj", "{909BF4EF-4ECA-4AC4-8E21-CDCF05393161}"
EndProject
@ -95,6 +91,14 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ClientRuntime", "ClientRunt
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ClientRuntime.Azure", "ClientRuntimes\CSharp\Microsoft.Rest.ClientRuntime.Azure\ClientRuntime.Azure.xproj", "{D5296EAB-C13E-4A88-9532-BD0677D18EC9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.Azure.Extensions", "AutoRest\Generators\Extensions\Azure.Extensions\AutoRest.Generator.Azure.Extensions.csproj", "{90B943AB-3879-4B64-B9FF-1A21297C0F26}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.Azure.Extensions.Tests", "AutoRest\Generators\Extensions\Azure.Extensions.Tests\AutoRest.Generator.Azure.Extensions.Tests.csproj", "{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.Extensions", "AutoRest\Generators\Extensions\Extensions\AutoRest.Generator.Extensions.csproj", "{7DD043EB-5E53-4180-B123-CC3CC5022E34}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.Extensions.Tests", "AutoRest\Generators\Extensions\Extensions.Tests\AutoRest.Generator.Extensions.Tests.csproj", "{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Net45-Debug|Any CPU = Net45-Debug|Any CPU
@ -159,6 +163,10 @@ Global
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Portable-Debug|Any CPU.Build.0 = Portable-Debug|Any CPU
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Portable-Release|Any CPU.Build.0 = Portable-Release|Any CPU
{C6C4E139-D7AF-486C-95BA-2B879F58F18D}.Release|Any CPU.ActiveCfg = Portable-Release|Any CPU
{C6C4E139-D7AF-486C-95BA-2B879F58F18D}.Release|Any CPU.Build.0 = Portable-Release|Any CPU
{4899B527-6815-4E89-84B3-DD5A507B205A}.Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU
{4899B527-6815-4E89-84B3-DD5A507B205A}.Debug|Any CPU.Build.0 = Portable-Debug|Any CPU
{4899B527-6815-4E89-84B3-DD5A507B205A}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU
{4899B527-6815-4E89-84B3-DD5A507B205A}.Net45-Debug|Any CPU.Build.0 = Net45-Debug|Any CPU
{4899B527-6815-4E89-84B3-DD5A507B205A}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU
@ -271,6 +279,56 @@ Global
{D5296EAB-C13E-4A88-9532-BD0677D18EC9}.Portable-Debug|Any CPU.Build.0 = Debug|Any CPU
{D5296EAB-C13E-4A88-9532-BD0677D18EC9}.Portable-Release|Any CPU.ActiveCfg = Release|Any CPU
{D5296EAB-C13E-4A88-9532-BD0677D18EC9}.Portable-Release|Any CPU.Build.0 = Release|Any CPU
{CB3CA435-07CB-4DF6-A574-4FCB6909D3DD}.Release|Any CPU.ActiveCfg = Portable-Release|Any CPU
{CB3CA435-07CB-4DF6-A574-4FCB6909D3DD}.Release|Any CPU.Build.0 = Portable-Release|Any CPU
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Debug|Any CPU.Build.0 = Portable-Debug|Any CPU
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Net45-Debug|Any CPU.Build.0 = Net45-Debug|Any CPU
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Net45-Release|Any CPU.Build.0 = Net45-Release|Any CPU
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Portable-Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Portable-Debug|Any CPU.Build.0 = Portable-Debug|Any CPU
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Portable-Release|Any CPU.Build.0 = Portable-Release|Any CPU
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Release|Any CPU.ActiveCfg = Portable-Release|Any CPU
{90B943AB-3879-4B64-B9FF-1A21297C0F26}.Release|Any CPU.Build.0 = Portable-Release|Any CPU
{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}.Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU
{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}.Debug|Any CPU.Build.0 = Portable-Debug|Any CPU
{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU
{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}.Net45-Debug|Any CPU.Build.0 = Net45-Debug|Any CPU
{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU
{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}.Net45-Release|Any CPU.Build.0 = Net45-Release|Any CPU
{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}.Portable-Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU
{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}.Portable-Debug|Any CPU.Build.0 = Portable-Debug|Any CPU
{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU
{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}.Portable-Release|Any CPU.Build.0 = Portable-Release|Any CPU
{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}.Release|Any CPU.ActiveCfg = Portable-Release|Any CPU
{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}.Release|Any CPU.Build.0 = Portable-Release|Any CPU
{7DD043EB-5E53-4180-B123-CC3CC5022E34}.Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU
{7DD043EB-5E53-4180-B123-CC3CC5022E34}.Debug|Any CPU.Build.0 = Portable-Debug|Any CPU
{7DD043EB-5E53-4180-B123-CC3CC5022E34}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU
{7DD043EB-5E53-4180-B123-CC3CC5022E34}.Net45-Debug|Any CPU.Build.0 = Net45-Debug|Any CPU
{7DD043EB-5E53-4180-B123-CC3CC5022E34}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU
{7DD043EB-5E53-4180-B123-CC3CC5022E34}.Net45-Release|Any CPU.Build.0 = Net45-Release|Any CPU
{7DD043EB-5E53-4180-B123-CC3CC5022E34}.Portable-Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU
{7DD043EB-5E53-4180-B123-CC3CC5022E34}.Portable-Debug|Any CPU.Build.0 = Portable-Debug|Any CPU
{7DD043EB-5E53-4180-B123-CC3CC5022E34}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU
{7DD043EB-5E53-4180-B123-CC3CC5022E34}.Portable-Release|Any CPU.Build.0 = Portable-Release|Any CPU
{7DD043EB-5E53-4180-B123-CC3CC5022E34}.Release|Any CPU.ActiveCfg = Portable-Release|Any CPU
{7DD043EB-5E53-4180-B123-CC3CC5022E34}.Release|Any CPU.Build.0 = Portable-Release|Any CPU
{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C}.Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU
{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C}.Debug|Any CPU.Build.0 = Portable-Debug|Any CPU
{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU
{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C}.Net45-Debug|Any CPU.Build.0 = Net45-Debug|Any CPU
{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU
{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C}.Net45-Release|Any CPU.Build.0 = Net45-Release|Any CPU
{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C}.Portable-Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU
{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C}.Portable-Debug|Any CPU.Build.0 = Portable-Debug|Any CPU
{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU
{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C}.Portable-Release|Any CPU.Build.0 = Portable-Release|Any CPU
{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C}.Release|Any CPU.ActiveCfg = Portable-Release|Any CPU
{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C}.Release|Any CPU.Build.0 = Portable-Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -278,8 +336,6 @@ Global
GlobalSection(NestedProjects) = preSolution
{9517265E-5127-460C-9DDE-FE017D73121C} = {02144BF6-4489-4AFC-9B2D-0306C3DD3C19}
{C6C4E139-D7AF-486C-95BA-2B879F58F18D} = {02144BF6-4489-4AFC-9B2D-0306C3DD3C19}
{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5} = {30F628FD-5739-49E7-B9D9-37EC93F429A9}
{90B943AB-3879-4B64-B9FF-1A21297C0F26} = {30F628FD-5739-49E7-B9D9-37EC93F429A9}
{4899B527-6815-4E89-84B3-DD5A507B205A} = {03E75B1D-A443-4A12-B31F-860DB2B45140}
{CC1EEC95-41EF-44B6-8761-00FA3E647248} = {03E75B1D-A443-4A12-B31F-860DB2B45140}
{03E75B1D-A443-4A12-B31F-860DB2B45140} = {EF9E346D-70C6-45F5-8FF9-9B734F4A1298}
@ -301,5 +357,9 @@ Global
{729D041A-180E-47A4-AB77-6C7CA72F40C3} = {03E75B1D-A443-4A12-B31F-860DB2B45140}
{EDDB6367-5C7B-428C-B54C-96BCD90F6E6C} = {9C3EF315-B4C1-4E11-B2FC-31B1530393D9}
{D5296EAB-C13E-4A88-9532-BD0677D18EC9} = {9C3EF315-B4C1-4E11-B2FC-31B1530393D9}
{90B943AB-3879-4B64-B9FF-1A21297C0F26} = {30F628FD-5739-49E7-B9D9-37EC93F429A9}
{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5} = {30F628FD-5739-49E7-B9D9-37EC93F429A9}
{7DD043EB-5E53-4180-B123-CC3CC5022E34} = {30F628FD-5739-49E7-B9D9-37EC93F429A9}
{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C} = {30F628FD-5739-49E7-B9D9-37EC93F429A9}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -19,9 +19,10 @@
<file src="binaries/net45/AutoRest.Core.dll" target="tools" />
<file src="binaries/net45/AutoRest.exe" target="tools" />
<file src="binaries/net45/AutoRest.Release.json" target="tools/AutoRest.json" />
<file src="binaries/net45/AutoRest.Generator.Extensions.dll" target="tools" />
<file src="binaries/net45/AutoRest.Generator.CSharp.dll" target="tools" />
<file src="binaries/net45/AutoRest.Generator.Azure.CSharp.dll" target="tools" />
<file src="binaries/net45/AutoRest.Generator.Azure.Common.dll" target="tools" />
<file src="binaries/net45/AutoRest.Generator.Azure.Extensions.dll" target="tools" />
<file src="binaries/net45/AutoRest.Generator.NodeJS.dll" target="tools" />
<file src="binaries/net45/AutoRest.Generator.Azure.NodeJS.dll" target="tools" />
<file src="binaries/net45/AutoRest.Generator.Ruby.dll" target="tools" />

Просмотреть файл

@ -14,7 +14,6 @@ namespace Microsoft.Rest.Generator
{
public abstract class CodeGenerator
{
public const string SkipUrlEncodingExtension = "x-ms-skip-url-encoding";
public const string EnumObject = "x-ms-enum";
protected CodeGenerator(Settings settings)

Просмотреть файл

@ -761,7 +761,7 @@ namespace Microsoft.Rest.Generator.CSharp.Azure.Tests
HeaderOne = headerParameter,
QueryOne = queryParameter
};
SecondParameterGroup secondGroup = new SecondParameterGroup
var secondGroup = new ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup
{
HeaderTwo = "header2",
QueryTwo = 42
@ -774,12 +774,14 @@ namespace Microsoft.Rest.Generator.CSharp.Azure.Tests
{
HeaderOne = headerParameter
};
secondGroup = new SecondParameterGroup
secondGroup = new ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup
{
QueryTwo = 42
};
client.ParameterGrouping.PostMultipleParameterGroups(firstGroup, secondGroup);
client.ParameterGrouping.PostSharedParameterGroupObject(firstGroup);
}
}
}

Просмотреть файл

@ -69,10 +69,6 @@
<Project>{9517265e-5127-460c-9dde-fe017d73121c}</Project>
<Name>AutoRest.Modeler.Swagger</Name>
</ProjectReference>
<ProjectReference Include="..\..\Azure.Common\Azure.Common\AutoRest.Generator.Azure.Common.csproj">
<Project>{90b943ab-3879-4b64-b9ff-1a21297c0f26}</Project>
<Name>AutoRest.Generator.Azure.Common</Name>
</ProjectReference>
<ProjectReference Include="..\Azure.CSharp\AutoRest.Generator.Azure.CSharp.csproj">
<Project>{4899b527-6815-4e89-84b3-dd5a507b205a}</Project>
<Name>AutoRest.Generator.Azure.CSharp</Name>

Просмотреть файл

@ -54,7 +54,7 @@ namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
/// <param name='firstParameterGroup'>
/// Additional parameters for the operation
/// </param>
/// <param name='secondParameterGroup'>
/// <param name='parameterGroupingPostMultipleParameterGroupsSecondParameterGroup'>
/// Additional parameters for the operation
/// </param>
/// <param name='customHeaders'>
@ -63,6 +63,19 @@ namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
Task<AzureOperationResponse> PostMultipleParameterGroupsWithHttpMessagesAsync(FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), SecondParameterGroup secondParameterGroup = default(SecondParameterGroup), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<AzureOperationResponse> PostMultipleParameterGroupsWithHttpMessagesAsync(FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup parameterGroupingPostMultipleParameterGroupsSecondParameterGroup = default(ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Post parameters with a shared parameter group object
/// </summary>
/// <param name='firstParameterGroup'>
/// Additional parameters for the operation
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
Task<AzureOperationResponse> PostSharedParameterGroupObjectWithHttpMessagesAsync(FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}

Просмотреть файл

@ -19,17 +19,21 @@ namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping.Models
/// <summary>
/// Additional parameters for the postMultipleParameterGroups operation.
/// </summary>
public partial class SecondParameterGroup
public partial class ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup
{
/// <summary>
/// Initializes a new instance of the SecondParameterGroup class.
/// Initializes a new instance of the
/// ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup
/// class.
/// </summary>
public SecondParameterGroup() { }
public ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup() { }
/// <summary>
/// Initializes a new instance of the SecondParameterGroup class.
/// Initializes a new instance of the
/// ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup
/// class.
/// </summary>
public SecondParameterGroup(string headerTwo = default(string), int? queryTwo = default(int?))
public ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup(string headerTwo = default(string), int? queryTwo = default(int?))
{
HeaderTwo = headerTwo;
QueryTwo = queryTwo;

Просмотреть файл

@ -345,7 +345,7 @@ namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
/// <param name='firstParameterGroup'>
/// Additional parameters for the operation
/// </param>
/// <param name='secondParameterGroup'>
/// <param name='parameterGroupingPostMultipleParameterGroupsSecondParameterGroup'>
/// Additional parameters for the operation
/// </param>
/// <param name='customHeaders'>
@ -354,7 +354,7 @@ namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public async Task<AzureOperationResponse> PostMultipleParameterGroupsWithHttpMessagesAsync(FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), SecondParameterGroup secondParameterGroup = default(SecondParameterGroup), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationResponse> PostMultipleParameterGroupsWithHttpMessagesAsync(FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup parameterGroupingPostMultipleParameterGroupsSecondParameterGroup = default(ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
string headerOne = null;
if (firstParameterGroup != null)
@ -367,14 +367,14 @@ namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
queryOne = firstParameterGroup.QueryOne;
}
string headerTwo = null;
if (secondParameterGroup != null)
if (parameterGroupingPostMultipleParameterGroupsSecondParameterGroup != null)
{
headerTwo = secondParameterGroup.HeaderTwo;
headerTwo = parameterGroupingPostMultipleParameterGroupsSecondParameterGroup.HeaderTwo;
}
int? queryTwo = null;
if (secondParameterGroup != null)
if (parameterGroupingPostMultipleParameterGroupsSecondParameterGroup != null)
{
queryTwo = secondParameterGroup.QueryTwo;
queryTwo = parameterGroupingPostMultipleParameterGroupsSecondParameterGroup.QueryTwo;
}
// Tracing
bool shouldTrace = ServiceClientTracing.IsEnabled;
@ -499,5 +499,138 @@ namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
return result;
}
/// <summary>
/// Post parameters with a shared parameter group object
/// </summary>
/// <param name='firstParameterGroup'>
/// Additional parameters for the operation
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public async Task<AzureOperationResponse> PostSharedParameterGroupObjectWithHttpMessagesAsync(FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
string headerOne = null;
if (firstParameterGroup != null)
{
headerOne = firstParameterGroup.HeaderOne;
}
int? queryOne = null;
if (firstParameterGroup != null)
{
queryOne = firstParameterGroup.QueryOne;
}
// Tracing
bool shouldTrace = ServiceClientTracing.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("headerOne", headerOne);
tracingParameters.Add("queryOne", queryOne);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(invocationId, this, "PostSharedParameterGroupObject", tracingParameters);
}
// Construct URL
var baseUrl = this.Client.BaseUri.AbsoluteUri;
var url = new Uri(new Uri(baseUrl + (baseUrl.EndsWith("/") ? "" : "/")), "parameterGrouping/sharedParameterGroupObject").ToString();
List<string> queryParameters = new List<string>();
if (queryOne != null)
{
queryParameters.Add(string.Format("query-one={0}", Uri.EscapeDataString(JsonConvert.SerializeObject(queryOne, this.Client.SerializationSettings).Trim('"'))));
}
if (queryParameters.Count > 0)
{
url += "?" + string.Join("&", queryParameters);
}
// Create HTTP transport objects
HttpRequestMessage httpRequest = new HttpRequestMessage();
httpRequest.Method = new HttpMethod("POST");
httpRequest.RequestUri = new Uri(url);
// Set Headers
httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
if (this.Client.AcceptLanguage != null)
{
if (httpRequest.Headers.Contains("accept-language"))
{
httpRequest.Headers.Remove("accept-language");
}
httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
}
if (headerOne != null)
{
if (httpRequest.Headers.Contains("header-one"))
{
httpRequest.Headers.Remove("header-one");
}
httpRequest.Headers.TryAddWithoutValidation("header-one", headerOne);
}
if (customHeaders != null)
{
foreach(var header in customHeaders)
{
if (httpRequest.Headers.Contains(header.Key))
{
httpRequest.Headers.Remove(header.Key);
}
httpRequest.Headers.TryAddWithoutValidation(header.Key, header.Value);
}
}
// Set Credentials
if (this.Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (shouldTrace)
{
ServiceClientTracing.SendRequest(invocationId, httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
HttpResponseMessage httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
if (shouldTrace)
{
ServiceClientTracing.ReceiveResponse(invocationId, httpResponse);
}
HttpStatusCode statusCode = httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
if ((int)statusCode != 200)
{
var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", statusCode));
string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
Error errorBody = JsonConvert.DeserializeObject<Error>(responseContent, this.Client.DeserializationSettings);
if (errorBody != null)
{
ex.Body = errorBody;
}
ex.Request = httpRequest;
ex.Response = httpResponse;
if (shouldTrace)
{
ServiceClientTracing.Error(invocationId, ex);
}
throw ex;
}
// Create Result
var result = new AzureOperationResponse();
result.Request = httpRequest;
result.Response = httpResponse;
if (httpResponse.Headers.Contains("x-ms-request-id"))
{
result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (shouldTrace)
{
ServiceClientTracing.Exit(invocationId, result);
}
return result;
}
}
}

Просмотреть файл

@ -90,12 +90,12 @@ namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
/// <param name='firstParameterGroup'>
/// Additional parameters for the operation
/// </param>
/// <param name='secondParameterGroup'>
/// <param name='parameterGroupingPostMultipleParameterGroupsSecondParameterGroup'>
/// Additional parameters for the operation
/// </param>
public static void PostMultipleParameterGroups(this IParameterGroupingOperations operations, FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), SecondParameterGroup secondParameterGroup = default(SecondParameterGroup))
public static void PostMultipleParameterGroups(this IParameterGroupingOperations operations, FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup parameterGroupingPostMultipleParameterGroupsSecondParameterGroup = default(ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup))
{
Task.Factory.StartNew(s => ((IParameterGroupingOperations)s).PostMultipleParameterGroupsAsync(firstParameterGroup, secondParameterGroup), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
Task.Factory.StartNew(s => ((IParameterGroupingOperations)s).PostMultipleParameterGroupsAsync(firstParameterGroup, parameterGroupingPostMultipleParameterGroupsSecondParameterGroup), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
}
/// <summary>
@ -107,15 +107,46 @@ namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
/// <param name='firstParameterGroup'>
/// Additional parameters for the operation
/// </param>
/// <param name='secondParameterGroup'>
/// <param name='parameterGroupingPostMultipleParameterGroupsSecondParameterGroup'>
/// Additional parameters for the operation
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task PostMultipleParameterGroupsAsync( this IParameterGroupingOperations operations, FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), SecondParameterGroup secondParameterGroup = default(SecondParameterGroup), CancellationToken cancellationToken = default(CancellationToken))
public static async Task PostMultipleParameterGroupsAsync( this IParameterGroupingOperations operations, FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup parameterGroupingPostMultipleParameterGroupsSecondParameterGroup = default(ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup), CancellationToken cancellationToken = default(CancellationToken))
{
await operations.PostMultipleParameterGroupsWithHttpMessagesAsync(firstParameterGroup, secondParameterGroup, null, cancellationToken).ConfigureAwait(false);
await operations.PostMultipleParameterGroupsWithHttpMessagesAsync(firstParameterGroup, parameterGroupingPostMultipleParameterGroupsSecondParameterGroup, null, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Post parameters with a shared parameter group object
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='firstParameterGroup'>
/// Additional parameters for the operation
/// </param>
public static void PostSharedParameterGroupObject(this IParameterGroupingOperations operations, FirstParameterGroup firstParameterGroup = default(FirstParameterGroup))
{
Task.Factory.StartNew(s => ((IParameterGroupingOperations)s).PostSharedParameterGroupObjectAsync(firstParameterGroup), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
}
/// <summary>
/// Post parameters with a shared parameter group object
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='firstParameterGroup'>
/// Additional parameters for the operation
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task PostSharedParameterGroupObjectAsync( this IParameterGroupingOperations operations, FirstParameterGroup firstParameterGroup = default(FirstParameterGroup), CancellationToken cancellationToken = default(CancellationToken))
{
await operations.PostSharedParameterGroupObjectWithHttpMessagesAsync(firstParameterGroup, null, cancellationToken).ConfigureAwait(false);
}
}

Просмотреть файл

@ -36,13 +36,15 @@ namespace Fixtures.Azure.AcceptanceTestsPaging
/// <summary>
/// A paging operation that includes a nextLink that has 10 pages
/// </summary>
/// <param name='clientRequestId'>
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
Task<AzureOperationResponse<IPage<Product>>> GetMultiplePagesWithHttpMessagesAsync(Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<AzureOperationResponse<IPage<Product>>> GetMultiplePagesWithHttpMessagesAsync(string clientRequestId = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// A paging operation that fails on the first call with 500 and then
/// retries and then get a response including a nextLink that has 10
@ -117,13 +119,15 @@ namespace Fixtures.Azure.AcceptanceTestsPaging
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.
/// </param>
/// <param name='clientRequestId'>
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
Task<AzureOperationResponse<IPage<Product>>> GetMultiplePagesNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<AzureOperationResponse<IPage<Product>>> GetMultiplePagesNextWithHttpMessagesAsync(string nextPageLink, string clientRequestId = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// A paging operation that fails on the first call with 500 and then
/// retries and then get a response including a nextLink that has 10

Просмотреть файл

@ -164,13 +164,15 @@ namespace Fixtures.Azure.AcceptanceTestsPaging
/// <summary>
/// A paging operation that includes a nextLink that has 10 pages
/// </summary>
/// <param name='clientRequestId'>
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public async Task<AzureOperationResponse<IPage<Product>>> GetMultiplePagesWithHttpMessagesAsync(Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationResponse<IPage<Product>>> GetMultiplePagesWithHttpMessagesAsync(string clientRequestId = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Tracing
bool shouldTrace = ServiceClientTracing.IsEnabled;
@ -179,6 +181,7 @@ namespace Fixtures.Azure.AcceptanceTestsPaging
{
invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("clientRequestId", clientRequestId);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(invocationId, this, "GetMultiplePages", tracingParameters);
}
@ -196,6 +199,14 @@ namespace Fixtures.Azure.AcceptanceTestsPaging
httpRequest.RequestUri = new Uri(url);
// Set Headers
httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
if (clientRequestId != null)
{
if (httpRequest.Headers.Contains("client-request-id"))
{
httpRequest.Headers.Remove("client-request-id");
}
httpRequest.Headers.TryAddWithoutValidation("client-request-id", clientRequestId);
}
if (this.Client.AcceptLanguage != null)
{
if (httpRequest.Headers.Contains("accept-language"))
@ -969,13 +980,15 @@ namespace Fixtures.Azure.AcceptanceTestsPaging
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.
/// </param>
/// <param name='clientRequestId'>
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public async Task<AzureOperationResponse<IPage<Product>>> GetMultiplePagesNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationResponse<IPage<Product>>> GetMultiplePagesNextWithHttpMessagesAsync(string nextPageLink, string clientRequestId = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (nextPageLink == null)
{
@ -989,6 +1002,7 @@ namespace Fixtures.Azure.AcceptanceTestsPaging
invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("nextPageLink", nextPageLink);
tracingParameters.Add("clientRequestId", clientRequestId);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(invocationId, this, "GetMultiplePagesNext", tracingParameters);
}
@ -1006,6 +1020,14 @@ namespace Fixtures.Azure.AcceptanceTestsPaging
httpRequest.RequestUri = new Uri(url);
// Set Headers
httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
if (clientRequestId != null)
{
if (httpRequest.Headers.Contains("client-request-id"))
{
httpRequest.Headers.Remove("client-request-id");
}
httpRequest.Headers.TryAddWithoutValidation("client-request-id", clientRequestId);
}
if (this.Client.AcceptLanguage != null)
{
if (httpRequest.Headers.Contains("accept-language"))

Просмотреть файл

@ -51,9 +51,11 @@ namespace Fixtures.Azure.AcceptanceTestsPaging
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
public static IPage<Product> GetMultiplePages(this IPagingOperations operations)
/// <param name='clientRequestId'>
/// </param>
public static IPage<Product> GetMultiplePages(this IPagingOperations operations, string clientRequestId = default(string))
{
return Task.Factory.StartNew(s => ((IPagingOperations)s).GetMultiplePagesAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
return Task.Factory.StartNew(s => ((IPagingOperations)s).GetMultiplePagesAsync(clientRequestId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
}
/// <summary>
@ -62,12 +64,14 @@ namespace Fixtures.Azure.AcceptanceTestsPaging
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='clientRequestId'>
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<IPage<Product>> GetMultiplePagesAsync( this IPagingOperations operations, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<IPage<Product>> GetMultiplePagesAsync( this IPagingOperations operations, string clientRequestId = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
AzureOperationResponse<IPage<Product>> result = await operations.GetMultiplePagesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false);
AzureOperationResponse<IPage<Product>> result = await operations.GetMultiplePagesWithHttpMessagesAsync(clientRequestId, null, cancellationToken).ConfigureAwait(false);
return result.Body;
}
@ -248,9 +252,11 @@ namespace Fixtures.Azure.AcceptanceTestsPaging
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.
/// </param>
public static IPage<Product> GetMultiplePagesNext(this IPagingOperations operations, string nextPageLink)
/// <param name='clientRequestId'>
/// </param>
public static IPage<Product> GetMultiplePagesNext(this IPagingOperations operations, string nextPageLink, string clientRequestId = default(string))
{
return Task.Factory.StartNew(s => ((IPagingOperations)s).GetMultiplePagesNextAsync(nextPageLink), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
return Task.Factory.StartNew(s => ((IPagingOperations)s).GetMultiplePagesNextAsync(nextPageLink, clientRequestId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
}
/// <summary>
@ -262,12 +268,14 @@ namespace Fixtures.Azure.AcceptanceTestsPaging
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.
/// </param>
/// <param name='clientRequestId'>
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<IPage<Product>> GetMultiplePagesNextAsync( this IPagingOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<IPage<Product>> GetMultiplePagesNextAsync( this IPagingOperations operations, string nextPageLink, string clientRequestId = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
AzureOperationResponse<IPage<Product>> result = await operations.GetMultiplePagesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false);
AzureOperationResponse<IPage<Product>> result = await operations.GetMultiplePagesNextWithHttpMessagesAsync(nextPageLink, clientRequestId, null, cancellationToken).ConfigureAwait(false);
return result.Body;
}

Просмотреть файл

@ -67,9 +67,13 @@
<Project>{c876085f-9dc3-41f0-b7b4-17022cd84684}</Project>
<Name>AutoRest.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\Azure.Common\Azure.Common\AutoRest.Generator.Azure.Common.csproj">
<ProjectReference Include="..\..\Extensions\Azure.Extensions\AutoRest.Generator.Azure.Extensions.csproj">
<Project>{90b943ab-3879-4b64-b9ff-1a21297c0f26}</Project>
<Name>AutoRest.Generator.Azure.Common</Name>
<Name>AutoRest.Generator.Azure.Extensions</Name>
</ProjectReference>
<ProjectReference Include="..\..\Extensions\Extensions\AutoRest.Generator.Extensions.csproj">
<Project>{7dd043eb-5e53-4180-b123-cc3cc5022e34}</Project>
<Name>AutoRest.Generator.Extensions</Name>
</ProjectReference>
<ProjectReference Include="..\CSharp\AutoRest.Generator.CSharp.csproj">
<Project>{cc1eec95-41ef-44b6-8761-00fa3e647248}</Project>

Просмотреть файл

@ -6,15 +6,15 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Rest.Generator.Azure;
using Microsoft.Rest.Generator.ClientModel;
using Microsoft.Rest.Generator.CSharp.Azure.Templates;
using Microsoft.Rest.Generator.CSharp.Templates;
using System.Collections.Generic;
using Microsoft.Rest.Generator.Azure;
namespace Microsoft.Rest.Generator.CSharp.Azure
{
public class AzureCSharpCodeGenerator : AzureCodeGenerator
public class AzureCSharpCodeGenerator : CSharpCodeGenerator
{
private readonly AzureCSharpCodeNamer _namer;
@ -60,7 +60,7 @@ namespace Microsoft.Rest.Generator.CSharp.Azure
/// <param name="serviceClient"></param>
public override void NormalizeClientModel(ServiceClient serviceClient)
{
base.NormalizeClientModel(serviceClient);
AzureExtensions.NormalizeAzureClientModel(serviceClient, Settings);
_namer.NormalizeClientModel(serviceClient);
_namer.ResolveNameCollisions(serviceClient, Settings.Namespace,
Settings.Namespace + ".Models");
@ -70,7 +70,8 @@ namespace Microsoft.Rest.Generator.CSharp.Azure
{
foreach (var model in serviceClient.ModelTypes)
{
if (model.Extensions.ContainsKey(AzureResourceExtension) && (bool)model.Extensions[AzureResourceExtension])
if (model.Extensions.ContainsKey(AzureExtensions.AzureResourceExtension) &&
(bool)model.Extensions[AzureExtensions.AzureResourceExtension])
{
model.BaseModelType = new CompositeType { Name = "IResource", SerializedName = "IResource" };
}
@ -134,7 +135,8 @@ namespace Microsoft.Rest.Generator.CSharp.Azure
// Models
foreach (var model in serviceClient.ModelTypes)
{
if (model.Extensions.ContainsKey(ExternalExtension) && (bool) model.Extensions[ExternalExtension])
if (model.Extensions.ContainsKey(AzureExtensions.ExternalExtension) &&
(bool) model.Extensions[AzureExtensions.ExternalExtension])
{
continue;
}

Просмотреть файл

@ -28,7 +28,7 @@ namespace Microsoft.Rest.Generator.CSharp
{
// default value
nextLinkName = null;
var ext = extensions[AzureCodeGenerator.PageableExtension] as Newtonsoft.Json.Linq.JContainer;
var ext = extensions[AzureExtensions.PageableExtension] as Newtonsoft.Json.Linq.JContainer;
if (ext == null)
{
return null;
@ -85,7 +85,7 @@ namespace Microsoft.Rest.Generator.CSharp
var convertedTypes = new Dictionary<IType, CompositeType>();
foreach (var method in serviceClient.Methods.Where(m => m.Extensions.ContainsKey(AzureCodeGenerator.PageableExtension)))
foreach (var method in serviceClient.Methods.Where(m => m.Extensions.ContainsKey(AzureExtensions.PageableExtension)))
{
string nextLinkString;
string pageClassName = GetPagingSetting(method.Extensions, pageClasses, out nextLinkString);
@ -111,8 +111,8 @@ namespace Microsoft.Rest.Generator.CSharp
{
Name = pagableTypeName
};
pagedResult.Extensions[AzureCodeGenerator.ExternalExtension] = true;
pagedResult.Extensions[AzureCodeGenerator.PageableExtension] = ipagableTypeName;
pagedResult.Extensions[AzureExtensions.ExternalExtension] = true;
pagedResult.Extensions[AzureExtensions.PageableExtension] = ipagableTypeName;
convertedTypes[method.Responses[responseStatus]] = pagedResult;
method.Responses[responseStatus] = pagedResult;
@ -125,7 +125,7 @@ namespace Microsoft.Rest.Generator.CSharp
}
}
AzureCodeGenerator.RemoveUnreferencedTypes(serviceClient, convertedTypes.Keys.Cast<CompositeType>().Select(t => t.Name));
AzureExtensions.RemoveUnreferencedTypes(serviceClient, convertedTypes.Keys.Cast<CompositeType>().Select(t => t.Name));
}
}
}

Просмотреть файл

@ -37,7 +37,7 @@ namespace Microsoft.Rest.Generator.CSharp.Azure
yield return "System.Linq.Expressions";
}
yield return "Microsoft.Rest.Azure";
if (this.ModelTypes.Any(m => !m.Extensions.ContainsKey(AzureCodeGenerator.ExternalExtension)))
if (this.ModelTypes.Any(m => !m.Extensions.ContainsKey(AzureExtensions.ExternalExtension)))
{
yield return "Models";
}

Просмотреть файл

@ -41,7 +41,7 @@ namespace Microsoft.Rest.Generator.CSharp.Azure
}
yield return "Microsoft.Rest.Azure";
if (this.ModelTypes.Any(m => !m.Extensions.ContainsKey(AzureCodeGenerator.ExternalExtension)))
if (this.ModelTypes.Any(m => !m.Extensions.ContainsKey(AzureExtensions.ExternalExtension)))
{
yield return "Models";
}

Просмотреть файл

@ -33,8 +33,8 @@ namespace Microsoft.Rest.Generator.CSharp.Azure
MethodGroupName = MethodGroupName + "Operations";
}
this.ClientRequestIdString = AzureCodeGenerator.GetClientRequestIdString(source);
this.RequestIdString = AzureCodeGenerator.GetRequestIdString(source);
this.ClientRequestIdString = AzureExtensions.GetClientRequestIdString(source);
this.RequestIdString = AzureExtensions.GetRequestIdString(source);
}
public string ClientRequestIdString { get; private set; }
@ -79,7 +79,7 @@ namespace Microsoft.Rest.Generator.CSharp.Azure
/// </summary>
public bool IsLongRunningOperation
{
get { return Extensions.ContainsKey(AzureCodeGenerator.LongRunningExtension); }
get { return Extensions.ContainsKey(AzureExtensions.LongRunningExtension); }
}
private string ReturnTypePageInterfaceName
@ -90,9 +90,9 @@ namespace Microsoft.Rest.Generator.CSharp.Azure
{
// Special handle Page class with IPage interface
CompositeType compositeType = ReturnType as CompositeType;
if (compositeType.Extensions.ContainsKey(AzureCodeGenerator.PageableExtension))
if (compositeType.Extensions.ContainsKey(AzureExtensions.PageableExtension))
{
return (string)compositeType.Extensions[AzureCodeGenerator.PageableExtension];
return (string)compositeType.Extensions[AzureExtensions.PageableExtension];
}
}
return null;
@ -177,7 +177,7 @@ namespace Microsoft.Rest.Generator.CSharp.Azure
if (this.HttpMethod == HttpMethod.Head &&
this.ReturnType != null)
{
HttpStatusCode code = this.Responses.Keys.FirstOrDefault(AzureCodeGenerator.HttpHeadStatusCodeSuccessFunc);
HttpStatusCode code = this.Responses.Keys.FirstOrDefault(AzureExtensions.HttpHeadStatusCodeSuccessFunc);
sb.AppendFormat("result.Body = (statusCode == HttpStatusCode.{0});", code.ToString()).AppendLine();
}
sb.AppendLine("if (httpResponse.Headers.Contains(\"{0}\"))", this.RequestIdString)
@ -255,7 +255,7 @@ namespace Microsoft.Rest.Generator.CSharp.Azure
queryParametersAddString =
"queryParameters.Add(string.Format(\"{0}={{0}}\", FilterString.Generate(filter)));";
}
else if (queryParameter.Extensions.ContainsKey(AzureCodeGenerator.SkipUrlEncodingExtension))
else if (queryParameter.Extensions.ContainsKey(AzureExtensions.SkipUrlEncodingExtension))
{
queryParametersAddString = "queryParameters.Add(string.Format(\"{0}={{0}}\", {1}));";
}
@ -280,7 +280,7 @@ namespace Microsoft.Rest.Generator.CSharp.Azure
foreach (var pathParameter in LogicalParameters.Where(p => p.Location == ParameterLocation.Path))
{
string replaceString = "{0} = {0}.Replace(\"{{{1}}}\", Uri.EscapeDataString({2}));";
if (pathParameter.Extensions.ContainsKey(AzureCodeGenerator.SkipUrlEncodingExtension))
if (pathParameter.Extensions.ContainsKey(AzureExtensions.SkipUrlEncodingExtension))
{
replaceString = "{0} = {0}.Replace(\"{{{1}}}\", {2});";
}

Просмотреть файл

@ -50,7 +50,7 @@ namespace Microsoft.Rest.Generator.CSharp.Azure
}
yield return "Microsoft.Rest.Azure";
if (this.ModelTypes.Any( m => !m.Extensions.ContainsKey(AzureCodeGenerator.ExternalExtension)))
if (this.ModelTypes.Any( m => !m.Extensions.ContainsKey(AzureExtensions.ExternalExtension)))
{
yield return "Models";
}

Просмотреть файл

@ -1034,10 +1034,13 @@ namespace Microsoft.Rest.Generator.CSharp.Tests
var polymorphismResult = client.Polymorphism.GetValid() as Salmon;
Assert.NotNull(polymorphismResult);
Assert.Equal("alaska", polymorphismResult.Location);
Assert.True(polymorphismResult.Siblings[0] is Shark);
Assert.True(polymorphismResult.Siblings[1] is Sawshark);
Assert.Equal(3, polymorphismResult.Siblings.Count);
Assert.IsType(typeof(Shark), polymorphismResult.Siblings[0]);
Assert.IsType(typeof(Sawshark), polymorphismResult.Siblings[1]);
Assert.IsType(typeof(Goblinshark), polymorphismResult.Siblings[2]);
Assert.Equal(6, ((Shark) polymorphismResult.Siblings[0]).Age);
Assert.Equal(105, ((Sawshark) polymorphismResult.Siblings[1]).Age);
Assert.Equal(1, ((Goblinshark)polymorphismResult.Siblings[2]).Age);
// PUT polymorphism/valid
var polymorphismRequest = new Salmon
{
@ -1061,6 +1064,14 @@ namespace Microsoft.Rest.Generator.CSharp.Tests
Species = "dangerous",
Birthday = new DateTime(1900, 1, 5, 1, 0, 0, DateTimeKind.Utc),
Picture = new byte[] {255, 255, 255, 255, 254}
},
new Goblinshark()
{
Age = 1,
Length = 30,
Species = "scary",
Birthday = new DateTime(2015, 8, 8, 0, 0, 0, DateTimeKind.Utc),
Jawsize = 5
}
}
};

Просмотреть файл

@ -224,7 +224,7 @@
<Compile Include="Utilities\MirrorTestHelpers.cs" />
<Compile Include="Utilities\MirroringHandler.cs" />
<Compile Include="Utilities\RecordedDelegatingHandler.cs" />
<Compile Include="SerializationTests.cs" />
<Compile Include="MirrorTests.cs" />
<Compile Include="Utilities\ServiceController.cs" />
<Compile Include="AcceptanceTestOrderer.cs" />
<Compile Include="Utilities\TestExtensions.cs" />

Просмотреть файл

@ -58,6 +58,14 @@ namespace Fixtures.AcceptanceTestsBodyComplex
/// '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
/// }
/// ]
/// };

Просмотреть файл

@ -17,7 +17,6 @@ namespace Fixtures.AcceptanceTestsBodyComplex.Models
/// <summary>
/// </summary>
[JsonObject("fish")]
public partial class Fish
{
/// <summary>

Просмотреть файл

@ -0,0 +1,49 @@
// 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 0.13.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
namespace Fixtures.AcceptanceTestsBodyComplex.Models
{
using System;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
/// <summary>
/// </summary>
[JsonObject("goblin")]
public partial class Goblinshark : Shark
{
/// <summary>
/// Initializes a new instance of the Goblinshark class.
/// </summary>
public Goblinshark() { }
/// <summary>
/// Initializes a new instance of the Goblinshark class.
/// </summary>
public Goblinshark(int? jawsize = default(int?))
{
Jawsize = jawsize;
}
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "jawsize")]
public int? Jawsize { get; set; }
/// <summary>
/// Validate the object. Throws ArgumentException or ArgumentNullException if validation fails.
/// </summary>
public override void Validate()
{
base.Validate();
}
}
}

Просмотреть файл

@ -163,6 +163,14 @@ namespace Fixtures.AcceptanceTestsBodyComplex
/// '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
/// }
/// ]
/// };

Просмотреть файл

@ -74,6 +74,14 @@ namespace Fixtures.AcceptanceTestsBodyComplex
/// '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
/// }
/// ]
/// };
@ -113,6 +121,14 @@ namespace Fixtures.AcceptanceTestsBodyComplex
/// '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
/// }
/// ]
/// };

Просмотреть файл

@ -4,25 +4,20 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Fixtures.MirrorRecursiveTypes;
using System.Net.Http;
using Fixtures.MirrorPolymorphic;
using Fixtures.MirrorPolymorphic.Models;
using Fixtures.MirrorPrimitives;
using Fixtures.MirrorRecursiveTypes;
using Fixtures.MirrorSequences;
using Fixtures.MirrorSequences.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Xunit;
using System.Net.Http;
namespace Microsoft.Rest.Generator.CSharp.Tests
{
[Collection("AutoRest Tests")]
public class MirrorTests
{
private static string ExpectedPath(string file)
{
return Path.Combine("Expected", file);
@ -108,7 +103,10 @@ namespace Microsoft.Rest.Generator.CSharp.Tests
[Fact]
public void CanRoundtripPolymorphicTypes()
{
//SwaggerSpecHelper.RunTests<CSharpCodeGenerator>(SwaggerPath("Mirror\swagger-mirror-polymorphic.json",ExpectedPath("Mirror.Polymorphic.cs");
SwaggerSpecHelper.RunTests<CSharpCodeGenerator>(
SwaggerPath("swagger-mirror-polymorphic.json"),
ExpectedPath("Mirror.Polymorphic"));
var pets = new[]
{
new Animal {Description = "Pet Only", Id = "1"},
@ -190,12 +188,12 @@ namespace Microsoft.Rest.Generator.CSharp.Tests
public static void SendAndComparePolymorphicObjects(Animal expected)
{
if (expected == null)
if (expected == null)
{
throw new ArgumentNullException("expected");
}
using (var client = new PolymorphicAnimalStore(new Uri("http://localhost:3000"), new MirroringHandler()))
using (var client = new PolymorphicAnimalStore(new Uri("http://localhost:3000"), new MirroringHandler()))
{
var createdPet = client.CreateOrUpdatePolymorphicAnimals(expected);
Assert.NotNull(expected);

Просмотреть файл

@ -99,6 +99,10 @@
<Project>{c876085f-9dc3-41f0-b7b4-17022cd84684}</Project>
<Name>AutoRest.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\Extensions\Extensions\AutoRest.Generator.Extensions.csproj">
<Project>{7dd043eb-5e53-4180-b123-cc3cc5022e34}</Project>
<Name>AutoRest.Generator.Extensions</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<CodeAnalysisDictionary Include="..\..\..\..\Tools\CustomDictionary.xml">

Просмотреть файл

@ -51,6 +51,7 @@ namespace Microsoft.Rest.Generator.CSharp
public override void NormalizeClientModel(ServiceClient serviceClient)
{
PopulateAdditionalProperties(serviceClient);
Extensions.NormalizeClientModel(serviceClient, Settings);
_namer.NormalizeClientModel(serviceClient);
_namer.ResolveNameCollisions(serviceClient, Settings.Namespace,
Settings.Namespace + ".Models");

Просмотреть файл

@ -44,8 +44,7 @@ namespace Microsoft.Rest.Generator.CSharp
{
get
{
return (!string.IsNullOrEmpty(PolymorphicDiscriminator) && Name != SerializedName) ||
(_baseModel != null && _baseModel.NeedsPolymorphicConverter);
return this.IsPolymorphicType && Name != SerializedName;
}
}
@ -71,5 +70,14 @@ namespace Microsoft.Rest.Generator.CSharp
{
get { return Enumerable.Empty<string>(); }
}
private bool IsPolymorphicType
{
get
{
return !string.IsNullOrEmpty(PolymorphicDiscriminator) ||
(_baseModel != null && _baseModel.IsPolymorphicType);
}
}
}
}

Просмотреть файл

@ -11,8 +11,8 @@
<ProjectGuid>{2C062B51-EFD0-4FDC-8F75-3D76161FBCB5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Rest.Generator.Azure.Common.Tests</RootNamespace>
<AssemblyName>AutoRest.Generator.Azure.Common.Tests</AssemblyName>
<RootNamespace>Microsoft.Rest.Generator.Azure.Extensions.Tests</RootNamespace>
<AssemblyName>AutoRest.Generator.Azure.Extensions.Tests</AssemblyName>
<FileAlignment>512</FileAlignment>
<RestorePackages>true</RestorePackages>
<AutoRestTest>true</AutoRestTest>
@ -53,14 +53,18 @@
<Project>{c876085f-9dc3-41f0-b7b4-17022cd84684}</Project>
<Name>AutoRest.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Azure.Common\AutoRest.Generator.Azure.Common.csproj">
<Project>{90b943ab-3879-4b64-b9ff-1a21297c0f26}</Project>
<Name>AutoRest.Generator.Azure.Common</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Modelers\Swagger\AutoRest.Modeler.Swagger.csproj">
<Project>{9517265e-5127-460c-9dde-fe017d73121c}</Project>
<Name>AutoRest.Modeler.Swagger</Name>
</ProjectReference>
<ProjectReference Include="..\Azure.Extensions\AutoRest.Generator.Azure.Extensions.csproj">
<Project>{90b943ab-3879-4b64-b9ff-1a21297c0f26}</Project>
<Name>AutoRest.Generator.Azure.Extensions</Name>
</ProjectReference>
<ProjectReference Include="..\Extensions\AutoRest.Generator.Extensions.csproj">
<Project>{7dd043eb-5e53-4180-b123-cc3cc5022e34}</Project>
<Name>AutoRest.Generator.Extensions</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />

Просмотреть файл

@ -7,7 +7,7 @@ using Microsoft.Rest.Modeler.Swagger.Azure.Tests;
using System.Linq;
using Xunit;
namespace Microsoft.Rest.Generator.Azure.Common.Tests
namespace Microsoft.Rest.Generator.Azure.Extensions.Tests
{
[Collection("AutoRest Tests")]
public class AzureServiceClientNormalizerTests
@ -32,7 +32,7 @@ namespace Microsoft.Rest.Generator.Azure.Common.Tests
serviceClient.ModelTypes.Add(dog);
resource.Name = "resource";
resource.Extensions[AzureCodeGenerator.AzureResourceExtension] = true;
resource.Extensions[AzureExtensions.AzureResourceExtension] = true;
resource.Properties.Add(new Property
{
Name = "id",
@ -112,7 +112,7 @@ namespace Microsoft.Rest.Generator.Azure.Common.Tests
serviceClient.ModelTypes.Add(dog);
resource.Name = "resource";
resource.Extensions[AzureCodeGenerator.AzureResourceExtension] = true;
resource.Extensions[AzureExtensions.AzureResourceExtension] = true;
resource.Properties.Add(new Property
{
Name = "id",
@ -230,7 +230,7 @@ namespace Microsoft.Rest.Generator.Azure.Common.Tests
Type = PrimaryType.String,
IsRequired = true
});
resource.Extensions[AzureCodeGenerator.AzureResourceExtension] = null;
resource.Extensions[AzureExtensions.AzureResourceExtension] = null;
resourceProperties.Name = "resourceProperties";
resourceProperties.Properties.Add(new Property
{
@ -296,7 +296,7 @@ namespace Microsoft.Rest.Generator.Azure.Common.Tests
Type = PrimaryType.String,
IsRequired = true
});
resource.Extensions[AzureCodeGenerator.AzureResourceExtension] = null;
resource.Extensions[AzureExtensions.AzureResourceExtension] = null;
resourceProperties.Name = "resourceProperties";
resourceProperties.Properties.Add(new Property
{
@ -384,8 +384,8 @@ namespace Microsoft.Rest.Generator.Azure.Common.Tests
Assert.NotNull(serviceClient);
var resource = serviceClient.ModelTypes.First(m =>
m.Name.Equals("Resource", System.StringComparison.OrdinalIgnoreCase));
Assert.True(resource.Extensions.ContainsKey(AzureCodeGenerator.AzureResourceExtension));
Assert.False((bool)resource.Extensions[AzureCodeGenerator.AzureResourceExtension]);
Assert.True(resource.Extensions.ContainsKey(AzureExtensions.AzureResourceExtension));
Assert.False((bool)resource.Extensions[AzureExtensions.AzureResourceExtension]);
var flattenedProduct = serviceClient.ModelTypes.First(m =>
m.Name.Equals("FlattenedProduct", System.StringComparison.OrdinalIgnoreCase));
Assert.True(flattenedProduct.BaseModelType.Equals(resource));

Просмотреть файл

@ -9,27 +9,27 @@
// You do not need to add suppressions to this file manually.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member",
Target = "Microsoft.Rest.Generator.Azure.Common.Tests.AzureServiceClientNormalizerTests.#ResourceIsFlattenedForSimpleResource()",
Target = "Microsoft.Rest.Generator.Azure.Extensions.Tests.AzureServiceClientNormalizerTests.#ResourceIsFlattenedForSimpleResource()",
Justification = "Test methods must not be static to allow suite-level fixtures")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member",
Target = "Microsoft.Rest.Generator.Azure.Common.Tests.AzureServiceClientNormalizerTests.#ResourceIsFlattenedForComplexResource()",
Target = "Microsoft.Rest.Generator.Azure.Extensions.Tests.AzureServiceClientNormalizerTests.#ResourceIsFlattenedForComplexResource()",
Justification = "Test methods must not be static to allow suite-level fixtures")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member",
Target = "Microsoft.Rest.Generator.Azure.Common.Tests.AzureServiceClientNormalizerTests.#SwaggerODataSpecParsingTest()",
Target = "Microsoft.Rest.Generator.Azure.Extensions.Tests.AzureServiceClientNormalizerTests.#SwaggerODataSpecParsingTest()",
Justification = "Test methods must not be static to allow suite-level fixtures")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member",
Target = "Microsoft.Rest.Generator.Azure.Common.Tests.AzureServiceClientNormalizerTests.#SwaggerResourceExternalFalseTest()",
Target = "Microsoft.Rest.Generator.Azure.Extensions.Tests.AzureServiceClientNormalizerTests.#SwaggerResourceExternalFalseTest()",
Justification = "Test methods must not be static to allow suite-level fixtures")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member",
Target = "Microsoft.Rest.Generator.Azure.Common.Tests.AzureServiceClientNormalizerTests.#AzureParameterTest()",
Target = "Microsoft.Rest.Generator.Azure.Extensions.Tests.AzureServiceClientNormalizerTests.#AzureParameterTest()",
Justification = "Test methods must not be static to allow suite-level fixtures")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member",
Target = "Microsoft.Rest.Generator.Azure.Common.Tests.AzureServiceClientNormalizerTests.#PageableTest()",
Target = "Microsoft.Rest.Generator.Azure.Extensions.Tests.AzureServiceClientNormalizerTests.#PageableTest()",
Justification = "Test methods must not be static to allow suite-level fixtures")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member",
Target = "Microsoft.Rest.Generator.Azure.Common.Tests.AzureServiceClientNormalizerTests.#ExternalResourceTypeIsNullSafe()",
Target = "Microsoft.Rest.Generator.Azure.Extensions.Tests.AzureServiceClientNormalizerTests.#ExternalResourceTypeIsNullSafe()",
Justification = "Test methods must not be static to allow suite-level fixtures")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member",
Target = "Microsoft.Rest.Generator.Azure.Common.Tests.AzureServiceClientNormalizerTests.#ResourceIsFlattenedForConflictingResource()",
Target = "Microsoft.Rest.Generator.Azure.Extensions.Tests.AzureServiceClientNormalizerTests.#ResourceIsFlattenedForConflictingResource()",
Justification = "Test methods must not be static to allow suite-level fixtures")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.Rest.Generator.Azure.Common.Tests.AzureServiceClientNormalizerTests.#FlatteningTest()")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.Rest.Generator.Azure.Extensions.Tests.AzureServiceClientNormalizerTests.#FlatteningTest()")]

Просмотреть файл

@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("AutoRest.Generator.Azure.Extensions.Tests")]
[assembly: AssemblyDescription("Tests for Azure Code Generators Extensions")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft AutoRest")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -1,14 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Threading.Tasks;
using Microsoft.Rest.Generator;
using Microsoft.Rest.Generator.Azure;
using Microsoft.Rest.Generator.Azure.Extensions;
using Microsoft.Rest.Generator.ClientModel;
namespace Microsoft.Rest.Modeler.Swagger.Azure.Tests
{
public class SampleAzureCodeGenerator : AzureCodeGenerator
public class SampleAzureCodeGenerator : CodeGenerator
{
public SampleAzureCodeGenerator(Settings settings) : base(settings)
{
@ -38,5 +40,10 @@ namespace Microsoft.Rest.Modeler.Swagger.Azure.Tests
{
return null;
}
public override void NormalizeClientModel(ServiceClient serviceClient)
{
AzureExtensions.NormalizeAzureClientModel(serviceClient, Settings);
}
}
}

Просмотреть файл

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\..\</SolutionDir>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<LibraryFxTarget Condition="'$(LibraryFxTarget)' == ''">net45</LibraryFxTarget>
<ProjectGuid>{90B943AB-3879-4B64-B9FF-1A21297C0F26}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Rest.Generator.Azure</RootNamespace>
<AssemblyName>AutoRest.Generator.Azure.Extensions</AssemblyName>
<FileAlignment>512</FileAlignment>
<RestorePackages>true</RestorePackages>
<Configuration Condition=" '$(Configuration)' == '' ">Net45-Debug</Configuration>
</PropertyGroup>
<Import Project="$(SolutionDir)\Tools\AutoRest.Settings.targets" />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Net45-Debug|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Net45-Debug</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(SolutionDir)\Tools\AssemblyVersionInfo.cs">
<Link>Properties\AssemblyVersionInfo.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="AzureExtensions.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\AutoRest.Core\AutoRest.Core.csproj">
<Project>{c876085f-9dc3-41f0-b7b4-17022cd84684}</Project>
<Name>AutoRest.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Modelers\Swagger\AutoRest.Modeler.Swagger.csproj">
<Project>{9517265e-5127-460c-9dde-fe017d73121c}</Project>
<Name>AutoRest.Modeler.Swagger</Name>
</ProjectReference>
<ProjectReference Include="..\Extensions\AutoRest.Generator.Extensions.csproj">
<Project>{7dd043eb-5e53-4180-b123-cc3cc5022e34}</Project>
<Name>AutoRest.Generator.Extensions</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<CodeAnalysisDictionary Include="..\..\..\..\Tools\CustomDictionary.xml">
<Link>CustomDictionary.xml</Link>
</CodeAnalysisDictionary>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Просмотреть файл

@ -18,7 +18,7 @@ namespace Microsoft.Rest.Generator.Azure
/// Base code generator for Azure.
/// Normalizes the ServiceClient according to Azure conventions and Swagger extensions.
/// </summary>
public abstract class AzureCodeGenerator : CodeGenerator
public abstract class AzureExtensions : Extensions
{
public const string LongRunningExtension = "x-ms-long-running-operation";
public const string PageableExtension = "x-ms-pageable";
@ -26,7 +26,7 @@ namespace Microsoft.Rest.Generator.Azure
public const string AzureResourceExtension = "x-ms-azure-resource";
public const string ODataExtension = "x-ms-odata";
public const string ClientRequestIdExtension = "x-ms-client-request-id";
//TODO: Ideally this would be the same extension as the ClientRequestIdExtension and have it specified on the response headers,
//TODO: But the response headers aren't currently used at all so we put an extension on the operation for now
public const string RequestIdExtension = "x-ms-request-id";
@ -54,21 +54,28 @@ namespace Microsoft.Rest.Generator.Azure
"Tags"
}.OrderBy(s=> s);
protected AzureCodeGenerator(Settings settings) : base(settings)
{
}
/// <summary>
/// Normalizes client model using Azure-specific extensions.
/// </summary>
/// <param name="serviceClient">Service client</param>
/// <param name="settings">AutoRest settings</param>
/// <returns></returns>
public override void NormalizeClientModel(ServiceClient serviceClient)
public static void NormalizeAzureClientModel(ServiceClient serviceClient, Settings settings)
{
Settings.AddCredentials = true;
if (serviceClient == null)
{
throw new ArgumentNullException("serviceClient");
}
if (settings == null)
{
throw new ArgumentNullException("settings");
}
settings.AddCredentials = true;
UpdateHeadMethods(serviceClient);
ParseODataExtension(serviceClient);
FlattenResourceProperties(serviceClient);
FlattenRequestPayload(serviceClient, settings);
AddPageableMethod(serviceClient);
AddLongRunningOperations(serviceClient);
AddAzureProperties(serviceClient);
@ -90,7 +97,7 @@ namespace Microsoft.Rest.Generator.Azure
foreach (var method in serviceClient.Methods.Where(m => m.HttpMethod == HttpMethod.Head)
.Where(m => m.ReturnType == null))
{
HttpStatusCode successStatusCode = method.Responses.Keys.FirstOrDefault(AzureCodeGenerator.HttpHeadStatusCodeSuccessFunc);
HttpStatusCode successStatusCode = method.Responses.Keys.FirstOrDefault(AzureExtensions.HttpHeadStatusCodeSuccessFunc);
if (method.Responses.Count == 2 &&
successStatusCode != default(HttpStatusCode) &&
@ -227,6 +234,8 @@ namespace Microsoft.Rest.Generator.Azure
throw new ArgumentNullException("serviceClient");
}
HashSet<CompositeType> generatedParameterGroups = new HashSet<CompositeType>();
foreach (Method method in serviceClient.Methods)
{
//This group name is normalized by each languages code generator later, so it need not happen here.
@ -239,9 +248,18 @@ namespace Microsoft.Rest.Generator.Azure
Newtonsoft.Json.Linq.JContainer extensionObject = parameter.Extensions[ParameterGroupExtension] as Newtonsoft.Json.Linq.JContainer;
if (extensionObject != null)
{
string parameterGroupName = method.Group + "-" + method.Name + "-" + "Parameters";
parameterGroupName = extensionObject.Value<string>("name") ?? parameterGroupName;
string specifiedGroupName = extensionObject.Value<string>("name");
string parameterGroupName;
if (specifiedGroupName == null)
{
string postfix = extensionObject.Value<string>("postfix") ?? "Parameters";
parameterGroupName = method.Group + "-" + method.Name + "-" + postfix;
}
else
{
parameterGroupName = specifiedGroupName;
}
if (!parameterGroups.ContainsKey(parameterGroupName))
{
parameterGroups.Add(parameterGroupName, new Dictionary<Property, Parameter>());
@ -266,22 +284,48 @@ namespace Microsoft.Rest.Generator.Azure
foreach (string parameterGroupName in parameterGroups.Keys)
{
//Define the new parameter group type (it's always a composite type)
CompositeType parameterGroupType = new CompositeType()
{
Name = parameterGroupName,
Documentation = "Additional parameters for the " + method.Name + " operation."
};
CompositeType parameterGroupType =
generatedParameterGroups.FirstOrDefault(item => item.Name == parameterGroupName);
bool createdNewCompositeType = false;
if (parameterGroupType == null)
{
parameterGroupType = new CompositeType()
{
Name = parameterGroupName,
Documentation = "Additional parameters for the " + method.Name + " operation."
};
generatedParameterGroups.Add(parameterGroupType);
//Populate the parameter group type with properties.
//Add to the service client
serviceClient.ModelTypes.Add(parameterGroupType);
createdNewCompositeType = true;
}
//Populate the parameter group type with properties.
foreach (Property property in parameterGroups[parameterGroupName].Keys)
{
parameterGroupType.Properties.Add(property);
//Either the paramter group is "empty" since it is new, or it is "full" and we don't allow different schemas
if (createdNewCompositeType)
{
parameterGroupType.Properties.Add(property);
}
else
{
Property matchingProperty = parameterGroupType.Properties.FirstOrDefault(
item => item.Name == property.Name &&
item.IsReadOnly == property.IsReadOnly &&
item.DefaultValue == property.DefaultValue &&
item.SerializedName == property.SerializedName);
if (matchingProperty == null)
{
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Property {0} was specified on group {1} but it is not on shared parameter group object {2}",
property.Name, method.Name, parameterGroupType.Name));
}
}
}
//Add to the service client
serviceClient.ModelTypes.Add(parameterGroupType);
bool isGroupParameterRequired = parameterGroupType.Properties.Any(p => p.IsRequired);
//Create the new parameter object based on the parameter group type
@ -442,7 +486,7 @@ namespace Microsoft.Rest.Generator.Azure
}
}
AzureCodeGenerator.RemoveUnreferencedTypes(serviceClient, typesToDelete);
AzureExtensions.RemoveUnreferencedTypes(serviceClient, typesToDelete);
}
/// <summary>
@ -535,6 +579,13 @@ namespace Microsoft.Rest.Generator.Azure
};
nextLinkParameter.Extensions[SkipUrlEncodingExtension] = true;
newMethod.Parameters.Add(nextLinkParameter);
// Need copy all the header parameters from List method to ListNext method
foreach (var param in method.Parameters.Where(p => p.Location == ParameterLocation.Header))
{
newMethod.Parameters.Add((Parameter)param.Clone());
}
serviceClient.Methods.Add(newMethod);
}
}

Просмотреть файл

@ -6,7 +6,7 @@ using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("AutoRest.Generator.Azure.Common")]
[assembly: AssemblyTitle("AutoRest.Generator.Azure.Extensions")]
[assembly: AssemblyDescription("Azure specific code generation extensions for AutoRest.")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft AutoRest")]

Просмотреть файл

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.

Просмотреть файл

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" />
<Import Project="..\..\..\..\packages\xunit.runner.msbuild.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.runner.msbuild.props" Condition="Exists('..\..\..\..\packages\xunit.runner.msbuild.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.runner.msbuild.props')" />
<Import Project="..\..\..\..\packages\xunit.core.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.core.props" Condition="Exists('..\..\..\..\packages\xunit.core.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.core.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\..\</SolutionDir>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<LibraryFxTarget Condition="'$(LibraryFxTarget)' == ''">net45</LibraryFxTarget>
<ProjectGuid>{25B049BF-66AC-4B7A-B6B1-3DC74DE3951C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Rest.Generator.Extensions.Tests</RootNamespace>
<AssemblyName>AutoRest.Generator.Extensions.Tests</AssemblyName>
<FileAlignment>512</FileAlignment>
<RestorePackages>true</RestorePackages>
<AutoRestTest>true</AutoRestTest>
<NuGetPackageImportStamp>ee0e6b21</NuGetPackageImportStamp>
<Configuration Condition=" '$(Configuration)' == '' ">Net45-Debug</Configuration>
</PropertyGroup>
<Import Project="$(SolutionDir)\Tools\AutoRest.Settings.targets" />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Net45-Debug|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\Net45-Debug</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<None Include="$(SolutionDir)\AutoRest\AutoRest\AutoRest.json">
<Link>AutoRest.json</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Compile Include="ExtensionsTests.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
<None Include="Swagger\swagger-payload-flatten.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\AutoRest.Core\AutoRest.Core.csproj">
<Project>{c876085f-9dc3-41f0-b7b4-17022cd84684}</Project>
<Name>AutoRest.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Azure.Extensions\AutoRest.Generator.Azure.Extensions.csproj">
<Project>{90b943ab-3879-4b64-b9ff-1a21297c0f26}</Project>
<Name>AutoRest.Generator.Azure.Common</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Modelers\Swagger\AutoRest.Modeler.Swagger.csproj">
<Project>{9517265e-5127-460c-9dde-fe017d73121c}</Project>
<Name>AutoRest.Modeler.Swagger</Name>
</ProjectReference>
<ProjectReference Include="..\Extensions\AutoRest.Generator.Extensions.csproj">
<Project>{7dd043eb-5e53-4180-b123-cc3cc5022e34}</Project>
<Name>AutoRest.Generator.Extensions</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<Reference Include="xunit.abstractions">
<HintPath>$(SolutionDir)\packages\xunit.abstractions.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\xunit.assert.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.assert.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\xunit.extensibility.core.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\xunit.core.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\xunit.core.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.core.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\xunit.runner.msbuild.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.runner.msbuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\xunit.runner.msbuild.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.runner.msbuild.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
</Project>

Просмотреть файл

@ -0,0 +1,45 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.IO;
using Microsoft.Rest.Modeler.Swagger;
using Xunit;
namespace Microsoft.Rest.Generator.Tests
{
public class ExtensionsTests
{
[Fact]
public void TestClientModelWithPayloadFlattening()
{
var setting = new Settings
{
Namespace = "Test",
Input = Path.Combine("Swagger", "swagger-payload-flatten.json"),
PayloadFlatteningThreshold = 3
};
var modeler = new SwaggerModeler(setting);
var clientModel = modeler.Build();
Extensions.NormalizeClientModel(clientModel, setting);
Assert.NotNull(clientModel);
Assert.Equal(4, clientModel.Methods[0].Parameters.Count);
Assert.Equal("String subscriptionId", clientModel.Methods[0].Parameters[0].ToString());
Assert.Equal("String resourceGroupName", clientModel.Methods[0].Parameters[1].ToString());
Assert.Equal("String apiVersion", clientModel.Methods[0].Parameters[2].ToString());
Assert.Equal("MaxProduct max_product", clientModel.Methods[0].Parameters[3].ToString());
Assert.Equal(6, clientModel.Methods[1].Parameters.Count);
Assert.Equal("String subscriptionId", clientModel.Methods[1].Parameters[0].ToString());
Assert.Equal("String resourceGroupName", clientModel.Methods[1].Parameters[1].ToString());
Assert.Equal("String apiVersion", clientModel.Methods[1].Parameters[2].ToString());
Assert.Equal("String base_product_id", clientModel.Methods[1].Parameters[3].ToString());
Assert.Equal(true, clientModel.Methods[1].Parameters[3].IsRequired);
Assert.Equal("String base_product_description", clientModel.Methods[1].Parameters[4].ToString());
Assert.Equal(false, clientModel.Methods[1].Parameters[4].IsRequired);
Assert.Equal("MaxProduct max_product_reference", clientModel.Methods[1].Parameters[5].ToString());
Assert.Equal(false, clientModel.Methods[1].Parameters[5].IsRequired);
Assert.Equal(1, clientModel.Methods[1].InputParameterTransformation.Count);
Assert.Equal(3, clientModel.Methods[1].InputParameterTransformation[0].ParameterMappings.Count);
}
}
}

Просмотреть файл

@ -0,0 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.Rest.Generator.Tests.ExtensionsTests.#TestClientModelWithPayloadFlattening()")]

Просмотреть файл

@ -5,8 +5,8 @@ using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("AutoRest.Generator.Azure.Common.Tests")]
[assembly: AssemblyDescription("Tests for Azure Common Code Generators")]
[assembly: AssemblyTitle("AutoRest.Generator.Extensions.Tests")]
[assembly: AssemblyDescription("Tests for Code Generator Extensions")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft AutoRest")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]

Просмотреть файл

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit" version="2.1.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net451" />
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensions" version="2.0.0" targetFramework="net451" />
<package id="xunit.runner.msbuild" version="2.1.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -5,11 +5,11 @@
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\..\</SolutionDir>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<LibraryFxTarget Condition="'$(LibraryFxTarget)' == ''">net45</LibraryFxTarget>
<ProjectGuid>{90B943AB-3879-4B64-B9FF-1A21297C0F26}</ProjectGuid>
<ProjectGuid>{7DD043EB-5E53-4180-B123-CC3CC5022E34}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Rest.Generator.Azure</RootNamespace>
<AssemblyName>AutoRest.Generator.Azure.Common</AssemblyName>
<RootNamespace>Microsoft.Rest.Generator</RootNamespace>
<AssemblyName>AutoRest.Generator.Extensions</AssemblyName>
<FileAlignment>512</FileAlignment>
<RestorePackages>true</RestorePackages>
<Configuration Condition=" '$(Configuration)' == '' ">Net45-Debug</Configuration>
@ -24,13 +24,13 @@
<Compile Include="$(SolutionDir)\Tools\AssemblyVersionInfo.cs">
<Link>Properties\AssemblyVersionInfo.cs</Link>
</Compile>
<Compile Include="Extensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="AzureCodeGenerator.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

Просмотреть файл

@ -0,0 +1,82 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Linq;
using Microsoft.Rest.Generator.ClientModel;
using Microsoft.Rest.Generator.Utilities;
namespace Microsoft.Rest.Generator
{
/// <summary>
/// Base code generator for Azure.
/// Normalizes the ServiceClient according to Azure conventions and Swagger extensions.
/// </summary>
public abstract class Extensions
{
public const string SkipUrlEncodingExtension = "x-ms-skip-url-encoding";
/// <summary>
/// Normalizes client model using generic extensions.
/// </summary>
/// <param name="serviceClient">Service client</param>
/// <param name="settings">AutoRest settings</param>
/// <returns></returns>
public static void NormalizeClientModel(ServiceClient serviceClient, Settings settings)
{
FlattenRequestPayload(serviceClient, settings);
}
/// <summary>
/// Flattens the request payload if the number of properties of the
/// payload is less than or equal to the PayloadFlatteningThreshold.
/// </summary>
/// <param name="serviceClient">Service client</param>
/// <param name="settings">AutoRest settings</param>
public static void FlattenRequestPayload(ServiceClient serviceClient, Settings settings)
{
if (serviceClient == null)
{
throw new ArgumentNullException("serviceClient");
}
if (settings == null)
{
throw new ArgumentNullException("settings");
}
foreach (var method in serviceClient.Methods)
{
var bodyParameter = method.Parameters.FirstOrDefault(
p => p.Location == ParameterLocation.Body);
if (bodyParameter != null)
{
var bodyParameterType = bodyParameter.Type as CompositeType;
if (bodyParameterType != null && bodyParameterType.ComposedProperties.Count() <= settings.PayloadFlatteningThreshold)
{
var parameterTransformation = new ParameterTransformation
{
OutputParameter = bodyParameter
};
method.InputParameterTransformation.Add(parameterTransformation);
foreach (var property in bodyParameterType.ComposedProperties)
{
var newMethodParameter = new Parameter();
newMethodParameter.LoadFrom(property);
method.Parameters.Add(newMethodParameter);
parameterTransformation.ParameterMappings.Add(new ParameterMapping
{
InputParameter = newMethodParameter,
OutputParameterProperty = property.Name
});
}
method.Parameters.Remove(bodyParameter);
}
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("AutoRest.Generator.Azure.Extensions")]
[assembly: AssemblyDescription("Generic code generation extensions for AutoRest.")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft AutoRest")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: NeutralResourcesLanguage("en")]
[assembly: DefaultDllImportSearchPathsAttribute(DllImportSearchPath.SafeDirectories)]

Просмотреть файл

@ -0,0 +1,117 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.Rest.Generator.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Rest.Generator.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Head method &apos;{0}&apos; should contain only 200 level responses, or 404..
/// </summary>
internal static string HeadMethodInvalidResponses {
get {
return ResourceManager.GetString("HeadMethodInvalidResponses", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Azure resource {0} is missing required &apos;properties&apos; property..
/// </summary>
internal static string MissingProperties {
get {
return ResourceManager.GetString("MissingProperties", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} needs to have a value..
/// </summary>
internal static string ODataEmpty {
get {
return ResourceManager.GetString("ODataEmpty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Method with {0} needs to have &quot;$filter&quot; parameter..
/// </summary>
internal static string ODataFilterMissing {
get {
return ResourceManager.GetString("ODataFilterMissing", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} needs to have a valid definition reference..
/// </summary>
internal static string ODataInvalidReferance {
get {
return ResourceManager.GetString("ODataInvalidReferance", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Schema definition for Resource type with x-ms-azure-resource extension should have following properties: {0}.
/// </summary>
internal static string ResourcePropertyMismatch {
get {
return ResourceManager.GetString("ResourcePropertyMismatch", resourceCulture);
}
}
}
}

Просмотреть файл

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="HeadMethodInvalidResponses" xml:space="preserve">
<value>Head method '{0}' should contain only 200 level responses, or 404.</value>
</data>
<data name="MissingProperties" xml:space="preserve">
<value>Azure resource {0} is missing required 'properties' property.</value>
</data>
<data name="ODataEmpty" xml:space="preserve">
<value>{0} needs to have a value.</value>
</data>
<data name="ODataFilterMissing" xml:space="preserve">
<value>Method with {0} needs to have "$filter" parameter.</value>
</data>
<data name="ODataInvalidReferance" xml:space="preserve">
<value>{0} needs to have a valid definition reference.</value>
</data>
<data name="ResourcePropertyMismatch" xml:space="preserve">
<value>Schema definition for Resource type with x-ms-azure-resource extension should have following properties: {0}</value>
</data>
</root>

Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
</packages>

Просмотреть файл

@ -14,6 +14,10 @@ import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceException;
import com.microsoft.rest.ServiceResponse;
import com.squareup.okhttp.ResponseBody;
import fixtures.azureparametergrouping.models.FirstParameterGroup;
import fixtures.azureparametergrouping.models.ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup;
import fixtures.azureparametergrouping.models.ParameterGroupingPostOptionalParameters;
import fixtures.azureparametergrouping.models.ParameterGroupingPostRequiredParameters;
import retrofit.Call;
import retrofit.http.Body;
import retrofit.http.Header;
@ -32,81 +36,90 @@ public interface ParameterGrouping {
*/
interface ParameterGroupingService {
@POST("/parameterGrouping/postRequired/{path}")
Call<ResponseBody> postRequired(@Path("path") String path, @Body int body, @Header("customHeader") String customHeader, @Query("query") Integer query, @Header("accept-language") String acceptLanguage);
Call<ResponseBody> postRequired(@Path("path") String path, @Header("accept-language") String acceptLanguage, @Body int body, @Header("customHeader") String customHeader, @Query("query") int query);
@POST("/parameterGrouping/postOptional")
Call<ResponseBody> postOptional(@Header("customHeader") String customHeader, @Query("query") Integer query, @Header("accept-language") String acceptLanguage);
Call<ResponseBody> postOptional(@Header("accept-language") String acceptLanguage, @Header("customHeader") String customHeader, @Query("query") int query);
@POST("/parameterGrouping/postMultipleParameterGroups")
Call<ResponseBody> postMultipleParameterGroups(@Header("header-one") String headerOne, @Query("query-one") Integer queryOne, @Header("header-two") String headerTwo, @Query("query-two") Integer queryTwo, @Header("accept-language") String acceptLanguage);
Call<ResponseBody> postMultipleParameterGroups(@Header("accept-language") String acceptLanguage, @Header("header-one") String headerOne, @Query("query-one") int queryOne, @Header("header-two") String headerTwo, @Query("query-two") int queryTwo);
@POST("/parameterGrouping/sharedParameterGroupObject")
Call<ResponseBody> postSharedParameterGroupObject(@Header("accept-language") String acceptLanguage, @Header("header-one") String headerOne, @Query("query-one") int queryOne);
}
/**
* Post a bunch of required parameters grouped
*
* @param path Path parameter
* @param body the int value
* @param customHeader the String value
* @param query Query parameter with default
* @param parameterGroupingPostRequiredParameters Additional parameters for the operation
* @throws ServiceException exception thrown from REST call
* @return the ServiceResponse object if successful.
*/
ServiceResponse<Void> postRequired(String path, int body, String customHeader, Integer query) throws ServiceException;
ServiceResponse<Void> postRequired(ParameterGroupingPostRequiredParameters parameterGroupingPostRequiredParameters) throws ServiceException;
/**
* Post a bunch of required parameters grouped
*
* @param path Path parameter
* @param body the int value
* @param customHeader the String value
* @param query Query parameter with default
* @param parameterGroupingPostRequiredParameters Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link Call} object
*/
Call<ResponseBody> postRequiredAsync(String path, int body, String customHeader, Integer query, final ServiceCallback<Void> serviceCallback);
Call<ResponseBody> postRequiredAsync(ParameterGroupingPostRequiredParameters parameterGroupingPostRequiredParameters, final ServiceCallback<Void> serviceCallback);
/**
* Post a bunch of optional parameters grouped
*
* @param customHeader the String value
* @param query Query parameter with default
* @param parameterGroupingPostOptionalParameters Additional parameters for the operation
* @throws ServiceException exception thrown from REST call
* @return the ServiceResponse object if successful.
*/
ServiceResponse<Void> postOptional(String customHeader, Integer query) throws ServiceException;
ServiceResponse<Void> postOptional(ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters) throws ServiceException;
/**
* Post a bunch of optional parameters grouped
*
* @param customHeader the String value
* @param query Query parameter with default
* @param parameterGroupingPostOptionalParameters Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link Call} object
*/
Call<ResponseBody> postOptionalAsync(String customHeader, Integer query, final ServiceCallback<Void> serviceCallback);
Call<ResponseBody> postOptionalAsync(ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters, final ServiceCallback<Void> serviceCallback);
/**
* Post parameters from multiple different parameter groups
*
* @param headerOne the String value
* @param queryOne Query parameter with default
* @param headerTwo the String value
* @param queryTwo Query parameter with default
* @param firstParameterGroup Additional parameters for the operation
* @param parameterGroupingPostMultipleParameterGroupsSecondParameterGroup Additional parameters for the operation
* @throws ServiceException exception thrown from REST call
* @return the ServiceResponse object if successful.
*/
ServiceResponse<Void> postMultipleParameterGroups(String headerOne, Integer queryOne, String headerTwo, Integer queryTwo) throws ServiceException;
ServiceResponse<Void> postMultipleParameterGroups(FirstParameterGroup firstParameterGroup, ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup parameterGroupingPostMultipleParameterGroupsSecondParameterGroup) throws ServiceException;
/**
* Post parameters from multiple different parameter groups
*
* @param headerOne the String value
* @param queryOne Query parameter with default
* @param headerTwo the String value
* @param queryTwo Query parameter with default
* @param firstParameterGroup Additional parameters for the operation
* @param parameterGroupingPostMultipleParameterGroupsSecondParameterGroup Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link Call} object
*/
Call<ResponseBody> postMultipleParameterGroupsAsync(String headerOne, Integer queryOne, String headerTwo, Integer queryTwo, final ServiceCallback<Void> serviceCallback);
Call<ResponseBody> postMultipleParameterGroupsAsync(FirstParameterGroup firstParameterGroup, ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup parameterGroupingPostMultipleParameterGroupsSecondParameterGroup, final ServiceCallback<Void> serviceCallback);
/**
* Post parameters with a shared parameter group object
*
* @param firstParameterGroup Additional parameters for the operation
* @throws ServiceException exception thrown from REST call
* @return the ServiceResponse object if successful.
*/
ServiceResponse<Void> postSharedParameterGroupObject(FirstParameterGroup firstParameterGroup) throws ServiceException;
/**
* Post parameters with a shared parameter group object
*
* @param firstParameterGroup Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link Call} object
*/
Call<ResponseBody> postSharedParameterGroupObjectAsync(FirstParameterGroup firstParameterGroup, final ServiceCallback<Void> serviceCallback);
}

Просмотреть файл

@ -13,12 +13,18 @@ package fixtures.azureparametergrouping;
import com.google.common.reflect.TypeToken;
import com.microsoft.rest.AzureServiceResponseBuilder;
import com.microsoft.rest.serializer.AzureJacksonUtils;
import com.microsoft.rest.serializer.JacksonUtils;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceException;
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.ServiceResponseCallback;
import com.microsoft.rest.Validator;
import com.squareup.okhttp.ResponseBody;
import fixtures.azureparametergrouping.models.Error;
import fixtures.azureparametergrouping.models.FirstParameterGroup;
import fixtures.azureparametergrouping.models.ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup;
import fixtures.azureparametergrouping.models.ParameterGroupingPostOptionalParameters;
import fixtures.azureparametergrouping.models.ParameterGroupingPostRequiredParameters;
import retrofit.Call;
import retrofit.Response;
import retrofit.Retrofit;
@ -35,19 +41,21 @@ public class ParameterGroupingImpl implements ParameterGrouping {
/**
* Post a bunch of required parameters grouped
*
* @param path Path parameter
* @param body the int value
* @param customHeader the String value
* @param query Query parameter with default
* @param parameterGroupingPostRequiredParameters Additional parameters for the operation
* @throws ServiceException the exception wrapped in ServiceException if failed.
*/
public ServiceResponse<Void> postRequired(String path, int body, String customHeader, Integer query) throws ServiceException {
if (path == null) {
public ServiceResponse<Void> postRequired(ParameterGroupingPostRequiredParameters parameterGroupingPostRequiredParameters) throws ServiceException {
if (parameterGroupingPostRequiredParameters == null) {
throw new ServiceException(
new IllegalArgumentException("Parameter path is required and cannot be null."));
new IllegalArgumentException("Parameter parameterGroupingPostRequiredParameters is required and cannot be null."));
}
Validator.validate(parameterGroupingPostRequiredParameters);
int body = parameterGroupingPostRequiredParameters.getBody();
String customHeader = parameterGroupingPostRequiredParameters.getCustomHeader();
int query = parameterGroupingPostRequiredParameters.getQuery();
String path = parameterGroupingPostRequiredParameters.getPath();
try {
Call<ResponseBody> call = service.postRequired(path, body, customHeader, query, this.client.getAcceptLanguage());
Call<ResponseBody> call = service.postRequired(path, this.client.getAcceptLanguage(), body, customHeader, query);
return postRequiredDelegate(call.execute(), null);
} catch (ServiceException ex) {
throw ex;
@ -59,18 +67,21 @@ public class ParameterGroupingImpl implements ParameterGrouping {
/**
* Post a bunch of required parameters grouped
*
* @param path Path parameter
* @param body the int value
* @param customHeader the String value
* @param query Query parameter with default
* @param parameterGroupingPostRequiredParameters Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
*/
public Call<ResponseBody> postRequiredAsync(String path, int body, String customHeader, Integer query, final ServiceCallback<Void> serviceCallback) {
if (path == null) {
public Call<ResponseBody> postRequiredAsync(ParameterGroupingPostRequiredParameters parameterGroupingPostRequiredParameters, final ServiceCallback<Void> serviceCallback) {
if (parameterGroupingPostRequiredParameters == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter path is required and cannot be null.")));
new IllegalArgumentException("Parameter parameterGroupingPostRequiredParameters is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.postRequired(path, body, customHeader, query, this.client.getAcceptLanguage());
Validator.validate(parameterGroupingPostRequiredParameters, serviceCallback);
int body = parameterGroupingPostRequiredParameters.getBody();
String customHeader = parameterGroupingPostRequiredParameters.getCustomHeader();
int query = parameterGroupingPostRequiredParameters.getQuery();
String path = parameterGroupingPostRequiredParameters.getPath();
Call<ResponseBody> call = service.postRequired(path, this.client.getAcceptLanguage(), body, customHeader, query);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@Override
public void onResponse(Response<ResponseBody> response, Retrofit retrofit) {
@ -94,13 +105,14 @@ public class ParameterGroupingImpl implements ParameterGrouping {
/**
* Post a bunch of optional parameters grouped
*
* @param customHeader the String value
* @param query Query parameter with default
* @param parameterGroupingPostOptionalParameters Additional parameters for the operation
* @throws ServiceException the exception wrapped in ServiceException if failed.
*/
public ServiceResponse<Void> postOptional(String customHeader, Integer query) throws ServiceException {
public ServiceResponse<Void> postOptional(ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters) throws ServiceException {
String customHeader = parameterGroupingPostOptionalParameters.getCustomHeader();
int query = parameterGroupingPostOptionalParameters.getQuery();
try {
Call<ResponseBody> call = service.postOptional(customHeader, query, this.client.getAcceptLanguage());
Call<ResponseBody> call = service.postOptional(this.client.getAcceptLanguage(), customHeader, query);
return postOptionalDelegate(call.execute(), null);
} catch (ServiceException ex) {
throw ex;
@ -112,12 +124,13 @@ public class ParameterGroupingImpl implements ParameterGrouping {
/**
* Post a bunch of optional parameters grouped
*
* @param customHeader the String value
* @param query Query parameter with default
* @param parameterGroupingPostOptionalParameters Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
*/
public Call<ResponseBody> postOptionalAsync(String customHeader, Integer query, final ServiceCallback<Void> serviceCallback) {
Call<ResponseBody> call = service.postOptional(customHeader, query, this.client.getAcceptLanguage());
public Call<ResponseBody> postOptionalAsync(ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters, final ServiceCallback<Void> serviceCallback) {
String customHeader = parameterGroupingPostOptionalParameters.getCustomHeader();
int query = parameterGroupingPostOptionalParameters.getQuery();
Call<ResponseBody> call = service.postOptional(this.client.getAcceptLanguage(), customHeader, query);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@Override
public void onResponse(Response<ResponseBody> response, Retrofit retrofit) {
@ -141,15 +154,17 @@ public class ParameterGroupingImpl implements ParameterGrouping {
/**
* Post parameters from multiple different parameter groups
*
* @param headerOne the String value
* @param queryOne Query parameter with default
* @param headerTwo the String value
* @param queryTwo Query parameter with default
* @param firstParameterGroup Additional parameters for the operation
* @param parameterGroupingPostMultipleParameterGroupsSecondParameterGroup Additional parameters for the operation
* @throws ServiceException the exception wrapped in ServiceException if failed.
*/
public ServiceResponse<Void> postMultipleParameterGroups(String headerOne, Integer queryOne, String headerTwo, Integer queryTwo) throws ServiceException {
public ServiceResponse<Void> postMultipleParameterGroups(FirstParameterGroup firstParameterGroup, ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup parameterGroupingPostMultipleParameterGroupsSecondParameterGroup) throws ServiceException {
String headerOne = firstParameterGroup.getHeaderOne();
int queryOne = firstParameterGroup.getQueryOne();
String headerTwo = parameterGroupingPostMultipleParameterGroupsSecondParameterGroup.getHeaderTwo();
int queryTwo = parameterGroupingPostMultipleParameterGroupsSecondParameterGroup.getQueryTwo();
try {
Call<ResponseBody> call = service.postMultipleParameterGroups(headerOne, queryOne, headerTwo, queryTwo, this.client.getAcceptLanguage());
Call<ResponseBody> call = service.postMultipleParameterGroups(this.client.getAcceptLanguage(), headerOne, queryOne, headerTwo, queryTwo);
return postMultipleParameterGroupsDelegate(call.execute(), null);
} catch (ServiceException ex) {
throw ex;
@ -161,14 +176,16 @@ public class ParameterGroupingImpl implements ParameterGrouping {
/**
* Post parameters from multiple different parameter groups
*
* @param headerOne the String value
* @param queryOne Query parameter with default
* @param headerTwo the String value
* @param queryTwo Query parameter with default
* @param firstParameterGroup Additional parameters for the operation
* @param parameterGroupingPostMultipleParameterGroupsSecondParameterGroup Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
*/
public Call<ResponseBody> postMultipleParameterGroupsAsync(String headerOne, Integer queryOne, String headerTwo, Integer queryTwo, final ServiceCallback<Void> serviceCallback) {
Call<ResponseBody> call = service.postMultipleParameterGroups(headerOne, queryOne, headerTwo, queryTwo, this.client.getAcceptLanguage());
public Call<ResponseBody> postMultipleParameterGroupsAsync(FirstParameterGroup firstParameterGroup, ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup parameterGroupingPostMultipleParameterGroupsSecondParameterGroup, final ServiceCallback<Void> serviceCallback) {
String headerOne = firstParameterGroup.getHeaderOne();
int queryOne = firstParameterGroup.getQueryOne();
String headerTwo = parameterGroupingPostMultipleParameterGroupsSecondParameterGroup.getHeaderTwo();
int queryTwo = parameterGroupingPostMultipleParameterGroupsSecondParameterGroup.getQueryTwo();
Call<ResponseBody> call = service.postMultipleParameterGroups(this.client.getAcceptLanguage(), headerOne, queryOne, headerTwo, queryTwo);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@Override
public void onResponse(Response<ResponseBody> response, Retrofit retrofit) {
@ -189,4 +206,53 @@ public class ParameterGroupingImpl implements ParameterGrouping {
.build(response, retrofit);
}
/**
* Post parameters with a shared parameter group object
*
* @param firstParameterGroup Additional parameters for the operation
* @throws ServiceException the exception wrapped in ServiceException if failed.
*/
public ServiceResponse<Void> postSharedParameterGroupObject(FirstParameterGroup firstParameterGroup) throws ServiceException {
String headerOne = firstParameterGroup.getHeaderOne();
int queryOne = firstParameterGroup.getQueryOne();
try {
Call<ResponseBody> call = service.postSharedParameterGroupObject(this.client.getAcceptLanguage(), headerOne, queryOne);
return postSharedParameterGroupObjectDelegate(call.execute(), null);
} catch (ServiceException ex) {
throw ex;
} catch (Exception ex) {
throw new ServiceException(ex);
}
}
/**
* Post parameters with a shared parameter group object
*
* @param firstParameterGroup Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
*/
public Call<ResponseBody> postSharedParameterGroupObjectAsync(FirstParameterGroup firstParameterGroup, final ServiceCallback<Void> serviceCallback) {
String headerOne = firstParameterGroup.getHeaderOne();
int queryOne = firstParameterGroup.getQueryOne();
Call<ResponseBody> call = service.postSharedParameterGroupObject(this.client.getAcceptLanguage(), headerOne, queryOne);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@Override
public void onResponse(Response<ResponseBody> response, Retrofit retrofit) {
try {
serviceCallback.success(postSharedParameterGroupObjectDelegate(response, retrofit));
} catch (ServiceException exception) {
serviceCallback.failure(exception);
}
}
});
return call;
}
private ServiceResponse<Void> postSharedParameterGroupObjectDelegate(Response<ResponseBody> response, Retrofit retrofit) throws ServiceException {
return new AzureServiceResponseBuilder<Void>(new AzureJacksonUtils())
.register(200, new TypeToken<Void>(){}.getType())
.registerError(new TypeToken<Error>(){}.getType())
.build(response, retrofit);
}
}

Просмотреть файл

@ -0,0 +1,68 @@
/**
* 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 0.13.0.0
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
package fixtures.azureparametergrouping.models;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.rest.BaseResource;
/**
* Additional parameters for the postMultipleParameterGroups operation.
*/
public class FirstParameterGroup {
/**
* The headerOne property.
*/
@JsonProperty(value = "")
private String headerOne;
/**
* Query parameter with default
*/
@JsonProperty(value = "")
private Integer queryOne;
/**
* Get the headerOne value.
*
* @return the headerOne value
*/
public String getHeaderOne() {
return this.headerOne;
}
/**
* Set the headerOne value.
*
* @param headerOne the headerOne value to set
*/
public void setHeaderOne(String headerOne) {
this.headerOne = headerOne;
}
/**
* Get the queryOne value.
*
* @return the queryOne value
*/
public Integer getQueryOne() {
return this.queryOne;
}
/**
* Set the queryOne value.
*
* @param queryOne the queryOne value to set
*/
public void setQueryOne(Integer queryOne) {
this.queryOne = queryOne;
}
}

Просмотреть файл

@ -0,0 +1,68 @@
/**
* 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 0.13.0.0
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
package fixtures.azureparametergrouping.models;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.rest.BaseResource;
/**
* Additional parameters for the postMultipleParameterGroups operation.
*/
public class ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup {
/**
* The headerTwo property.
*/
@JsonProperty(value = "")
private String headerTwo;
/**
* Query parameter with default
*/
@JsonProperty(value = "")
private Integer queryTwo;
/**
* Get the headerTwo value.
*
* @return the headerTwo value
*/
public String getHeaderTwo() {
return this.headerTwo;
}
/**
* Set the headerTwo value.
*
* @param headerTwo the headerTwo value to set
*/
public void setHeaderTwo(String headerTwo) {
this.headerTwo = headerTwo;
}
/**
* Get the queryTwo value.
*
* @return the queryTwo value
*/
public Integer getQueryTwo() {
return this.queryTwo;
}
/**
* Set the queryTwo value.
*
* @param queryTwo the queryTwo value to set
*/
public void setQueryTwo(Integer queryTwo) {
this.queryTwo = queryTwo;
}
}

Просмотреть файл

@ -0,0 +1,68 @@
/**
* 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 0.13.0.0
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
package fixtures.azureparametergrouping.models;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.rest.BaseResource;
/**
* Additional parameters for the postOptional operation.
*/
public class ParameterGroupingPostOptionalParameters {
/**
* The customHeader property.
*/
@JsonProperty(value = "")
private String customHeader;
/**
* Query parameter with default
*/
@JsonProperty(value = "")
private Integer query;
/**
* Get the customHeader value.
*
* @return the customHeader value
*/
public String getCustomHeader() {
return this.customHeader;
}
/**
* Set the customHeader value.
*
* @param customHeader the customHeader value to set
*/
public void setCustomHeader(String customHeader) {
this.customHeader = customHeader;
}
/**
* Get the query value.
*
* @return the query value
*/
public Integer getQuery() {
return this.query;
}
/**
* Set the query value.
*
* @param query the query value to set
*/
public void setQuery(Integer query) {
this.query = query;
}
}

Просмотреть файл

@ -0,0 +1,116 @@
/**
* 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 0.13.0.0
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
package fixtures.azureparametergrouping.models;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.rest.BaseResource;
/**
* Additional parameters for the postRequired operation.
*/
public class ParameterGroupingPostRequiredParameters {
/**
* The body property.
*/
@JsonProperty(value = "", required = true)
private int body;
/**
* The customHeader property.
*/
@JsonProperty(value = "")
private String customHeader;
/**
* Query parameter with default
*/
@JsonProperty(value = "")
private Integer query;
/**
* Path parameter
*/
@JsonProperty(value = "", required = true)
private String path;
/**
* Get the body value.
*
* @return the body value
*/
public int getBody() {
return this.body;
}
/**
* Set the body value.
*
* @param body the body value to set
*/
public void setBody(int body) {
this.body = body;
}
/**
* Get the customHeader value.
*
* @return the customHeader value
*/
public String getCustomHeader() {
return this.customHeader;
}
/**
* Set the customHeader value.
*
* @param customHeader the customHeader value to set
*/
public void setCustomHeader(String customHeader) {
this.customHeader = customHeader;
}
/**
* Get the query value.
*
* @return the query value
*/
public Integer getQuery() {
return this.query;
}
/**
* Set the query value.
*
* @param query the query value to set
*/
public void setQuery(Integer query) {
this.query = query;
}
/**
* Get the path value.
*
* @return the path value
*/
public String getPath() {
return this.path;
}
/**
* Set the path value.
*
* @param path the path value to set
*/
public void setPath(String path) {
this.path = path;
}
}

Просмотреть файл

@ -61,6 +61,7 @@ public class ApiVersionDefaultImpl implements ApiVersionDefault {
if (this.client.getApiVersion() == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getMethodGlobalValid(this.client.getApiVersion(), this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -112,6 +113,7 @@ public class ApiVersionDefaultImpl implements ApiVersionDefault {
if (this.client.getApiVersion() == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getMethodGlobalNotProvidedValid(this.client.getApiVersion(), this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -163,6 +165,7 @@ public class ApiVersionDefaultImpl implements ApiVersionDefault {
if (this.client.getApiVersion() == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getPathGlobalValid(this.client.getApiVersion(), this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -214,6 +217,7 @@ public class ApiVersionDefaultImpl implements ApiVersionDefault {
if (this.client.getApiVersion() == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getSwaggerGlobalValid(this.client.getApiVersion(), this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {

Просмотреть файл

@ -63,6 +63,7 @@ public class ApiVersionLocalImpl implements ApiVersionLocal {
if (apiVersion == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getMethodLocalValid(apiVersion, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -161,6 +162,7 @@ public class ApiVersionLocalImpl implements ApiVersionLocal {
if (apiVersion == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getPathLocalValid(apiVersion, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -214,6 +216,7 @@ public class ApiVersionLocalImpl implements ApiVersionLocal {
if (apiVersion == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getSwaggerLocalValid(apiVersion, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {

Просмотреть файл

@ -63,6 +63,7 @@ public class HeaderOperationsImpl implements HeaderOperations {
if (fooClientRequestId == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter fooClientRequestId is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.customNamedRequestId(fooClientRequestId, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {

Просмотреть файл

@ -63,6 +63,7 @@ public class SkipUrlEncodingImpl implements SkipUrlEncoding {
if (unencodedPathParam == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter unencodedPathParam is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getMethodPathValid(unencodedPathParam, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -116,6 +117,7 @@ public class SkipUrlEncodingImpl implements SkipUrlEncoding {
if (unencodedPathParam == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter unencodedPathParam is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getPathPathValid(unencodedPathParam, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -169,6 +171,7 @@ public class SkipUrlEncodingImpl implements SkipUrlEncoding {
if (unencodedPathParam == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter unencodedPathParam is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getSwaggerPathValid(unencodedPathParam, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -222,6 +225,7 @@ public class SkipUrlEncodingImpl implements SkipUrlEncoding {
if (q1 == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter q1 is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getMethodQueryValid(q1, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -320,6 +324,7 @@ public class SkipUrlEncodingImpl implements SkipUrlEncoding {
if (q1 == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter q1 is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getPathQueryValid(q1, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {

Просмотреть файл

@ -61,6 +61,7 @@ public class SubscriptionInCredentialsImpl implements SubscriptionInCredentials
if (this.client.getSubscriptionId() == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.postMethodGlobalValid(this.client.getSubscriptionId(), this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -112,6 +113,7 @@ public class SubscriptionInCredentialsImpl implements SubscriptionInCredentials
if (this.client.getSubscriptionId() == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.postMethodGlobalNull(this.client.getSubscriptionId(), this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -167,10 +169,12 @@ public class SubscriptionInCredentialsImpl implements SubscriptionInCredentials
if (this.client.getSubscriptionId() == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")));
return null;
}
if (this.client.getApiVersion() == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.postMethodGlobalNotProvidedValid(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -222,6 +226,7 @@ public class SubscriptionInCredentialsImpl implements SubscriptionInCredentials
if (this.client.getSubscriptionId() == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.postPathGlobalValid(this.client.getSubscriptionId(), this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -273,6 +278,7 @@ public class SubscriptionInCredentialsImpl implements SubscriptionInCredentials
if (this.client.getSubscriptionId() == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.postSwaggerGlobalValid(this.client.getSubscriptionId(), this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {

Просмотреть файл

@ -63,6 +63,7 @@ public class SubscriptionInMethodImpl implements SubscriptionInMethod {
if (subscriptionId == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.postMethodLocalValid(subscriptionId, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -116,6 +117,7 @@ public class SubscriptionInMethodImpl implements SubscriptionInMethod {
if (subscriptionId == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.postMethodLocalNull(subscriptionId, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -169,6 +171,7 @@ public class SubscriptionInMethodImpl implements SubscriptionInMethod {
if (subscriptionId == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.postPathLocalValid(subscriptionId, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -222,6 +225,7 @@ public class SubscriptionInMethodImpl implements SubscriptionInMethod {
if (subscriptionId == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.postSwaggerLocalValid(subscriptionId, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {

Просмотреть файл

@ -106,6 +106,7 @@ public class XMsClientRequestIdImpl implements XMsClientRequestId {
if (xMsClientRequestId == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter xMsClientRequestId is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.paramGet(xMsClientRequestId, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {

Просмотреть файл

@ -35,7 +35,7 @@ public interface Paging {
Call<ResponseBody> getSinglePages(@Header("accept-language") String acceptLanguage);
@GET("/paging/multiple")
Call<ResponseBody> getMultiplePages(@Header("accept-language") String acceptLanguage);
Call<ResponseBody> getMultiplePages(@Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage);
@GET("/paging/multiple/retryfirst")
Call<ResponseBody> getMultiplePagesRetryFirst(@Header("accept-language") String acceptLanguage);
@ -56,7 +56,7 @@ public interface Paging {
Call<ResponseBody> getSinglePagesNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage);
@GET
Call<ResponseBody> getMultiplePagesNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage);
Call<ResponseBody> getMultiplePagesNext(@Url String nextPageLink, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage);
@GET
Call<ResponseBody> getMultiplePagesRetryFirstNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage);
@ -93,18 +93,20 @@ public interface Paging {
/**
* A paging operation that includes a nextLink that has 10 pages
*
* @param clientRequestId the String value
* @throws ServiceException exception thrown from REST call
* @return the PageImpl&lt;Product&gt; object wrapped in ServiceResponse if successful.
*/
ServiceResponse<PageImpl<Product>> getMultiplePages() throws ServiceException;
ServiceResponse<PageImpl<Product>> getMultiplePages(String clientRequestId) throws ServiceException;
/**
* A paging operation that includes a nextLink that has 10 pages
*
* @param clientRequestId the String value
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link Call} object
*/
Call<ResponseBody> getMultiplePagesAsync(final ServiceCallback<PageImpl<Product>> serviceCallback);
Call<ResponseBody> getMultiplePagesAsync(String clientRequestId, final ServiceCallback<PageImpl<Product>> serviceCallback);
/**
* A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages
@ -208,19 +210,21 @@ public interface Paging {
* A paging operation that includes a nextLink that has 10 pages
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param clientRequestId the String value
* @throws ServiceException exception thrown from REST call
* @return the PageImpl&lt;Product&gt; object wrapped in ServiceResponse if successful.
*/
ServiceResponse<PageImpl<Product>> getMultiplePagesNext(String nextPageLink) throws ServiceException;
ServiceResponse<PageImpl<Product>> getMultiplePagesNext(String nextPageLink, String clientRequestId) throws ServiceException;
/**
* A paging operation that includes a nextLink that has 10 pages
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param clientRequestId the String value
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link Call} object
*/
Call<ResponseBody> getMultiplePagesNextAsync(String nextPageLink, final ServiceCallback<PageImpl<Product>> serviceCallback);
Call<ResponseBody> getMultiplePagesNextAsync(String nextPageLink, String clientRequestId, final ServiceCallback<PageImpl<Product>> serviceCallback);
/**
* A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages

Просмотреть файл

@ -81,12 +81,13 @@ public class PagingImpl implements Paging {
/**
* A paging operation that includes a nextLink that has 10 pages
*
* @param clientRequestId the String value
* @return the PageImpl&lt;Product&gt; object if successful.
* @throws ServiceException the exception wrapped in ServiceException if failed.
*/
public ServiceResponse<PageImpl<Product>> getMultiplePages() throws ServiceException {
public ServiceResponse<PageImpl<Product>> getMultiplePages(String clientRequestId) throws ServiceException {
try {
Call<ResponseBody> call = service.getMultiplePages(this.client.getAcceptLanguage());
Call<ResponseBody> call = service.getMultiplePages(clientRequestId, this.client.getAcceptLanguage());
return getMultiplePagesDelegate(call.execute(), null);
} catch (ServiceException ex) {
throw ex;
@ -98,10 +99,11 @@ public class PagingImpl implements Paging {
/**
* A paging operation that includes a nextLink that has 10 pages
*
* @param clientRequestId the String value
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
*/
public Call<ResponseBody> getMultiplePagesAsync(final ServiceCallback<PageImpl<Product>> serviceCallback) {
Call<ResponseBody> call = service.getMultiplePages(this.client.getAcceptLanguage());
public Call<ResponseBody> getMultiplePagesAsync(String clientRequestId, final ServiceCallback<PageImpl<Product>> serviceCallback) {
Call<ResponseBody> call = service.getMultiplePages(clientRequestId, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<PageImpl<Product>>(serviceCallback) {
@Override
public void onResponse(Response<ResponseBody> response, Retrofit retrofit) {
@ -374,6 +376,7 @@ public class PagingImpl implements Paging {
if (nextPageLink == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getSinglePagesNext(nextPageLink, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<PageImpl<Product>>(serviceCallback) {
@ -400,16 +403,17 @@ public class PagingImpl implements Paging {
* A paging operation that includes a nextLink that has 10 pages
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param clientRequestId the String value
* @return the PageImpl&lt;Product&gt; object if successful.
* @throws ServiceException the exception wrapped in ServiceException if failed.
*/
public ServiceResponse<PageImpl<Product>> getMultiplePagesNext(String nextPageLink) throws ServiceException {
public ServiceResponse<PageImpl<Product>> getMultiplePagesNext(String nextPageLink, String clientRequestId) throws ServiceException {
if (nextPageLink == null) {
throw new ServiceException(
new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."));
}
try {
Call<ResponseBody> call = service.getMultiplePagesNext(nextPageLink, this.client.getAcceptLanguage());
Call<ResponseBody> call = service.getMultiplePagesNext(nextPageLink, clientRequestId, this.client.getAcceptLanguage());
return getMultiplePagesNextDelegate(call.execute(), null);
} catch (ServiceException ex) {
throw ex;
@ -422,14 +426,16 @@ public class PagingImpl implements Paging {
* A paging operation that includes a nextLink that has 10 pages
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param clientRequestId the String value
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
*/
public Call<ResponseBody> getMultiplePagesNextAsync(String nextPageLink, final ServiceCallback<PageImpl<Product>> serviceCallback) {
public Call<ResponseBody> getMultiplePagesNextAsync(String nextPageLink, String clientRequestId, final ServiceCallback<PageImpl<Product>> serviceCallback) {
if (nextPageLink == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getMultiplePagesNext(nextPageLink, this.client.getAcceptLanguage());
Call<ResponseBody> call = service.getMultiplePagesNext(nextPageLink, clientRequestId, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<PageImpl<Product>>(serviceCallback) {
@Override
public void onResponse(Response<ResponseBody> response, Retrofit retrofit) {
@ -482,6 +488,7 @@ public class PagingImpl implements Paging {
if (nextPageLink == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getMultiplePagesRetryFirstNext(nextPageLink, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<PageImpl<Product>>(serviceCallback) {
@ -536,6 +543,7 @@ public class PagingImpl implements Paging {
if (nextPageLink == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getMultiplePagesRetrySecondNext(nextPageLink, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<PageImpl<Product>>(serviceCallback) {
@ -590,6 +598,7 @@ public class PagingImpl implements Paging {
if (nextPageLink == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getSinglePagesFailureNext(nextPageLink, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<PageImpl<Product>>(serviceCallback) {
@ -644,6 +653,7 @@ public class PagingImpl implements Paging {
if (nextPageLink == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getMultiplePagesFailureNext(nextPageLink, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<PageImpl<Product>>(serviceCallback) {
@ -698,6 +708,7 @@ public class PagingImpl implements Paging {
if (nextPageLink == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getMultiplePagesFailureUriNext(nextPageLink, this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<PageImpl<Product>>(serviceCallback) {

Просмотреть файл

@ -73,14 +73,17 @@ public class GroupImpl implements Group {
if (this.client.getSubscriptionId() == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")));
return null;
}
if (resourceGroupName == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")));
return null;
}
if (this.client.getApiVersion() == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.getSampleResourceGroup(this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), this.client.getAcceptLanguage());
call.enqueue(new ServiceResponseCallback<SampleResourceGroup>(serviceCallback) {

Просмотреть файл

@ -0,0 +1,59 @@
package fixtures.azureparametergrouping;
import com.microsoft.rest.ServiceResponse;
import fixtures.azureparametergrouping.models.FirstParameterGroup;
import fixtures.azureparametergrouping.models.ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup;
import fixtures.azureparametergrouping.models.ParameterGroupingPostOptionalParameters;
import fixtures.azureparametergrouping.models.ParameterGroupingPostRequiredParameters;
import fixtures.subscriptionidapiversion.models.SampleResourceGroup;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.UUID;
public class ParameterGroupingTests {
static AutoRestParameterGroupingTestService client;
@BeforeClass
public static void setup() {
client = new AutoRestParameterGroupingTestServiceImpl("http://localhost.:3000");
}
@Test
public void postRequired() throws Exception {
ParameterGroupingPostRequiredParameters params = new ParameterGroupingPostRequiredParameters();
params.setBody(1234);
params.setPath("path");
params.setQuery(21);
params.setCustomHeader("header");
ServiceResponse<Void> group = client.getParameterGrouping().postRequired(params);
}
@Test
public void postOptional() throws Exception {
ParameterGroupingPostOptionalParameters params = new ParameterGroupingPostOptionalParameters();
params.setQuery(21);
params.setCustomHeader("header");
ServiceResponse<Void> group = client.getParameterGrouping().postOptional(params);
}
@Test
public void postMultipleParameterGroups() throws Exception {
FirstParameterGroup first = new FirstParameterGroup();
first.setQueryOne(21);
first.setHeaderOne("header");
ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup second = new ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup();
second.setHeaderTwo("header2");
second.setQueryTwo(42);
ServiceResponse<Void> group = client.getParameterGrouping().postMultipleParameterGroups(first, second);
}
@Test
public void postParameterGroupWithSharedParameter() throws Exception {
FirstParameterGroup first = new FirstParameterGroup();
first.setQueryOne(21);
first.setHeaderOne("header");
ServiceResponse<Void> group = client.getParameterGrouping().postSharedParameterGroupObject(first);
}
}

Просмотреть файл

@ -25,11 +25,11 @@ public class PagingTests {
@Test
public void getMultiplePages() throws Exception {
Page<Product> response = client.getPaging().getMultiplePages().getBody();
Page<Product> response = client.getPaging().getMultiplePages("client-id").getBody();
Assert.assertNotNull(response.getNextPageLink());
int count = 1;
while (response.getNextPageLink() != null) {
response = client.getPaging().getMultiplePagesNext(response.getNextPageLink()).getBody();
response = client.getPaging().getMultiplePagesNext(response.getNextPageLink(), "client-id").getBody();
count ++;
}
Assert.assertEquals(10, count);
@ -41,7 +41,7 @@ public class PagingTests {
Assert.assertNotNull(response.getNextPageLink());
int count = 1;
while (response.getNextPageLink() != null) {
response = client.getPaging().getMultiplePagesNext(response.getNextPageLink()).getBody();
response = client.getPaging().getMultiplePagesNext(response.getNextPageLink(), "client-id").getBody();
count ++;
}
Assert.assertEquals(10, count);
@ -53,7 +53,7 @@ public class PagingTests {
Assert.assertNotNull(response.getNextPageLink());
int count = 1;
while (response.getNextPageLink() != null) {
response = client.getPaging().getMultiplePagesNext(response.getNextPageLink()).getBody();
response = client.getPaging().getMultiplePagesNext(response.getNextPageLink(), "client-id").getBody();
count ++;
}
Assert.assertEquals(10, count);
@ -74,7 +74,7 @@ public class PagingTests {
try {
Page<Product> response = client.getPaging().getMultiplePagesFailure().getBody();
Assert.assertNotNull(response.getNextPageLink());
response = client.getPaging().getMultiplePagesNext(response.getNextPageLink()).getBody();
response = client.getPaging().getMultiplePagesNext(response.getNextPageLink(), "client-id").getBody();
fail();
} catch (ServiceException ex) {
Assert.assertNotNull(ex.getResponse());

Просмотреть файл

@ -65,9 +65,13 @@
<Project>{c876085f-9dc3-41f0-b7b4-17022cd84684}</Project>
<Name>AutoRest.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\Azure.Common\Azure.Common\AutoRest.Generator.Azure.Common.csproj">
<ProjectReference Include="..\..\Extensions\Azure.Extensions\AutoRest.Generator.Azure.Extensions.csproj">
<Project>{90b943ab-3879-4b64-b9ff-1a21297c0f26}</Project>
<Name>AutoRest.Generator.Azure.Common</Name>
<Name>AutoRest.Generator.Azure.Extensions</Name>
</ProjectReference>
<ProjectReference Include="..\..\Extensions\Extensions\AutoRest.Generator.Extensions.csproj">
<Project>{7dd043eb-5e53-4180-b123-cc3cc5022e34}</Project>
<Name>AutoRest.Generator.Extensions</Name>
</ProjectReference>
<ProjectReference Include="..\Java\AutoRest.Generator.Java.csproj">
<Project>{34B82690-0083-4F4C-8ABF-2D2A09304915}</Project>

Просмотреть файл

@ -5,16 +5,16 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Rest.Generator.Azure;
using Microsoft.Rest.Generator.ClientModel;
using Microsoft.Rest.Generator.Java.Templates;
using Microsoft.Rest.Generator.Utilities;
using Microsoft.Rest.Generator.Java.Azure.Templates;
using System.Collections.Generic;
using Microsoft.Rest.Generator.Azure;
namespace Microsoft.Rest.Generator.Java.Azure
{
public class AzureJavaCodeGenerator : AzureCodeGenerator
public class AzureJavaCodeGenerator : JavaCodeGenerator
{
private readonly AzureJavaCodeNamer _namer;
@ -61,13 +61,13 @@ namespace Microsoft.Rest.Generator.Java.Azure
public override void NormalizeClientModel(ServiceClient serviceClient)
{
Settings.AddCredentials = true;
UpdateHeadMethods(serviceClient);
ParseODataExtension(serviceClient);
FlattenResourceProperties(serviceClient);
AddPageableMethod(serviceClient);
AddAzureProperties(serviceClient);
SetDefaultResponses(serviceClient);
//NormalizeAllModelsToExtendResource(serviceClient);
AzureExtensions.UpdateHeadMethods(serviceClient);
AzureExtensions.ParseODataExtension(serviceClient);
AzureExtensions.FlattenResourceProperties(serviceClient);
AzureExtensions.AddPageableMethod(serviceClient);
AzureExtensions.AddAzureProperties(serviceClient);
AzureExtensions.SetDefaultResponses(serviceClient);
AzureExtensions.AddParameterGroups(serviceClient);
_namer.NormalizeClientModel(serviceClient);
_namer.ResolveNameCollisions(serviceClient, Settings.Namespace,
Settings.Namespace + ".Models");
@ -81,7 +81,8 @@ namespace Microsoft.Rest.Generator.Java.Azure
{
foreach (var model in serviceClient.ModelTypes)
{
if (model.Extensions.ContainsKey(AzureResourceExtension) && (bool)model.Extensions[AzureResourceExtension])
if (model.Extensions.ContainsKey(AzureExtensions.AzureResourceExtension) &&
(bool)model.Extensions[AzureExtensions.AzureResourceExtension])
{
model.BaseModelType = new CompositeType { Name = "BaseResource", SerializedName = "BaseResource" };
}
@ -115,7 +116,8 @@ namespace Microsoft.Rest.Generator.Java.Azure
{
foreach (var modelType in serviceClientTemplateModel.ModelTemplateModels)
{
if (modelType.Extensions.ContainsKey(ExternalExtension) && (bool)modelType.Extensions[ExternalExtension])
if (modelType.Extensions.ContainsKey(AzureExtensions.ExternalExtension) &&
(bool)modelType.Extensions[AzureExtensions.ExternalExtension])
{
continue;
}

Просмотреть файл

@ -28,7 +28,7 @@ namespace Microsoft.Rest.Generator.Java
{
// default value
nextLinkName = null;
var ext = extensions[AzureCodeGenerator.PageableExtension] as Newtonsoft.Json.Linq.JContainer;
var ext = extensions[AzureExtensions.PageableExtension] as Newtonsoft.Json.Linq.JContainer;
if (ext == null)
{
return null;
@ -72,7 +72,7 @@ namespace Microsoft.Rest.Generator.Java
var convertedTypes = new Dictionary<IType, CompositeType>();
foreach (var method in serviceClient.Methods.Where(m => m.Extensions.ContainsKey(AzureCodeGenerator.PageableExtension)))
foreach (var method in serviceClient.Methods.Where(m => m.Extensions.ContainsKey(AzureExtensions.PageableExtension)))
{
string nextLinkString;
string pageClassName = GetPagingSetting(method.Extensions, pageClasses, out nextLinkString);
@ -100,8 +100,8 @@ namespace Microsoft.Rest.Generator.Java
{
Name = pagableTypeName
};
pagedResult.Extensions[AzureCodeGenerator.ExternalExtension] = true;
pagedResult.Extensions[AzureCodeGenerator.PageableExtension] = ipagableTypeName;
pagedResult.Extensions[AzureExtensions.ExternalExtension] = true;
pagedResult.Extensions[AzureExtensions.PageableExtension] = ipagableTypeName;
convertedTypes[method.Responses[responseStatus]] = pagedResult;
method.Responses[responseStatus] = pagedResult;
@ -114,7 +114,7 @@ namespace Microsoft.Rest.Generator.Java
}
}
AzureCodeGenerator.RemoveUnreferencedTypes(serviceClient, convertedTypes.Keys.Cast<CompositeType>().Select(t => t.Name));
AzureExtensions.RemoveUnreferencedTypes(serviceClient, convertedTypes.Keys.Cast<CompositeType>().Select(t => t.Name));
}
}
}

Просмотреть файл

@ -23,8 +23,8 @@ namespace Microsoft.Rest.Generator.Java.Azure
throw new ArgumentNullException("source");
}
this.ClientRequestIdString = AzureCodeGenerator.GetClientRequestIdString(source);
this.RequestIdString = AzureCodeGenerator.GetRequestIdString(source);
this.ClientRequestIdString = AzureExtensions.GetClientRequestIdString(source);
this.RequestIdString = AzureExtensions.GetRequestIdString(source);
}
public string ClientRequestIdString { get; private set; }
@ -54,7 +54,7 @@ namespace Microsoft.Rest.Generator.Java.Azure
/// </summary>
public bool IsLongRunningOperation
{
get { return Extensions.ContainsKey(AzureCodeGenerator.LongRunningExtension); }
get { return Extensions.ContainsKey(AzureExtensions.LongRunningExtension); }
}
public bool IsPagingNextOperation

Просмотреть файл

@ -203,6 +203,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putEmpty(arrayBody);
@ -302,6 +303,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putBooleanTfft(arrayBody);
@ -489,6 +491,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putIntegerValid(arrayBody);
@ -676,6 +679,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putLongValid(arrayBody);
@ -863,6 +867,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putFloatValid(arrayBody);
@ -1050,6 +1055,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putDoubleValid(arrayBody);
@ -1237,6 +1243,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putStringValid(arrayBody);
@ -1424,6 +1431,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putDateValid(arrayBody);
@ -1611,6 +1619,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putDateTimeValid(arrayBody);
@ -1798,6 +1807,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putDateTimeRfc1123Valid(arrayBody);
@ -1897,6 +1907,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putDurationValid(arrayBody);
@ -1996,6 +2007,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putByteValid(arrayBody);
@ -2315,6 +2327,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putComplexValid(arrayBody);
@ -2590,6 +2603,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putArrayValid(arrayBody);
@ -2865,6 +2879,7 @@ public class ArrayImpl implements Array {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putDictionaryValid(arrayBody);

Просмотреть файл

@ -195,6 +195,7 @@ public class ByteOperationsImpl implements ByteOperations {
if (byteBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter byteBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putNonAscii(byteBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {

Просмотреть файл

@ -109,6 +109,7 @@ public class ArrayImpl implements Array {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putValid(complexBody);
@ -208,6 +209,7 @@ public class ArrayImpl implements Array {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putEmpty(complexBody);

Просмотреть файл

@ -109,6 +109,7 @@ public class BasicOperationsImpl implements BasicOperations {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putValid(complexBody);

Просмотреть файл

@ -109,6 +109,7 @@ public class DictionaryImpl implements Dictionary {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putValid(complexBody);
@ -208,6 +209,7 @@ public class DictionaryImpl implements Dictionary {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putEmpty(complexBody);

Просмотреть файл

@ -109,6 +109,7 @@ public class InheritanceImpl implements Inheritance {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putValid(complexBody);

Просмотреть файл

@ -213,6 +213,7 @@ public class PolymorphicrecursiveImpl implements Polymorphicrecursive {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putValid(complexBody);

Просмотреть файл

@ -81,6 +81,14 @@ public interface Polymorphism {
'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
}
]
};
@ -114,6 +122,14 @@ public interface Polymorphism {
'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
}
]
};

Просмотреть файл

@ -102,6 +102,14 @@ public class PolymorphismImpl implements Polymorphism {
'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
}
]
};
@ -148,6 +156,14 @@ public class PolymorphismImpl implements Polymorphism {
'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
}
]
};
@ -157,6 +173,7 @@ public class PolymorphismImpl implements Polymorphism {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putValid(complexBody);
@ -262,6 +279,7 @@ public class PolymorphismImpl implements Polymorphism {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putValidMissingRequired(complexBody);

Просмотреть файл

@ -119,6 +119,7 @@ public class PrimitiveImpl implements Primitive {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putInt(complexBody);
@ -218,6 +219,7 @@ public class PrimitiveImpl implements Primitive {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putLong(complexBody);
@ -317,6 +319,7 @@ public class PrimitiveImpl implements Primitive {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putFloat(complexBody);
@ -416,6 +419,7 @@ public class PrimitiveImpl implements Primitive {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putDouble(complexBody);
@ -515,6 +519,7 @@ public class PrimitiveImpl implements Primitive {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putBool(complexBody);
@ -614,6 +619,7 @@ public class PrimitiveImpl implements Primitive {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putString(complexBody);
@ -713,6 +719,7 @@ public class PrimitiveImpl implements Primitive {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putDate(complexBody);
@ -812,6 +819,7 @@ public class PrimitiveImpl implements Primitive {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putDateTime(complexBody);
@ -911,6 +919,7 @@ public class PrimitiveImpl implements Primitive {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putDateTimeRfc1123(complexBody);
@ -1010,6 +1019,7 @@ public class PrimitiveImpl implements Primitive {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putDuration(complexBody);
@ -1109,6 +1119,7 @@ public class PrimitiveImpl implements Primitive {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
return null;
}
Validator.validate(complexBody, serviceCallback);
Call<ResponseBody> call = service.putByte(complexBody);

Просмотреть файл

@ -20,7 +20,7 @@ import com.fasterxml.jackson.annotation.JsonSubTypes;
* The Fish model.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "fishtype")
@JsonTypeName("fish")
@JsonTypeName("Fish")
@JsonSubTypes({
@JsonSubTypes.Type(name="salmon", value=Salmon.class),
@JsonSubTypes.Type(name="shark", value=Shark.class)

Просмотреть файл

@ -0,0 +1,45 @@
/**
* 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 0.13.0.0
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
package fixtures.bodycomplex.models;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* The Goblinshark model.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "fishtype")
@JsonTypeName("goblin")
public class Goblinshark extends Shark {
/**
* The jawsize property.
*/
private Integer jawsize;
/**
* Get the jawsize value.
*
* @return the jawsize value
*/
public Integer getJawsize() {
return this.jawsize;
}
/**
* Set the jawsize value.
*
* @param jawsize the jawsize value to set
*/
public void setJawsize(Integer jawsize) {
this.jawsize = jawsize;
}
}

Просмотреть файл

@ -22,7 +22,8 @@ import com.fasterxml.jackson.annotation.JsonSubTypes;
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "fishtype")
@JsonTypeName("shark")
@JsonSubTypes({
@JsonSubTypes.Type(name="sawshark", value=Sawshark.class)
@JsonSubTypes.Type(name="sawshark", value=Sawshark.class),
@JsonSubTypes.Type(name="goblin", value=Goblinshark.class)
})
public class Shark extends Fish {
/**

Просмотреть файл

@ -239,6 +239,7 @@ public class DateOperationsImpl implements DateOperations {
if (dateBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter dateBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putMaxDate(dateBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -336,6 +337,7 @@ public class DateOperationsImpl implements DateOperations {
if (dateBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter dateBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putMinDate(dateBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {

Просмотреть файл

@ -239,6 +239,7 @@ public class DatetimeOperationsImpl implements DatetimeOperations {
if (datetimeBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter datetimeBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putUtcMaxDateTime(datetimeBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -380,6 +381,7 @@ public class DatetimeOperationsImpl implements DatetimeOperations {
if (datetimeBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter datetimeBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putLocalPositiveOffsetMaxDateTime(datetimeBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -521,6 +523,7 @@ public class DatetimeOperationsImpl implements DatetimeOperations {
if (datetimeBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter datetimeBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putLocalNegativeOffsetMaxDateTime(datetimeBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -662,6 +665,7 @@ public class DatetimeOperationsImpl implements DatetimeOperations {
if (datetimeBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter datetimeBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putUtcMinDateTime(datetimeBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -759,6 +763,7 @@ public class DatetimeOperationsImpl implements DatetimeOperations {
if (datetimeBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter datetimeBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putLocalPositiveOffsetMinDateTime(datetimeBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -856,6 +861,7 @@ public class DatetimeOperationsImpl implements DatetimeOperations {
if (datetimeBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter datetimeBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putLocalNegativeOffsetMinDateTime(datetimeBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {

Просмотреть файл

@ -239,6 +239,7 @@ public class Datetimerfc1123Impl implements Datetimerfc1123 {
if (datetimeBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter datetimeBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putUtcMaxDateTime(datetimeBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -380,6 +381,7 @@ public class Datetimerfc1123Impl implements Datetimerfc1123 {
if (datetimeBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter datetimeBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putUtcMinDateTime(datetimeBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {

Просмотреть файл

@ -159,6 +159,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putEmpty(arrayBody);
@ -434,6 +435,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putBooleanTfft(arrayBody);
@ -621,6 +623,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putIntegerValid(arrayBody);
@ -808,6 +811,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putLongValid(arrayBody);
@ -995,6 +999,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putFloatValid(arrayBody);
@ -1182,6 +1187,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putDoubleValid(arrayBody);
@ -1369,6 +1375,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putStringValid(arrayBody);
@ -1556,6 +1563,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putDateValid(arrayBody);
@ -1743,6 +1751,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putDateTimeValid(arrayBody);
@ -1930,6 +1939,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putDateTimeRfc1123Valid(arrayBody);
@ -2029,6 +2039,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putDurationValid(arrayBody);
@ -2128,6 +2139,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putByteValid(arrayBody);
@ -2447,6 +2459,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putComplexValid(arrayBody);
@ -2722,6 +2735,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putArrayValid(arrayBody);
@ -2997,6 +3011,7 @@ public class DictionaryImpl implements Dictionary {
if (arrayBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")));
return null;
}
Validator.validate(arrayBody, serviceCallback);
Call<ResponseBody> call = service.putDictionaryValid(arrayBody);

Просмотреть файл

@ -107,6 +107,7 @@ public class DurationImpl implements Duration {
if (durationBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter durationBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putPositiveDuration(durationBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {

Просмотреть файл

@ -595,6 +595,7 @@ public class NumberImpl implements Number {
if (numberBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter numberBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putBigDecimal(numberBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -692,6 +693,7 @@ public class NumberImpl implements Number {
if (numberBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter numberBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putBigDecimalPositiveDecimal(numberBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -789,6 +791,7 @@ public class NumberImpl implements Number {
if (numberBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter numberBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putBigDecimalNegativeDecimal(numberBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@ -1064,6 +1067,7 @@ public class NumberImpl implements Number {
if (numberBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter numberBody is required and cannot be null.")));
return null;
}
Call<ResponseBody> call = service.putSmallDecimal(numberBody);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше