swagger-blocks 1.1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -1
- data/lib/swagger/blocks.rb +7 -0
- data/lib/swagger/blocks/version.rb +1 -1
- data/spec/lib/swagger_v2_api_declaration.json +10 -0
- data/spec/lib/swagger_v2_blocks_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b866c42150b355a3435ee64d3e614c8833f66e0
|
4
|
+
data.tar.gz: 25c4cce082108016db076e702d8800a04190a2e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43785e40a8cd10c442e7691cda08c23270218bbaa1de1a7ff96100ce2401230c36f4868bda1f6d3e13fc383dfda65f2a00510c291e697cf70ddcd9e3c18419b8
|
7
|
+
data.tar.gz: 6e9b4abc905314c968557731fd758e9cc28fda85c42e7cf389ab4b24a2caaadedb085717ab4c71e4c5f54dfb5e0118d2a2494104114348d2d690efcdebc7682c
|
data/README.md
CHANGED
@@ -254,13 +254,17 @@ end
|
|
254
254
|
The special part of this controller is this line:
|
255
255
|
|
256
256
|
```Ruby
|
257
|
-
render json: Swagger::Blocks.build_root_json(
|
257
|
+
render json: Swagger::Blocks.build_root_json(SWAGGERED_CLASSES)
|
258
258
|
```
|
259
259
|
|
260
260
|
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.
|
261
261
|
|
262
262
|
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.
|
263
263
|
|
264
|
+
### Swagger 1.2 example (Rails)
|
265
|
+
|
266
|
+
See the [v1.2 docs](https://github.com/fotinakis/swagger-blocks/blob/master/README_v1_2.md).
|
267
|
+
|
264
268
|
## Reference
|
265
269
|
|
266
270
|
See the [swagger_v2_blocks_spec.rb](https://github.com/fotinakis/swagger-blocks/blob/master/spec/lib/swagger_v2_blocks_spec.rb) for examples of more complex features and declarations possible.
|
@@ -275,6 +279,7 @@ See the [swagger_v2_blocks_spec.rb](https://github.com/fotinakis/swagger-blocks/
|
|
275
279
|
|
276
280
|
## Release notes
|
277
281
|
|
282
|
+
* v1.1.1: Bugfix for tags node support.
|
278
283
|
* v1.1: Support for Swagger 2.0 spec.
|
279
284
|
* v1.0.1: Make backwards-compatible with Ruby 1.9.3.
|
280
285
|
* v1.0.0: Initial major release.
|
data/lib/swagger/blocks.rb
CHANGED
@@ -336,6 +336,13 @@ module Swagger
|
|
336
336
|
self.data[:security] ||= []
|
337
337
|
self.data[:security] << Swagger::Blocks::SecurityRequirementNode.call(version: version, &block)
|
338
338
|
end
|
339
|
+
|
340
|
+
def tags(&block)
|
341
|
+
raise NotSupportedError unless is_swagger_2_0?
|
342
|
+
|
343
|
+
self.data[:tags] ||= []
|
344
|
+
self.data[:tags] << Swagger::Blocks::TagNode.call(version: version, &block)
|
345
|
+
end
|
339
346
|
end
|
340
347
|
|
341
348
|
# v1.2: http://goo.gl/PvwUXj#512-resource-object
|
@@ -23,6 +23,16 @@
|
|
23
23
|
"produces": [
|
24
24
|
"application/json"
|
25
25
|
],
|
26
|
+
"tags": [
|
27
|
+
{
|
28
|
+
"name": "pet",
|
29
|
+
"description": "Pets operations",
|
30
|
+
"externalDocs": {
|
31
|
+
"description": "Find more info here",
|
32
|
+
"url": "https://swagger.io"
|
33
|
+
}
|
34
|
+
}
|
35
|
+
],
|
26
36
|
"paths": {
|
27
37
|
"/pets": {
|
28
38
|
"get": {
|
@@ -28,6 +28,14 @@ class PetControllerV2
|
|
28
28
|
key :schemes, ['http']
|
29
29
|
key :consumes, ['application/json']
|
30
30
|
key :produces, ['application/json']
|
31
|
+
tags do
|
32
|
+
key :name, 'pet'
|
33
|
+
key :description, 'Pets operations'
|
34
|
+
externalDocs do
|
35
|
+
key :description, 'Find more info here'
|
36
|
+
key :url, 'https://swagger.io'
|
37
|
+
end
|
38
|
+
end
|
31
39
|
end
|
32
40
|
|
33
41
|
swagger_path '/pets' do
|
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:
|
4
|
+
version: 1.1.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: 2015-03-
|
11
|
+
date: 2015-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|