Skip to content

Commit

Permalink
Merge pull request #2237 from microsoft/andrueastman/tagsPArsing
Browse files Browse the repository at this point in the history
chore: add test for clarity of tags parsing
  • Loading branch information
andrueastman authored Mar 7, 2025
2 parents 8eecae6 + 4c085df commit 14f1cfc
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ public class OpenApiTagReferenceTest

readonly OpenApiTagReference _openApiTagReference;
readonly OpenApiTagReference _openApiTagReference2;
readonly OpenApiDocument _openApiDocument;

public OpenApiTagReferenceTest()
{
var result = OpenApiDocument.Parse(OpenApi, "yaml", SettingsFixture.ReaderSettings);
_openApiDocument = result.Document;
_openApiTagReference = new("user", result.Document);
_openApiTagReference2 = new("users.user", result.Document);
}
Expand All @@ -77,6 +79,8 @@ public void TagReferenceResolutionWorks()
Assert.Equal("user", _openApiTagReference.Name);
Assert.Equal("Operations about users.", _openApiTagReference.Description);
Assert.True(_openApiTagReference2.UnresolvedReference);// the target is null
var operationTags = _openApiDocument.Paths["/users/{userId}"].Operations[OperationType.Get].Tags;
Assert.Null(operationTags); // the operation tags are not loaded due to the invalid syntax at the operation level(should be a list of strings)
}

[Theory]
Expand Down

0 comments on commit 14f1cfc

Please sign in to comment.