Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpecFilter uses non-filtered OpenAPI to copy some fields #3173

Closed
kokorin opened this issue Apr 9, 2019 · 4 comments
Closed

SpecFilter uses non-filtered OpenAPI to copy some fields #3173

kokorin opened this issue Apr 9, 2019 · 4 comments

Comments

@kokorin
Copy link

kokorin commented Apr 9, 2019

io.swagger.v3.core.filter.SpecFilter#filter()

OpenAPI clone = new OpenAPI();
clone.info(filteredOpenAPI.getInfo());
clone.openapi(filteredOpenAPI.getOpenapi());
clone.setExtensions(openAPI.getExtensions());
clone.setExternalDocs(openAPI.getExternalDocs());
clone.setSecurity(openAPI.getSecurity());
clone.setServers(openAPI.getServers());
clone.tags(filteredOpenAPI.getTags() == null ? null : new ArrayList<>(openAPI.getTags()));
...
for (String resourcePath : openAPI.getPaths().keySet()) {

Notice that for some properties filteredOpenAPI is used to copy, but for others non-filtered openAPI is used.

As a workaround we update original OpenAPI passed to OpenAPISpecFilter

frantuma added a commit that referenced this issue Apr 11, 2019
fix #3173 - use filtered values in returned instance
@frantuma
Copy link
Member

Thanks for reporting this! fixed in #3176

@kokorin
Copy link
Author

kokorin commented Apr 11, 2019

@frantuma for loop is still based on no filtered OpenApi.
I believe it should also use filteredOpenAPI

for (String resourcePath : filteredOpenAPI.getPaths().keySet()) {

@kokorin
Copy link
Author

kokorin commented Apr 11, 2019

Also, may be it's better to replace above mentioned key-based loop with entrySet-based loop

frantuma added a commit that referenced this issue Apr 11, 2019
frantuma added a commit that referenced this issue Apr 11, 2019
frantuma added a commit that referenced this issue Apr 11, 2019
@frantuma
Copy link
Member

you're right, updated in #3177; as we use path key downstream, keeping key based loop as is

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

No branches or pull requests

2 participants