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

Add filename filter for performance gain #26

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pedro-psb
Copy link

This PR:

  • add option to filter files before trying to find a swagger-ui tag in it. Backward compatible
  • improve logging to show usefull processing info

closes: #25

utils.normalize_url("assets/javascripts/"), page.url
# No tags found, we can return earlier
if len(swagger_ui_list) == 0:
return output
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole block down this change is just un-indented.
The diff is a bit weird on that, sorry.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pedro-psb pedro-psb force-pushed the add-filename-filter-option branch from 7145cf5 to ade0f07 Compare May 16, 2024 12:46
@pedro-psb
Copy link
Author

I've added a test and reviewed the failing ones.

tests/test_builds.py Show resolved Hide resolved
utils.normalize_url("assets/javascripts/"), page.url
# No tags found, we can return earlier
if len(swagger_ui_list) == 0:
return output
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -56,6 +65,10 @@ class SwaggerUIPlugin(BasePlugin):
("validatorUrl", config_options.Type(str, default="none")),
("extra_css", config_options.Type(list, default=[])),
("dark_scheme_name", config_options.Type(str, default="slate")),
(
"filter_files",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed the option to filter_files. I think using the file path is less ambiguous.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about marking files on the markdown frontmatter? (see here) The frontmatter data is already available in the page event hooks. I didn't though about that before, but it feels more ergonomic in general.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with either way

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.

[performance] Looking up every file is slow
2 participants