openapi-ruby 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b58ff6e6c8ccbf7c8c02d01f6a79ea02717cf3c709de9d1c8a8f870bb44a84fb
4
- data.tar.gz: e18b82cac3cd08bee2fcbee279d45e9b705b62ad0015feb8e3e5408cf4af63a5
3
+ metadata.gz: 4fd91990e73c6bcd5fae00558bb63afd1c4999de976b16d542aa495ddf2ad6a4
4
+ data.tar.gz: 19391cec8179b314284b51afa6adc977849f75aa431a7ec54df70f29b9877e45
5
5
  SHA512:
6
- metadata.gz: d9248a97e6b5f513516f5d97d87ef81f68047ce4db54c62503667d20751bf15f99fb4644cde3369d017b388184e92e65f904aa171e546c189134d8d1dc742eea
7
- data.tar.gz: 4a627ed1b9bc867c24263627a27f01f22d5fc50bfde5ffe9d93e87484c50e68f61e739162c198c808b979d484c9c1a3b80921c14eedd32a9c7b076a702a90cb9
6
+ metadata.gz: e9384c41d176a5cdf12a8164a148e8ff0a853aa15c73b06efb4f32bc96d40aaa18d4667c93ab6db863bf12de8eac783308a232a99dad66f755b3e1141ad456e5
7
+ data.tar.gz: c6d8b92d8473ac2f2582632c93d1f5d72fc41645b3c34a0b88192530d0bd1808aef836ac99b8864a92a88cb0587a89f1b0cf867811190e2758fdb86900e25552
data/README.md CHANGED
@@ -481,7 +481,7 @@ Two things to set up on the consumer side so the two test frameworks don't both
481
481
 
482
482
  ```ruby
483
483
  # test/test_helper.rb
484
- unless ENV["OPENAPI_RUBY_GENERATING"]
484
+ unless OpenapiRuby.schema_generating?
485
485
  require "rails/test_help"
486
486
  # ...other test-time setup...
487
487
  end
@@ -489,13 +489,15 @@ end
489
489
 
490
490
  ```ruby
491
491
  # spec/rails_helper.rb
492
- unless ENV["OPENAPI_RUBY_GENERATING"]
492
+ unless OpenapiRuby.schema_generating?
493
493
  require "rspec/rails"
494
494
  # ...other spec-time setup...
495
495
  end
496
496
  ```
497
497
 
498
- The rake task sets `OPENAPI_RUBY_GENERATING=true` in the subprocess. With the guards in place, neither test framework boots its full Rails integration during generation — only the DSL needs to be live for `api_path` / `path` to register.
498
+ `OpenapiRuby.schema_generating?` returns `true` when the rake task launched the current process (it sets `OPENAPI_RUBY_GENERATING=true` in the subprocess). With the guards in place, neither test framework boots its full Rails integration during generation — only the DSL needs to be live for `api_path` / `path` to register.
499
+
500
+ The guards are only needed while both frameworks are live. Once the migration completes and only one test framework remains, the rake task auto-detects that framework and the guard becomes dead code that can be removed.
499
501
 
500
502
  ## Runtime Middleware
501
503
 
@@ -63,7 +63,7 @@ module OpenapiRuby
63
63
  # during a phased RSpec → Minitest migration where the suite
64
64
  # holds both DSL styles. Consumers should guard
65
65
  # `require "rails/test_help"` and `require "rspec/rails"` in
66
- # their test helpers with `unless ENV["OPENAPI_RUBY_GENERATING"]`
66
+ # their test helpers with `unless OpenapiRuby.schema_generating?`
67
67
  # so the two test frameworks don't both register Rails lazy
68
68
  # hooks in the same process — only the DSL needs to be live for
69
69
  # schema generation.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenapiRuby
4
- VERSION = "3.4.0"
4
+ VERSION = "3.5.0"
5
5
  end
data/lib/openapi_ruby.rb CHANGED
@@ -27,6 +27,22 @@ module OpenapiRuby
27
27
  def reset_configuration!
28
28
  @configuration = Configuration.new
29
29
  end
30
+
31
+ # True when the current process was started by `openapi_ruby:generate`
32
+ # (the rake task sets OPENAPI_RUBY_GENERATING=true in the subprocess).
33
+ #
34
+ # Useful in consumer test helpers to guard test-framework requires
35
+ # that conflict when both `rspec/rails` and `rails/test_help` load
36
+ # in the same process (the FRAMEWORK=hybrid case):
37
+ #
38
+ # # test/test_helper.rb
39
+ # unless OpenapiRuby.schema_generating?
40
+ # require "rails/test_help"
41
+ # # ...other test-time setup...
42
+ # end
43
+ def schema_generating?
44
+ ENV["OPENAPI_RUBY_GENERATING"] == "true"
45
+ end
30
46
  end
31
47
  end
32
48
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openapi-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morten Hartvig