Title: docs: clarify when guarding schema_generating? backfires by mortik · Pull Request #51 · openapi-ruby/openapi-ruby · GitHub
Open Graph Title: docs: clarify when guarding schema_generating? backfires by mortik · Pull Request #51 · openapi-ruby/openapi-ruby
X Title: docs: clarify when guarding schema_generating? backfires by mortik · Pull Request #51 · openapi-ruby/openapi-ruby
Description: Prompted by a real consumer hitting this: a Rails monorepo migrating pack-by-pack from RSpec to Minitest deliberately left spec/rails_helper.rb unguarded, and had to write up "against the gem README's advice" as a risk in their PR. They were right and the README was wrong. OpenapiRuby.schema_generating? guarding is presented two ways today, both overstated: "Making generation cheaper" reads as a default recommendation, with the fixtures :all breakage as a footnote caveat. The hybrid section says the guards "stop being optional", and hybrid_script's comment says consumers "should" guard both helpers. The failure is more general than fixtures :all. The guard skips a require, so anything that require defines is gone for the whole run — fine for setup the files only touch while running, fatal for anything they touch while loading. A spec/test file that fails to load contributes no declarations, so guarding can turn a working generation run into a failing one. Real instances beyond fixtures :all: include Devise::Test::IntegrationHelpers in a class body, and top-level it_behaves_like referencing shared examples the helper loaded. Changes: New "When guarding backfires" subsection: the load-time vs run-time distinction, the three concrete breakages, and both escape hatches — narrow PATTERN, or leave that helper unguarded. Makes explicit that guarding is per-helper, so guarding test/test_helper.rb while leaving spec/rails_helper.rb alone is a supported shape rather than a deviation. Hybrid section softened from "stop being optional" to carrying more weight, with the backfire rules still applying. Dropped the claim that the guard is "still worth keeping" post-migration — it goes back to being a pure optimization. hybrid_script comment: "should guard" → "can guard", plus the per-helper caveat. Docs and comments only, no behaviour change. 🤖
Open Graph Description: Prompted by a real consumer hitting this: a Rails monorepo migrating pack-by-pack from RSpec to Minitest deliberately left spec/rails_helper.rb unguarded, and had to write up "against the gem ...
X Description: Prompted by a real consumer hitting this: a Rails monorepo migrating pack-by-pack from RSpec to Minitest deliberately left spec/rails_helper.rb unguarded, and had to write up "against the ...
Opengraph URL: https://github.com/openapi-ruby/openapi-ruby/pull/51
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:47c50d84-9c68-6b29-e2a1-af1a226aeee1 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CB8C:1F8F:DECFEA:124A8D3:6B0150C2 |
| html-safe-nonce | 03dba00edc6df6d066f621bed6ed51b8c3aca828ba3763370b153950b586eba6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjhDOjFGOEY6REVDRkVBOjEyNEE4RDM6NkIwMTUwQzIiLCJ2aXNpdG9yX2lkIjoiNTAxMTc5NDA0MDk2Mjc2NDk5NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 370854db40036ae88782d74fff5229d70ffae23fb2703887a08d0b2976288ce0 |
| hovercard-subject-tag | pull_request:4295496660 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/openapi-ruby/openapi-ruby/pull/51/files |
| twitter:image | https://avatars.githubusercontent.com/u/517703?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/517703?s=400&v=4 |
| og:image:alt | Prompted by a real consumer hitting this: a Rails monorepo migrating pack-by-pack from RSpec to Minitest deliberately left spec/rails_helper.rb unguarded, and had to write up "against the gem ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/openapi-ruby/openapi-ruby git https://github.com/openapi-ruby/openapi-ruby.git |
| octolytics-dimension-user_id | 276587259 |
| octolytics-dimension-user_login | openapi-ruby |
| octolytics-dimension-repository_id | 1211860664 |
| octolytics-dimension-repository_nwo | openapi-ruby/openapi-ruby |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1211860664 |
| octolytics-dimension-repository_network_root_nwo | openapi-ruby/openapi-ruby |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width