swagger-blocks 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a714aa2b6fbb1add356e052e03c827226ef6a401
4
- data.tar.gz: 36c7a3f585dcbcd8e4b90994a8e99053e651e035
3
+ metadata.gz: 24f472035a66f88b4a1921e3111332bbeff71c18
4
+ data.tar.gz: 0710bc5237aedac01946d26c94141e87b684882c
5
5
  SHA512:
6
- metadata.gz: 3cabc6e8842e9e75dfc4d5f5dace3db91d49a37cbac643d0b341abdbd814f34f5f2f51b8621df2e0417f86bc969685bddbbc0aee6cac8e185911128e7f95e516
7
- data.tar.gz: 9cbf2507bc76247123d13527a6e28f3833029d80d04b58f411fef9a3705be2e0becc8430fe034672dba74d328be71c02f16379b68a5a45176f2357a62412ce8a
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
@@ -1,5 +1,5 @@
1
1
  module Swagger
2
2
  module Blocks
3
- VERSION = '2.0.0'
3
+ VERSION = '2.0.1'
4
4
  end
5
5
  end
@@ -301,6 +301,15 @@
301
301
  }
302
302
  }
303
303
  }
304
+ },
305
+ "arrayOfArrays": {
306
+ "type": "array",
307
+ "items": {
308
+ "type": "array",
309
+ "items": {
310
+ "type": "integer"
311
+ }
312
+ }
304
313
  }
305
314
  }
306
315
  }
@@ -261,6 +261,15 @@ class PetV2
261
261
  end
262
262
  end
263
263
  end
264
+ property :arrayOfArrays do
265
+ key :type, :array
266
+ items do
267
+ key :type, :array
268
+ items do
269
+ key :type, :integer
270
+ end
271
+ end
272
+ end
264
273
  end
265
274
  end
266
275
  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.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: 2016-11-30 00:00:00.000000000 Z
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.7
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.