explicit 0.2.16 → 0.2.17
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 +4 -4
- data/README.md +14 -0
- data/lib/explicit/configuration.rb +9 -0
- data/lib/explicit/documentation/output/swagger.rb +2 -0
- data/lib/explicit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28e91e624223bafc22d197130a6ae5973f6a2364f6dd192d8e2f70b74fe88968
|
4
|
+
data.tar.gz: 3fcacbe34bd45dc3b988f703f05928a65af46f284b498a64e83f12539cc2ef86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc53aeced2b49c6667fb723a681d8e01b8e2529713a07f142281d2b2bcd40dc619c435c08ad7d7aee38aeceac7e053fd2d46a8e2d438bf82211a4fbd63ba12b7
|
7
|
+
data.tar.gz: cf4995522dab379e5277ac328e55968d0bc30b8850d64fcf7fb25b7afb9eae0c0c865df0813b7578dbff0d91f179b10a32e51b4c9b797932ab1aec95091c54ba
|
data/README.md
CHANGED
@@ -45,6 +45,7 @@ documented types at runtime.
|
|
45
45
|
- [Customizing error messages](#customizing-error-messages)
|
46
46
|
- [Customizing error serialization](#customizing-error-serialization)
|
47
47
|
- [Raise on invalid example](#raise-on-invalid-example)
|
48
|
+
- [CORS](#cors)
|
48
49
|
|
49
50
|
# Installation
|
50
51
|
|
@@ -841,7 +842,20 @@ end
|
|
841
842
|
|
842
843
|
### Raise on invalid example
|
843
844
|
|
845
|
+
When adding a request example with `example(params:, response:)`, the response
|
846
|
+
must match the documented types. If it doesn't match, Explicit logs a warning,
|
847
|
+
but you can choose a more strict behaviour that raises an error instead.
|
848
|
+
|
844
849
|
```ruby
|
845
850
|
config.raise_on_invalid_example = true # default is false
|
846
851
|
config.raise_on_invalid_example = ::Rails.env.development? # recommended
|
847
852
|
```
|
853
|
+
|
854
|
+
### CORS
|
855
|
+
|
856
|
+
Enable/disable [CORS headers](https://github.com/luizpvas/explicit/blob/main/lib/explicit/documentation/output/swagger.rb#L67-L74)
|
857
|
+
support.
|
858
|
+
|
859
|
+
```ruby
|
860
|
+
config.cors_enabled = true
|
861
|
+
```
|
@@ -6,6 +6,7 @@ module Explicit
|
|
6
6
|
class Configuration
|
7
7
|
def initialize
|
8
8
|
@rescue_from_invalid_params = true
|
9
|
+
@cors_enabled = !defined?(::Rack::Cors)
|
9
10
|
end
|
10
11
|
|
11
12
|
def request_examples_file_path=(path)
|
@@ -36,6 +37,14 @@ module Explicit
|
|
36
37
|
@raise_on_invalid_example
|
37
38
|
end
|
38
39
|
|
40
|
+
def cors_enabled=(enabled)
|
41
|
+
@cors_enabled = enabled
|
42
|
+
end
|
43
|
+
|
44
|
+
def cors_enabled?
|
45
|
+
@cors_enabled
|
46
|
+
end
|
47
|
+
|
39
48
|
def test_runner=(test_runner)
|
40
49
|
@test_runner = test_runner
|
41
50
|
end
|
data/lib/explicit/version.rb
CHANGED