-
Notifications
You must be signed in to change notification settings - Fork 63
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 ability to define custom summary and tags builders #148
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #148 +/- ##
==========================================
+ Coverage 96.75% 96.76% +0.01%
==========================================
Files 14 14
Lines 431 433 +2
Branches 95 95
==========================================
+ Hits 417 419 +2
Misses 14 14 ☔ View full report in Codecov by Sentry. |
README.md
Outdated
# Generate a custom summary, given an RSpec example | ||
RSpec::OpenAPI.summary_builder = -> (example) { example.metadata[:summary] } |
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.
Could you give a short example here and tags_builder, to give an idea of customization?
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.
Thanks for all the quick reviews! I added 2 simple examples.
For our use case, we're doing a recursive look up and using the summary/tags from the nearest example/example group. Let me know if you think including that more complex example would be helpful.
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.
@mercedesb
Thanks.
The feature makes sense to me.
I think a short example of customization is helpful for other users.
bd2aaea
to
08f0c2a
Compare
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.
LGTM
Thanks
Love this project! We use it at my company for automated documentation (using
widdershins
to take the generated OpenAPI spec and create nice Slate docs). So thank you!We'd love to have some control over how we decide what the summary and tags are for a given example.
For our use case, we want to be able to define tags on the parent example and have that applied to all the child examples rather than having to define them on every example.
I followed the existing pattern in the repo for custom descriptions so that any custom scenario could be supported.