Customizations via metadata - #36
Conversation
|
Using metadata for the purpose sensible to me. Please do update the specs and update README to document it. How about overloading describe 'GET /api/v1/posts', openapi: {
summary: 'list all posts',
description: 'list all posts ordered by pub_date',
tags: %w[v1 posts],
} do
# ...
endWhen the option is taking a |
Sounds good to me. About So this line: https://github.com/k0kubun/rspec-openapi/blob/master/lib/rspec/openapi/record_builder.rb#L53 description: example.metadata.dig(:openapi, :description) || RSpec::OpenAPI.description_builder.call(example), |
|
On second thought, I think that it could be good to let override also the description. |
Nice gem!
Can I propose you a small PR to allow more customizations via RSpec metadata?
Combined with the configuration:
RSpec::OpenAPI.description_builder = -> (example) { example.metadata[:openapi_description] || example.description }A usage example could be:
If you like the idea, I could update the specs and the README.