swagger-blocks 2.0.0 → 2.0.1
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
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 24f472035a66f88b4a1921e3111332bbeff71c18
|
|
4
|
+
data.tar.gz: 0710bc5237aedac01946d26c94141e87b684882c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 47dab1f23c968995ab005b8319f728187510672e778f816d4229e7ef1d3d56d3bf20bcf51034232f80a6412c9ef1b66de0de502fc206bad5d10d9064c1aa29af
|
|
7
|
+
data.tar.gz: 19a7cc6a7d3dea1c46156f83c312f6e5aef8e4a0d1a0a89c74e796c0fa2d5ef863d5f9781b867b479b75c57431f7be9858bcd2128874eff355692540785113c1
|
data/README.md
CHANGED
|
@@ -43,6 +43,7 @@ class PetsController < ActionController::Base
|
|
|
43
43
|
|
|
44
44
|
swagger_path '/pets/{id}' do
|
|
45
45
|
operation :get do
|
|
46
|
+
key :summary, 'Find Pet by ID'
|
|
46
47
|
key :description, 'Returns a single pet if the user has access'
|
|
47
48
|
key :operationId, 'findPetById'
|
|
48
49
|
key :tags, [
|
|
@@ -72,6 +73,7 @@ class PetsController < ActionController::Base
|
|
|
72
73
|
end
|
|
73
74
|
swagger_path '/pets' do
|
|
74
75
|
operation :get do
|
|
76
|
+
key :summary, 'All Pets'
|
|
75
77
|
key :description, 'Returns all pets from the system that the user has access to'
|
|
76
78
|
key :operationId, 'findPets'
|
|
77
79
|
key :produces, [
|
|
@@ -276,6 +278,17 @@ render json: Swagger::Blocks.build_root_json(SWAGGERED_CLASSES)
|
|
|
276
278
|
|
|
277
279
|
That is the only line necessary to build the full [root Swagger object](https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#schema) JSON and all definitions underneath it. You simply pass in a list of all the "swaggered" classes in your app.
|
|
278
280
|
|
|
281
|
+
If you want to include controllers outside the standard path just use the full class path including module names, like:
|
|
282
|
+
|
|
283
|
+
```Ruby
|
|
284
|
+
SWAGGERED_CLASSES = [
|
|
285
|
+
Api::V1::PetsController,
|
|
286
|
+
self,
|
|
287
|
+
]
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
If you are receiving a "swagger_root must be declared" error make sure you are including "self" in your SWAGGERED_CLASSES definition, as shown above.
|
|
291
|
+
|
|
279
292
|
Now, simply point Swagger UI at `/apidocs` and everything should Just Work™. If you change any of the Swagger block definitions, you can simply refresh Swagger UI to see the changes.
|
|
280
293
|
|
|
281
294
|
### Security handling
|
|
@@ -471,6 +484,7 @@ Throw a ★ on it! :)
|
|
|
471
484
|
|
|
472
485
|
## Release notes
|
|
473
486
|
|
|
487
|
+
* v2.0.1: Bugfix to allow nested arrays of `items`.
|
|
474
488
|
* v2.0.0: Code cleanup, drop support for Swagger 1.2 spec.
|
|
475
489
|
* v1.4.0: Allow parameters to be defined once in swagger_root and reused.
|
|
476
490
|
* v1.3.4: Fix support for fully-qualified URIs in `$ref` values.
|
|
@@ -8,6 +8,10 @@ module Swagger
|
|
|
8
8
|
self.data[:properties].version = version
|
|
9
9
|
self.data[:properties].property(name, inline_keys, &block)
|
|
10
10
|
end
|
|
11
|
+
|
|
12
|
+
def items(inline_keys = nil, &block)
|
|
13
|
+
self.data[:items] = Swagger::Blocks::Nodes::ItemsNode.call(version: version, inline_keys: inline_keys, &block)
|
|
14
|
+
end
|
|
11
15
|
end
|
|
12
16
|
end
|
|
13
17
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: swagger-blocks
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Fotinakis
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-08-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
132
132
|
version: '0'
|
|
133
133
|
requirements: []
|
|
134
134
|
rubyforge_project:
|
|
135
|
-
rubygems_version: 2.6.
|
|
135
|
+
rubygems_version: 2.6.12
|
|
136
136
|
signing_key:
|
|
137
137
|
specification_version: 4
|
|
138
138
|
summary: Define and serve live-updating Swagger JSON for Ruby apps.
|