From 999620e8a0b80958f4400760e187c7beb7b02760 Mon Sep 17 00:00:00 2001 From: Apollo3zehn Date: Sat, 16 Mar 2024 22:00:25 +0100 Subject: [PATCH] Fix equality handling of `CatalogItem` --- CHANGELOG.md | 6 ++++++ src/Nexus/Extensions/Writers/Csv.cs | 10 +++++----- .../dotnet-extensibility/DataModel/ResourceCatalog.cs | 4 ++-- .../dotnet-extensibility-tests/DataModelTests.cs | 8 ++++---- version.json | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 346b38a2..8aef9083 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v2.0.0-beta.26 - 2024-03-16 +- Fix equality handling of `CatalogItem`. + +### Bugs fixed: +- Fixed wrong Docker base image. + ## v2.0.0-beta.25 - 2024-03-15 ### Bugs fixed: diff --git a/src/Nexus/Extensions/Writers/Csv.cs b/src/Nexus/Extensions/Writers/Csv.cs index efc4a2fd..6652c93a 100644 --- a/src/Nexus/Extensions/Writers/Csv.cs +++ b/src/Nexus/Extensions/Writers/Csv.cs @@ -94,12 +94,12 @@ public async Task OpenAsync( _unixStart = (fileBegin - _unixEpoch).TotalSeconds; _excelStart = fileBegin.ToOADate(); - foreach (var catalogItemGroup in catalogItems.GroupBy(catalogItem => catalogItem.Catalog)) + foreach (var catalogItemGroup in catalogItems.GroupBy(catalogItem => catalogItem.Catalog.Id)) { cancellationToken.ThrowIfCancellationRequested(); - var catalog = catalogItemGroup.Key; - var physicalId = catalog.Id.TrimStart('/').Replace('/', '_'); + var catalogId = catalogItemGroup.Key; + var physicalId = catalogId.TrimStart('/').Replace('/', '_'); var root = Context.ResourceLocator.ToPath(); /* metadata */ @@ -140,7 +140,7 @@ public async Task OpenAsync( var schema = new Schema( PrimaryKey: timestampField.Name, Fields: fields, - Properties: catalog.Properties + Properties: catalogItemGroup.First().Catalog.Properties ); resource = new CsvResource( @@ -175,7 +175,7 @@ public async Task OpenAsync( stringBuilder.Append($"# sample_period: {samplePeriod.ToUnitString()}"); AppendWindowsNewLine(stringBuilder); - stringBuilder.Append($"# catalog_id: {catalog.Id}"); + stringBuilder.Append($"# catalog_id: {catalogId}"); AppendWindowsNewLine(stringBuilder); /* field name */ diff --git a/src/extensibility/dotnet-extensibility/DataModel/ResourceCatalog.cs b/src/extensibility/dotnet-extensibility/DataModel/ResourceCatalog.cs index 8e50d701..9979f766 100644 --- a/src/extensibility/dotnet-extensibility/DataModel/ResourceCatalog.cs +++ b/src/extensibility/dotnet-extensibility/DataModel/ResourceCatalog.cs @@ -169,8 +169,8 @@ internal bool TryFind(ResourcePathParseResult parseResult, [NotNullWhen(true)] o return false; catalogItem = new CatalogItem( - this, - resource, + this with { Resources = default }, + resource with { Representations = default }, representation, parameters); diff --git a/tests/extensibility/dotnet-extensibility-tests/DataModelTests.cs b/tests/extensibility/dotnet-extensibility-tests/DataModelTests.cs index 763ec25f..57d622dc 100644 --- a/tests/extensibility/dotnet-extensibility-tests/DataModelTests.cs +++ b/tests/extensibility/dotnet-extensibility-tests/DataModelTests.cs @@ -258,8 +258,8 @@ public void CanFindCatalogItem() var catalog = new ResourceCatalog(id: "/A/B/C", resources: new List() { resource }); var catalogItem = new CatalogItem( - catalog, - resource, + catalog with { Resources = default }, + resource with { Representations = default }, representation, Parameters: default); @@ -279,8 +279,8 @@ public void CanTryFindCatalogItem() var catalog = new ResourceCatalog(id: "/A/B/C", resources: new List() { resource }); var catalogItem = new CatalogItem( - catalog, - resource, + catalog with { Resources = default }, + resource with { Representations = default }, representation, Parameters: default); diff --git a/version.json b/version.json index 889ce0ca..5ec00f99 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { "version": "2.0.0", - "suffix": "beta.25" + "suffix": "beta.26" } \ No newline at end of file