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

Able to assign proc to RSpec::OpenAPI.path #35

Merged
merged 2 commits into from
Mar 10, 2022

Conversation

ohshita
Copy link
Contributor

@ohshita ohshita commented Mar 8, 2022

First of all, we greatly appreciate the work being done by the "rspec-openapi" project.

We would like to split the generated OpenAPI schema files and avoid the conflicts caused by joint editing of a single schema file.

To achieve this goal, we would like to see the schema files generated by "rspec-openapi" incorporated into the product to allow for the split generation per request spec files that we desire.

Therefore, we propose this change as a simple implementation to achieve our stated goal while maintaining backward compatibility.

Example:

RSpec::OpenAPI.path = ->(example) {
  if %r[spec/requests/api/v1].match?(example.file_path)
    'doc/openapi/v1.yaml'
  elsif %r[spec/requests/api/v2].match?(example.file_path)
    'doc/openapi/v2.yaml'
  else
    'doc/openapi.yaml'
  end
}

@k0kubun
Copy link
Collaborator

k0kubun commented Mar 10, 2022

This seems useful 👍 Could you update README https://github.com/k0kubun/rspec-openapi#configuration to document this behavior?

@ohshita
Copy link
Contributor Author

ohshita commented Mar 10, 2022

Document updated.

Copy link
Collaborator

@k0kubun k0kubun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@k0kubun k0kubun merged commit 5c84aa4 into exoego:master Mar 10, 2022
@k0kubun
Copy link
Collaborator

k0kubun commented Mar 10, 2022

Released as v0.4.2.

@ohshita ohshita deleted the set-proc-to-config-path branch March 10, 2022 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants