Skip to content
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

Evaluate proc for RSpec::OpenAPI.title #171

Open
alexpapworth opened this issue Jan 31, 2024 · 2 comments
Open

Evaluate proc for RSpec::OpenAPI.title #171

alexpapworth opened this issue Jan 31, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@alexpapworth
Copy link

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"
}
@exoego
Copy link
Owner

exoego commented Jan 31, 2024

How about #162

@alexpapworth
Copy link
Author

alexpapworth commented Feb 1, 2024

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.

@exoego exoego added enhancement New feature or request good first issue Good for newcomers labels Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants