Skip to content

keep filtered top-level tags out of SpecFilter output - #5355

Open
shamsManna wants to merge 1 commit into
swagger-api:masterfrom
shamsManna:spec-filter-top-level-tags
Open

shamsManna wants to merge 1 commit into
swagger-api:masterfrom
shamsManna:spec-filter-top-level-tags

Conversation

@shamsManna

Copy link
Copy Markdown

Pull Request

Description

Two ways top-level tags that an OpenAPISpecFilter meant to hide still end up in the document SpecFilter.filter returns (and that OpenApiResource / OpenApiServlet serve):

  1. The clone's tags are copied from the original openAPI, not from the object filterOpenAPI returned. A filter that drops a tag in filterOpenAPI gets the original list back. If the original had no tags but the filter added some, this throws an NPE.
  2. filterTopLevelTags runs before the webhooks loop. Tags whose only operations are webhooks the filter removed are therefore never pruned. A tag used both by a hidden path operation and a kept webhook is dropped instead.

Copied the tags from filteredOpenAPI and moved the pruning after webhooks are processed. Added a regression test for each case. Both tests fail on master and pass with the fix.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor (non-breaking change)
  • 🧪 Tests
  • 📝 Documentation
  • 🧹 Chore (build or tooling)

Checklist

  • I have added/updated tests as needed
  • I have added/updated documentation where applicable
  • The PR title is descriptive
  • The code builds and passes tests locally
  • I have linked related issues (if any)

Screenshots / Additional Context

./mvnw install passes locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant