Skip to content

Commit

Permalink
Update Autorest C# (#12054)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym authored May 13, 2020
1 parent ae50c8f commit 9eb1765
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 35 deletions.
2 changes: 1 addition & 1 deletion eng/CodeGeneration.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<_AutoRestVersion>https://github.com/Azure/autorest/releases/download/autorest-3.0.6222/autorest-3.0.6222.tgz</_AutoRestVersion>
<_AutoRestCoreVersion>3.0.6282</_AutoRestCoreVersion>
<_AutoRestCSharpVersion>https://github.com/Azure/autorest.csharp/releases/download/3.0.0-dev.20200506.1/autorest-csharp-v3-3.0.0-dev.20200506.1.tgz</_AutoRestCSharpVersion>
<_AutoRestCSharpVersion>https://github.com/Azure/autorest.csharp/releases/download/3.0.0-dev.20200513.3/autorest-csharp-v3-3.0.0-dev.20200513.3.tgz</_AutoRestCSharpVersion>
<_SupportsCodeGeneration Condition="'$(IsClientLibrary)' == 'true'">true</_SupportsCodeGeneration>
<_DefaultInputName Condition="Exists('$(MSBuildProjectDirectory)/autorest.md')">$(MSBuildProjectDirectory)/autorest.md</_DefaultInputName>
<AutoRestInput Condition="'$(AutoRestInput)' == ''">$(_DefaultInputName)</AutoRestInput>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
namespace Azure.Core
{
[AttributeUsage(AttributeTargets.Class)]
internal class CodeGenClientAttribute : Attribute
internal class CodeGenClientAttribute : CodeGenTypeAttribute
{
public string OriginalName { get; }

public CodeGenClientAttribute(string originalName)
public CodeGenClientAttribute(string originalName) : base(originalName)
{
OriginalName = originalName;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
namespace Azure.Core
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
internal class CodeGenMemberAttribute : Attribute
internal class CodeGenMemberAttribute : CodeGenTypeAttribute
{
public string? OriginalName { get; }

/// <summary>
/// For collection properties. When set to true empty collection would be treated as undefined and not serialized.
/// </summary>
Expand All @@ -23,13 +21,12 @@ internal class CodeGenMemberAttribute : Attribute
/// </summary>
public bool Initialize { get; set; }

public CodeGenMemberAttribute()
public CodeGenMemberAttribute() : base(null)
{
}

public CodeGenMemberAttribute(string originalName)
public CodeGenMemberAttribute(string originalName) : base(originalName)
{
OriginalName = originalName;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
namespace Azure.Core
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct)]
internal class CodeGenModelAttribute : Attribute
internal class CodeGenModelAttribute : CodeGenTypeAttribute
{
public string OriginalName { get; }

public CodeGenModelAttribute(string originalName)
public CodeGenModelAttribute(string originalName): base(originalName)
{
OriginalName = originalName;
}
}
}
20 changes: 20 additions & 0 deletions sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenTypeAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#nullable enable

using System;

namespace Azure.Core
{
[AttributeUsage(AttributeTargets.Class)]
internal class CodeGenTypeAttribute : Attribute
{
public string? OriginalName { get; }

public CodeGenTypeAttribute(string? originalName)
{
OriginalName = originalName;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ namespace Azure.Core
{
internal static class ManagementPipelineBuilder
{
public static HttpPipeline Build(TokenCredential credential, ClientOptions options)
public static HttpPipeline Build(TokenCredential credential, string host, ClientOptions options)
{
return HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, "https://management.azure.com//.default"));
return HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, $"{host}/.default"));
}
}
}
2 changes: 1 addition & 1 deletion sdk/core/Azure.Core/src/Shared/AutoRest/TypeFormatters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private static int GetNumBase64PaddingCharsToAddForDecode(int inputLength)
}

public static DateTimeOffset ParseDateTimeOffset(string value) =>
DateTimeOffset.Parse(value, CultureInfo.InvariantCulture);
DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);

