rspec-openapi icon indicating copy to clipboard operation
rspec-openapi copied to clipboard

Evaluate proc for RSpec::OpenAPI.title

Open alexpapworth opened this issue 1 year ago • 2 comments

My use case is generating different openapi files from different RSpec request files. The RSpec::OpenAPI.path proc is great to export YAML to different files, but I was surprised to see I couldn't do the same with RSpec::OpenAPI.title

Unfortunately the following snippet generates: title: !ruby/object:Proc {}

RSpec::OpenAPI.title = -> (example) {
  return "Customer API" if example.file_path == "./spec/requests/customer_api_spec.rb"
  return "Reseller API" if example.file_path == "./spec/requests/resellers_api_spec.rb"

  "API"
}

alexpapworth avatar Jan 31 '24 17:01 alexpapworth

How about https://github.com/exoego/rspec-openapi/pull/162

exoego avatar Jan 31 '24 22:01 exoego

Ah interesting. My usecase is slightly different. I would favour a proc on RSpec::OpenAPI.title in a single config file rather than creating the multiple config files.

alexpapworth avatar Feb 01 '24 11:02 alexpapworth