Skip to content

Commit 786889b

Browse files
Remove DuplicateRestPaths test that fails because RuntimeConfigValidator rejects duplicate REST paths at startup
Co-authored-by: souvikghosh04 <[email protected]>
1 parent 190fccb commit 786889b

1 file changed

Lines changed: 4 additions & 31 deletions

File tree

src/Service.Tests/OpenApiDocumentor/TagValidationTests.cs

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -83,37 +83,10 @@ public async Task NoDuplicateTags_AndSharedInstances(
8383
AssertOperationTagsAreSharedInstances(doc);
8484
}
8585

86-
/// <summary>
87-
/// Validates that when multiple entities share the same REST path,
88-
/// only one tag is produced and the first entity's description wins.
89-
/// </summary>
90-
[TestMethod]
91-
public async Task DuplicateRestPaths_ProduceSingleTag_FirstDescriptionWins()
92-
{
93-
Entity entity1 = CreateEntity("books", EntitySourceType.Table, "/SharedPath", "First description");
94-
Entity entity2 = CreateEntity("publishers", EntitySourceType.Table, "/SharedPath", "Second description");
95-
96-
Dictionary<string, Entity> entities = new()
97-
{
98-
{ "book", entity1 },
99-
{ "publisher", entity2 }
100-
};
101-
102-
RuntimeEntities runtimeEntities = new(entities);
103-
OpenApiDocument doc = await OpenApiTestBootstrap.GenerateOpenApiDocumentAsync(
104-
runtimeEntities: runtimeEntities,
105-
configFileName: CONFIG_FILE,
106-
databaseEnvironment: DB_ENV);
107-
108-
// Both entities share "SharedPath" after normalization.
109-
// Only one tag should exist with the first entity's description.
110-
List<OpenApiTag> sharedTags = doc.Tags.Where(t => t.Name == "SharedPath").ToList();
111-
Assert.AreEqual(1, sharedTags.Count, "Expected exactly one tag for shared REST path 'SharedPath'.");
112-
Assert.AreEqual("First description", sharedTags[0].Description,
113-
"First entity's description should win when multiple entities share the same REST path.");
114-
115-
AssertOperationTagsAreSharedInstances(doc);
116-
}
86+
// Note: A test for duplicate REST paths (e.g., two entities both mapped to "/SharedPath") is intentionally
87+
// omitted because RuntimeConfigValidator rejects duplicate REST paths at startup (see RuntimeConfigValidator
88+
// line ~685). The TryAdd in BuildOpenApiDocument is defensive code for this edge case, but it cannot be
89+
// exercised through integration tests since the server won't start with an invalid configuration.
11790

11891
/// <summary>
11992
/// Validates REST-disabled entities produce no tags and no paths.

0 commit comments

Comments
 (0)