public static TimeSpan ParseTimeSpan(string value, string format) => format switch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ public EntityRecognitionSkill(System.Collections.Generic.IEnumerable<Azure.Searc
public static Azure.Search.Documents.Models.EntityRecognitionSkillLanguage Nl { get { throw null; } }
public static Azure.Search.Documents.Models.EntityRecognitionSkillLanguage No { get { throw null; } }
public static Azure.Search.Documents.Models.EntityRecognitionSkillLanguage Pl { get { throw null; } }
public static Azure.Search.Documents.Models.EntityRecognitionSkillLanguage Pt { get { throw null; } }
public static Azure.Search.Documents.Models.EntityRecognitionSkillLanguage PtBR { get { throw null; } }
public static Azure.Search.Documents.Models.EntityRecognitionSkillLanguage PtPT { get { throw null; } }
public static Azure.Search.Documents.Models.EntityRecognitionSkillLanguage Ru { get { throw null; } }
public static Azure.Search.Documents.Models.EntityRecognitionSkillLanguage Sv { get { throw null; } }
public static Azure.Search.Documents.Models.EntityRecognitionSkillLanguage Tr { get { throw null; } }
Expand Down Expand Up @@ -639,8 +639,8 @@ public KeyPhraseExtractionSkill(System.Collections.Generic.IEnumerable<Azure.Sea
public static Azure.Search.Documents.Models.KeyPhraseExtractionSkillLanguage Nl { get { throw null; } }
public static Azure.Search.Documents.Models.KeyPhraseExtractionSkillLanguage No { get { throw null; } }
public static Azure.Search.Documents.Models.KeyPhraseExtractionSkillLanguage Pl { get { throw null; } }
public static Azure.Search.Documents.Models.KeyPhraseExtractionSkillLanguage Pt { get { throw null; } }
public static Azure.Search.Documents.Models.KeyPhraseExtractionSkillLanguage PtBR { get { throw null; } }
public static Azure.Search.Documents.Models.KeyPhraseExtractionSkillLanguage PtPT { get { throw null; } }
public static Azure.Search.Documents.Models.KeyPhraseExtractionSkillLanguage Ru { get { throw null; } }
public static Azure.Search.Documents.Models.KeyPhraseExtractionSkillLanguage Sv { get { throw null; } }
public bool Equals(Azure.Search.Documents.Models.KeyPhraseExtractionSkillLanguage other) { throw null; }
Expand Down Expand Up @@ -753,8 +753,8 @@ internal LexicalAnalyzer() { }
public static Azure.Search.Documents.Models.LexicalAnalyzerName PlMicrosoft { get { throw null; } }
public static Azure.Search.Documents.Models.LexicalAnalyzerName PtBrLucene { get { throw null; } }
public static Azure.Search.Documents.Models.LexicalAnalyzerName PtBrMicrosoft { get { throw null; } }
public static Azure.Search.Documents.Models.LexicalAnalyzerName PtLucene { get { throw null; } }
public static Azure.Search.Documents.Models.LexicalAnalyzerName PtMicrosoft { get { throw null; } }
public static Azure.Search.Documents.Models.LexicalAnalyzerName PtPtLucene { get { throw null; } }
public static Azure.Search.Documents.Models.LexicalAnalyzerName PtPtMicrosoft { get { throw null; } }
public static Azure.Search.Documents.Models.LexicalAnalyzerName RoLucene { get { throw null; } }
public static Azure.Search.Documents.Models.LexicalAnalyzerName RoMicrosoft { get { throw null; } }
public static Azure.Search.Documents.Models.LexicalAnalyzerName RuLucene { get { throw null; } }
Expand Down Expand Up @@ -1487,7 +1487,7 @@ public SentimentSkill(System.Collections.Generic.IEnumerable<Azure.Search.Docume
public static Azure.Search.Documents.Models.SentimentSkillLanguage Nl { get { throw null; } }
public static Azure.Search.Documents.Models.SentimentSkillLanguage No { get { throw null; } }
public static Azure.Search.Documents.Models.SentimentSkillLanguage Pl { get { throw null; } }
public static Azure.Search.Documents.Models.SentimentSkillLanguage Pt { get { throw null; } }
public static Azure.Search.Documents.Models.SentimentSkillLanguage PtPT { get { throw null; } }
public static Azure.Search.Documents.Models.SentimentSkillLanguage Ru { get { throw null; } }
public static Azure.Search.Documents.Models.SentimentSkillLanguage Sv { get { throw null; } }
public static Azure.Search.Documents.Models.SentimentSkillLanguage Tr { get { throw null; } }
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9eb1765

Please sign in to comment.