Skip to content

Commit

Permalink
fix: Support data models with their own ETag field.
Browse files Browse the repository at this point in the history
Unblocks releasing of Google.Apis.Contentwarehouse.v1.
  • Loading branch information
amanda-tarafa committed Sep 14, 2023
1 parent 47c3658 commit 590e4de
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 Google LLC
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -84420,7 +84420,7 @@ public class TrawlerFetchReplyDataPartialResponse : Google.Apis.Requests.IDirect

/// <summary>Any ETag seen in the headers</summary>
[Newtonsoft.Json.JsonPropertyAttribute("ETag")]
public virtual string ETag { get; set; }
public virtual string ETag__ { get; set; }

/// <summary>ID which links all partial fetches for this url</summary>
[Newtonsoft.Json.JsonPropertyAttribute("FetchID")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<!-- nupkg information -->
<PropertyGroup>
<Title>Google.Apis.Contentwarehouse.v1 Client Library</Title>
<Version>1.62.0.3165</Version>
<Version>1.54.0.3165</Version>
<Authors>Google LLC</Authors>
<Copyright>Copyright 2023 Google LLC</Copyright>
<Copyright>Copyright 2022 Google LLC</Copyright>
<PackageTags>Google</PackageTags>
<PackageProjectUrl>https://github.com/google/google-api-dotnet-client</PackageProjectUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
Expand Down Expand Up @@ -57,8 +57,8 @@
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
<PackageReference Include="ConfigureAwaitChecker.Analyzer" Version="5.0.0" PrivateAssets="All" />
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.3" PrivateAssets="All" />
<PackageReference Include="Google.Apis" Version="1.62.0" />
<PackageReference Include="Google.Apis.Auth" Version="1.62.0" />
<PackageReference Include="Google.Apis" Version="1.54.0" />
<PackageReference Include="Google.Apis.Auth" Version="1.54.0" />
</ItemGroup>

</Project>
9 changes: 9 additions & 0 deletions Google.Api.Generator.Rest/Models/DataPropertyModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ public DataPropertyModel(DataModel parent, string name, JsonSchema schema)
{
PropertyName += "Value";
}
// Avoid collisions with our own ETag property in data models.
// Note that the standard etag field is named with all lowercase.
// Other etag fields named with different casing do not represent the
// resource version, instead they are properties of the resource itself,
// for instance, if the resource represents a request or response.
if (name != "etag" && name.Equals("etag", StringComparison.OrdinalIgnoreCase))
{
PropertyName = "ETag__";
}
_schema = schema;
}

Expand Down

0 comments on commit 590e4de

Please sign in to comment.