Description
Description
When working with OpenApiOperation, setting Tags = null does not reset the tags collection. If tags were previously assigned, assigning null is silently ignored and the old tags remain in place.
In addition, passing a HashSet with a custom equality comparer or a SortedSet gets replaced with a HashSet using OpenApiTagComparer.Instance. This differs from OpenApiDocument.Tags, which supports custom comparers, sorted sets, and resetting to null.
Repro Steps
`csharp
var operation = new OpenApiOperation
{
Tags = new HashSet { new OpenApiTagReference("tag1") }
};
// Attempt to clear or reset tags
operation.Tags = null;
// Fails: operation.Tags is still non-null and still contains tag1
Assert.Null(operation.Tags);
`
Expected Behavior
- Setting operation.Tags = null should set the property back to null.
- Custom tag comparers or sorted sets should be preserved.
Actual Behavior
- Setting operation.Tags = null has no effect because the setter only checks if (value is null) return; without assigning _tags = null;.
- Sets with custom comparers are replaced by new HashSet(value, OpenApiTagComparer.Instance).
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix: Support custom tag ordering and null assignment in OpenApiOperat…
fix: Support custom tag ordering and null assignment in OpenApiOperat…
fix: Support custom tag ordering and null assignment in OpenApiOperat…