Skip to content

Commit 4245fd7

Browse files
author
Guy Fankam
committed
Remove relative resource ID support from workspace product APIs and workspace product groups
1 parent 56258f1 commit 4245fd7

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/common/Resource.FileSystem.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,14 @@ private static JsonObject FormatInformationFileDto(this IResourceWithInformation
226226
private static JsonObject FormatInformationFileDto(this ILinkResource resource, ResourceName name, JsonObject dto)
227227
{
228228
// Transform the absolute resource ID in the link property to a relative ID
229-
var updatedDto = SetAbsoluteToRelativeId(dto, resource.DtoPropertyNameForLinkedResource);
229+
var updatedDto = (resource.Primary, resource.Secondary) switch
230+
{
231+
// Workspace product groups don't support relative IDs
232+
(WorkspaceProductResource, WorkspaceGroupResource) => dto,
233+
// Workspace product APIs don't support relative IDs
234+
(WorkspaceProductResource, WorkspaceApiResource) => dto,
235+
_ => SetAbsoluteToRelativeId(dto, resource.DtoPropertyNameForLinkedResource)
236+
};
230237

231238
// Ensure the DTO contains the resource name
232239
return updatedDto.SetProperty("name", name.ToString());

src/common/Resource.Http.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33
using Flurl;
44
using Microsoft.Extensions.DependencyInjection;
55
using Microsoft.Extensions.Hosting;
6-
using OpenTelemetry.Resources;
76
using System;
87
using System.Collections.Concurrent;
98
using System.Collections.Generic;
109
using System.Linq;
1110
using System.Net;
1211
using System.Net.Http;
13-
using System.Runtime.InteropServices.JavaScript;
1412
using System.Text.Json;
1513
using System.Text.Json.Nodes;
1614
using System.Threading;

0 commit comments

Comments
 (0)