swagger-blocks 1.1.2 → 1.1.3

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: a6055711e3ea9c391a362d51dab6494f1fb4c8e8
4
- data.tar.gz: 03248ded0ff0ba04e55345a94ec0ce82d3e4134b
3
+ metadata.gz: 31a1a447a188f72eeed1b9d53af76f64c8d32bf3
4
+ data.tar.gz: 48b4620a81451150fb45fa44ad9eeb89230798c7
5
5
  SHA512:
6
- metadata.gz: 344b4923bf905546cd1242854220f0da1b4cafc0510286e14c1fecb33fac05d7056218a0cede84afd989a2a277d9b7537d5d06964ba14ee3b9b2b9ff793f0537
7
- data.tar.gz: e81f1506e5286e47168e83e65e5c2e130c108fc66805c383da4266c891c8dd13de5b9bbea01099c7da7d1273d9173716f7cfa87c16b6bcc4c8d86da15a0294df
6
+ metadata.gz: 57ab194b9a26461679e347dd4ca1fe8b5501c7fca48c6e2b61c017fc27ef560e4d9f17b97585e274ffe29b70f44d6830bb4dc44f31bc33643626b2f0279c5fc9
7
+ data.tar.gz: ad364023be29b25475e9c72947afe9b2274be31c10bcafc2481f7a0132ae4a5b684d2cd7e23e0e6fbefe30871cd8e68fa4fb6cba837aecd0ef16014a9a6b03c4
data/README.md CHANGED
@@ -11,7 +11,7 @@ It helps you write API docs in the [Swagger](https://helloreverb.com/developers/
11
11
 
12
12
  * Supports **live updating** by design. Change code, refresh your API docs.
13
13
  * **Works with all Ruby web frameworks** including Rails, Sinatra, etc.
14
- * **100% support** for all features of the [Swagger 1.2](https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md) and [Swagger 2.0](https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md) specs.
14
+ * **100% support** for all features of the [Swagger 2.0](https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md) and [Swagger 1.2](https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md) specs.
15
15
  * Flexible—you can use Swagger::Blocks anywhere, split up blocks to fit your style preferences, etc. Since it's pure Ruby and serves definitions dynamically, you can easily use initializers/config objects to change values or even **show different APIs based on environment**.
16
16
  * 1:1 naming with the Swagger spec—block names and nesting should match almost exactly with the swagger spec, with rare exceptions to make things more convenient.
17
17
 
@@ -240,7 +240,7 @@ class ApidocsController < ActionController::Base
240
240
  key :name, 'MIT'
241
241
  end
242
242
  end
243
- tags do
243
+ tag do
244
244
  key :name, 'pet'
245
245
  key :description, 'Pets operations'
246
246
  externalDocs do
@@ -278,7 +278,7 @@ That is the only line necessary to build the full [root Swagger object](https://
278
278
 
279
279
  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
280
 
281
- #### Security handling
281
+ ### Security handling
282
282
 
283
283
  To support Swagger's definitions for API key auth or OAuth2, use `security_definition` in your `swagger_root`:
284
284
 
@@ -323,6 +323,14 @@ You can then apply [security requirement objects](https://github.com/swagger-api
323
323
  end
324
324
  ```
325
325
 
326
+ #### Nested complex objects
327
+
328
+ The `key` block simply takes the value you give and puts it directly into the final JSON object. So, if you need to set more complex objects, you can just do:
329
+
330
+ ```ruby
331
+ key :foo, {some_complex: {nested_object: true}}
332
+ ```
333
+
326
334
  #### Writing JSON to a file
327
335
 
328
336
  If you are not serving the JSON directly and need to write it to a file for some reason, you can easily use `build_root_json` for that as well:
@@ -348,8 +356,12 @@ See the [swagger_v2_blocks_spec.rb](https://github.com/fotinakis/swagger-blocks/
348
356
  4. Push to the branch (`git push origin my-new-feature`)
349
357
  5. Create a new Pull Request
350
358
 
359
+ Throw a ★ on it! :)
360
+
351
361
  ## Release notes
352
362
 
363
+ * v1.1.3: Rename tags directive to tag for consistency.
364
+ * v1.1.2: Bugfix for security definition support.
353
365
  * v1.1.1: Bugfix for tags node support.
354
366
  * v1.1: Support for Swagger 2.0 spec.
355
367
  * v1.0.1: Make backwards-compatible with Ruby 1.9.3.
@@ -1,5 +1,5 @@
1
1
  module Swagger
2
2
  module Blocks
3
- VERSION = '1.1.2'
3
+ VERSION = '1.1.3'
4
4
  end
5
5
  end
@@ -337,12 +337,16 @@ module Swagger
337
337
  self.data[:security] << Swagger::Blocks::SecurityRequirementNode.call(version: version, &block)
338
338
  end
339
339
 
340
- def tags(&block)
340
+ def tag(&block)
341
341
  raise NotSupportedError unless is_swagger_2_0?
342
342
 
343
343
  self.data[:tags] ||= []
344
344
  self.data[:tags] << Swagger::Blocks::TagNode.call(version: version, &block)
345
345
  end
346
+
347
+ # Use 'tag' instead.
348
+ # @deprecated
349
+ alias_method :tags, :tag
346
350
  end
347
351
 
348
352
  # v1.2: http://goo.gl/PvwUXj#512-resource-object
@@ -219,8 +219,11 @@
219
219
  "name": {
220
220
  "type": "string"
221
221
  },
222
- "tag": {
223
- "type": "string"
222
+ "colors": {
223
+ "type": "array",
224
+ "items": {
225
+ "type": "string"
226
+ }
224
227
  }
225
228
  }
226
229
  },
@@ -237,6 +240,9 @@
237
240
  "id": {
238
241
  "type": "integer",
239
242
  "format": "int64"
243
+ },
244
+ "name": {
245
+ "type": "string"
240
246
  }
241
247
  }
242
248
  }
@@ -258,4 +264,4 @@
258
264
  }
259
265
  }
260
266
  }
261
- }
267
+ }
@@ -42,7 +42,7 @@ class PetControllerV2
42
42
  key 'read:pets', 'read your pets'
43
43
  end
44
44
  end
45
- tags do
45
+ tag do
46
46
  key :name, 'pet'
47
47
  key :description, 'Pets operations'
48
48
  externalDocs do
@@ -201,8 +201,11 @@ class PetV2
201
201
  property :name do
202
202
  key :type, :string
203
203
  end
204
- property :tag do
205
- key :type, :string
204
+ property :colors do
205
+ key :type, :array
206
+ items do
207
+ key :type, :string
208
+ end
206
209
  end
207
210
  end
208
211
 
@@ -217,6 +220,9 @@ class PetV2
217
220
  key :type, :integer
218
221
  key :format, :int64
219
222
  end
223
+ property :name do
224
+ key :type, :string
225
+ end
220
226
  end
221
227
  end
222
228
  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: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Fotinakis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-24 00:00:00.000000000 Z
11
+ date: 2015-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler