Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Use OpenApiTagAttribute of class to set tags for those methods where such attribute is not set explicitly #2381
Currently OpenApiTagAttribute (and OpenApiTagsAttribute as well) has targets of both AttributeTargets.Class and AttributeTargets.Method.
But setting it as class attribute has no effect because OperationTagsProcessor uses only attributes from method and if no such attributes are present - processor uses controller class name.
Suggested change adds following OperationTagsProcessor logic: if no OpenApiTag atrtributes present at method, then try to get OpenApiTag (and OpenApiTags as well) from class, and if they are not present - then use controller class name as usual.
This can be helpful when controller contains a lot of methods and all of them should have the same tag(s).