-
Notifications
You must be signed in to change notification settings - Fork 0
feat(cli): add --pretty-headings flag #36
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
Conversation
Extract the input field formatting into a function that gets called by _simplify_schema. Add use_title parameter to enable switching between using the OAS key for an input field vs the formatted title.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #36 +/- ##
==========================================
+ Coverage 94.83% 94.95% +0.11%
==========================================
Files 4 4
Lines 213 218 +5
Branches 24 25 +1
==========================================
+ Hits 202 207 +5
Misses 8 8
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dionhaefner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how useful this feature is (I'd just go with "not pretty headings" by default), but shouldn't harm either. Thanks @jacanchaplais!
|
@dionhaefner I like a bit of pointless prettiness 🤭 But also it's about consistency, because the OAS titles are formatted in title case, but also the array and composite types are not very useful / break conventions. So it's to make the rough edges smooth using keys where the title fails, or make everything consistent with using keys exclusively. But can always flip the default later, as per |
Relevant issue or PR
Closes #22.
Description of changes
Add a
--pretty-headings/--no-pretty-headingsflag to the CLI, such that formatting on the parameter names in the Web UI can be toggled on and off.This is useful in instances where Tesseracts have parameter names which differ only in case.
In the process,
_parse_tesseract_oas()was refactored, so the formatting logic for input fields is easier to separate from the recursive logic of traversing the OAS tree. This was done by extracted formatting logic in a function called_format_field().Testing done
Manual testing.
Example:
tesseract_api.py:Pretty headings on (default)
Pretty headings off
tesseract-streamlit --no-pretty-headings "http://localhost:50262" app.py streamlit run app.py