esplanade 1.6.0 → 1.7.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 +4 -4
- data/.github/workflows/ruby.yml +3 -3
- data/CHANGELOG.md +5 -0
- data/README.md +7 -17
- data/lib/esplanade/configuration.rb +2 -4
- data/lib/esplanade/middleware.rb +2 -11
- data/lib/esplanade/middlewares/check_custom_response_middleware.rb +2 -11
- data/lib/esplanade/middlewares/dangerous_middleware.rb +2 -11
- data/lib/esplanade/middlewares/safe_middleware.rb +2 -11
- data/lib/esplanade/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c136a3d8b6813e9a5be58f5cd21ed11014290ba75aa609fe9d8ba2444326a5d
|
4
|
+
data.tar.gz: 5e38971b73680f6e33274360b52343ff459eee5910f9bb16b564751ff45e6a03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21f291d6c57c8ef46908f9844e6fc01bc1d28590cc9817c61947fcc37309c2fca318b2d1a2a8a3756f5175c93677c2a1ef32ab0aba7f385950db505655cf36b0
|
7
|
+
data.tar.gz: 2e0384d3a06fc34cf2ba17162bfa447af7a0f35775b9fc50e0c645680b7c7da1277538a48e73dc8c3b0ff0e3ecefeba65470cdcd23383beb7832b13aa6aeaa39
|
data/.github/workflows/ruby.yml
CHANGED
@@ -23,10 +23,10 @@ jobs:
|
|
23
23
|
- name: Set up Ruby
|
24
24
|
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
25
25
|
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
26
|
-
|
27
|
-
|
26
|
+
uses: ruby/setup-ruby@v1
|
27
|
+
# uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
|
28
28
|
with:
|
29
|
-
ruby-version: 2.
|
29
|
+
ruby-version: 2.7
|
30
30
|
- name: Install dependencies
|
31
31
|
run: bundle install
|
32
32
|
- name: Run tests
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -57,7 +57,7 @@ $ gem install esplanade
|
|
57
57
|
`config/application.rb`:
|
58
58
|
|
59
59
|
```ruby
|
60
|
-
config.middleware.use Esplanade::SafeMiddleware,
|
60
|
+
config.middleware.use Esplanade::SafeMiddleware, drafter_yaml_path: 'doc.yaml'
|
61
61
|
```
|
62
62
|
|
63
63
|
## Middlewares
|
@@ -72,7 +72,7 @@ It throws errors, so you should add your own middleware for processing.
|
|
72
72
|
|
73
73
|
```ruby
|
74
74
|
config.middleware.use YourMiddleware
|
75
|
-
config.middleware.use Esplanade::DangerousMiddleware,
|
75
|
+
config.middleware.use Esplanade::DangerousMiddleware, drafter_yaml_path: 'doc.yaml'
|
76
76
|
```
|
77
77
|
|
78
78
|
### Esplanade::CheckCustomResponseMiddleware
|
@@ -80,9 +80,9 @@ config.middleware.use Esplanade::DangerousMiddleware, apib_path: 'doc.apib'
|
|
80
80
|
Use it if you want to be sure that you have documented new custom responses.
|
81
81
|
|
82
82
|
```ruby
|
83
|
-
config.middleware.use Esplanade::CheckCustomResponseMiddleware,
|
83
|
+
config.middleware.use Esplanade::CheckCustomResponseMiddleware, drafter_yaml_path: 'doc.yaml'
|
84
84
|
config.middleware.use YourMiddleware
|
85
|
-
config.middleware.use Esplanade::DangerousMiddleware,
|
85
|
+
config.middleware.use Esplanade::DangerousMiddleware, drafter_yaml_path: 'doc.yaml'
|
86
86
|
```
|
87
87
|
|
88
88
|
## Esplanade::Error
|
@@ -95,7 +95,7 @@ Parent class for those described below. Inherited from `Esplanade::Error`.
|
|
95
95
|
|
96
96
|
#### Esplanade::Request::PrefixNotMatch
|
97
97
|
|
98
|
-
Error message format:
|
98
|
+
Error message format:
|
99
99
|
|
100
100
|
```ruby
|
101
101
|
{
|
@@ -169,7 +169,7 @@ Parent class for those described below. Inherited from `Esplanade::Error`.
|
|
169
169
|
|
170
170
|
#### Esplanade::Response::PrefixNotMatch
|
171
171
|
|
172
|
-
Error message format:
|
172
|
+
Error message format:
|
173
173
|
|
174
174
|
```ruby
|
175
175
|
{
|
@@ -233,17 +233,7 @@ Error message format:
|
|
233
233
|
|
234
234
|
## Middleware args
|
235
235
|
|
236
|
-
|
237
|
-
|
238
|
-
Path to API Blueprint documentation. There must be an installed [drafter](https://github.com/apiaryio/drafter) to parse it.
|
239
|
-
|
240
|
-
### `drafter_yaml_path`
|
241
|
-
|
242
|
-
Path to API Blueprint documentation pre-parsed with `drafter` and saved to a YAML file.
|
243
|
-
|
244
|
-
### `prefix`
|
245
|
-
|
246
|
-
Prefix for API requests. Example: `'/api'`. The prefix is added to the requests in the documentation.
|
236
|
+
Support any [tomograph constructor-params](https://github.com/funbox/tomograph/tree/master#constructor-params)
|
247
237
|
|
248
238
|
## License
|
249
239
|
|
data/lib/esplanade/middleware.rb
CHANGED
@@ -4,18 +4,9 @@ require 'esplanade/response'
|
|
4
4
|
|
5
5
|
module Esplanade
|
6
6
|
class Middleware
|
7
|
-
def initialize(
|
8
|
-
app,
|
9
|
-
prefix: Esplanade.configuration.prefix,
|
10
|
-
apib_path: Esplanade.configuration.apib_path,
|
11
|
-
drafter_yaml_path: Esplanade.configuration.drafter_yaml_path
|
12
|
-
)
|
7
|
+
def initialize(app, **params)
|
13
8
|
@app = app
|
14
|
-
@documentation = Tomograph::Tomogram.new(
|
15
|
-
prefix: prefix,
|
16
|
-
apib_path: apib_path,
|
17
|
-
drafter_yaml_path: drafter_yaml_path
|
18
|
-
)
|
9
|
+
@documentation = Tomograph::Tomogram.new(Esplanade.configuration.params.merge(params))
|
19
10
|
end
|
20
11
|
|
21
12
|
def call(env)
|
@@ -4,18 +4,9 @@ require 'esplanade/response'
|
|
4
4
|
|
5
5
|
module Esplanade
|
6
6
|
class CheckCustomResponseMiddleware
|
7
|
-
def initialize(
|
8
|
-
app,
|
9
|
-
prefix: Esplanade.configuration.prefix,
|
10
|
-
apib_path: Esplanade.configuration.apib_path,
|
11
|
-
drafter_yaml_path: Esplanade.configuration.drafter_yaml_path
|
12
|
-
)
|
7
|
+
def initialize(app, **params)
|
13
8
|
@app = app
|
14
|
-
@documentation = Tomograph::Tomogram.new(
|
15
|
-
prefix: prefix,
|
16
|
-
apib_path: apib_path,
|
17
|
-
drafter_yaml_path: drafter_yaml_path
|
18
|
-
)
|
9
|
+
@documentation = Tomograph::Tomogram.new(Esplanade.configuration.params.merge(params))
|
19
10
|
end
|
20
11
|
|
21
12
|
def call(env)
|
@@ -4,18 +4,9 @@ require 'esplanade/response'
|
|
4
4
|
|
5
5
|
module Esplanade
|
6
6
|
class DangerousMiddleware
|
7
|
-
def initialize(
|
8
|
-
app,
|
9
|
-
prefix: Esplanade.configuration.prefix,
|
10
|
-
apib_path: Esplanade.configuration.apib_path,
|
11
|
-
drafter_yaml_path: Esplanade.configuration.drafter_yaml_path
|
12
|
-
)
|
7
|
+
def initialize(app, **params)
|
13
8
|
@app = app
|
14
|
-
@documentation = Tomograph::Tomogram.new(
|
15
|
-
prefix: prefix,
|
16
|
-
apib_path: apib_path,
|
17
|
-
drafter_yaml_path: drafter_yaml_path
|
18
|
-
)
|
9
|
+
@documentation = Tomograph::Tomogram.new(Esplanade.configuration.params.merge(params))
|
19
10
|
end
|
20
11
|
|
21
12
|
def call(env)
|
@@ -4,18 +4,9 @@ require 'esplanade/response'
|
|
4
4
|
|
5
5
|
module Esplanade
|
6
6
|
class SafeMiddleware
|
7
|
-
def initialize(
|
8
|
-
app,
|
9
|
-
prefix: Esplanade.configuration.prefix,
|
10
|
-
apib_path: Esplanade.configuration.apib_path,
|
11
|
-
drafter_yaml_path: Esplanade.configuration.drafter_yaml_path
|
12
|
-
)
|
7
|
+
def initialize(app, **params)
|
13
8
|
@app = app
|
14
|
-
@documentation = Tomograph::Tomogram.new(
|
15
|
-
prefix: prefix,
|
16
|
-
apib_path: apib_path,
|
17
|
-
drafter_yaml_path: drafter_yaml_path
|
18
|
-
)
|
9
|
+
@documentation = Tomograph::Tomogram.new(Esplanade.configuration.params.merge(params))
|
19
10
|
end
|
20
11
|
|
21
12
|
def call(env)
|
data/lib/esplanade/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: esplanade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- d.efimov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-schema
|