-
Notifications
You must be signed in to change notification settings - Fork 219
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
Feature openapi_extensions
with helper functions for JSON responses and requestBodies
#240
Conversation
openapi_extensions
with helper functions for JSON responses and requestBodies
f321c0f
to
0ce10e5
Compare
…ies and JSON responses.
I think the two seprate traits are good since then it allows having possible separete set of helpers for each type which is a good thing for separating consern.
Yeah these could be implemented for |
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.
This looks awesome 👍 can't wait to get more utilities to the library.
Sounds great, @juhaku! Thanks for the suggestions. I have now made the changes discussed above:
I think this PR is ready for one more review and if you are satisfied with it, we can merge. Alternately, I am happy to make any other changes you would prefer. |
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.
Super. 🥇
Following our discussion on adding some helper functions for documenting a JSON
requestBody
orresponse
, this PR includes the following, all gated by the feature-flag suggested in the discussion,openapi_extensions
:RequestBodyExt
for easily documenting JSONrequestBody
content (implemented forRequestBodyBuilder
).ResponseExt
for easily documenting JSONresponse
content (implemented forResponseBuilder
).In addition, the following changes are also included:
from_response_name
forRef
struct for"#/components/responses/SomeObject"
references-F openapi_extensions
tocargo tests
github actions workflowQuestions
Having traits in this case may be unnecessary because these methods are only implemented in each case for a single
struct
. We could do one of the following [with these traits]:RequestBodyBuilder
andResponseBuilder
(instead of two separate traits). The trait could include common shared things, but may result in people usingresponse
objects in requests or otherwise blending the two different types. (A single shared trait is originally how I did this in my own project.)RequestBodyBuilder
andResponseBuilder
.RequestBodyBuilderExt
(probably renaming the trait) forRequestBody
andResponseBuilderExt
forResponse
(also renaming the trait) instead of just for the builders and then having traits would probably be justified.Happy to implement one of the above or leave this as-is. Also, happy to take any feedback or make any changes requested.