From 0cf86cb5bf4cb843256cf7b5a14bc4273f19c72a Mon Sep 17 00:00:00 2001 From: domaindrivendev Date: Wed, 6 Apr 2016 17:19:54 -0700 Subject: [PATCH] Add some comments to swagger_rails initializer --- Gemfile.lock | 2 +- .../install/templates/swagger_rails.rb | 3 +- .../config/initializers/swagger_rails.rb | 3 +- spec/dummy/config/swagger/v1/swagger.json | 79 ------------------- spec/dummy/spec/integration/blogs_spec.rb | 3 +- 5 files changed, 6 insertions(+), 84 deletions(-) delete mode 100644 spec/dummy/config/swagger/v1/swagger.json diff --git a/Gemfile.lock b/Gemfile.lock index a957712..ee975f9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -82,7 +82,7 @@ GEM rake (10.4.2) rdoc (3.12.2) json (~> 1.4) - rspec-core (3.4.1) + rspec-core (3.4.4) rspec-support (~> 3.4.0) rspec-expectations (3.4.0) diff-lcs (>= 1.2.0, < 2.0) diff --git a/lib/generators/swagger_rails/install/templates/swagger_rails.rb b/lib/generators/swagger_rails/install/templates/swagger_rails.rb index ad8e6b3..cf3dcbd 100644 --- a/lib/generators/swagger_rails/install/templates/swagger_rails.rb +++ b/lib/generators/swagger_rails/install/templates/swagger_rails.rb @@ -1,6 +1,7 @@ SwaggerRails.configure do |c| - # Define the swagger documents you'd like to expose and provide global metadata + # Define your swagger documents and provide global metadata + # Describe actual operations in your spec/test files c.swagger_doc 'v1/swagger.json' do { info: { diff --git a/spec/dummy/config/initializers/swagger_rails.rb b/spec/dummy/config/initializers/swagger_rails.rb index ad8e6b3..cf3dcbd 100644 --- a/spec/dummy/config/initializers/swagger_rails.rb +++ b/spec/dummy/config/initializers/swagger_rails.rb @@ -1,6 +1,7 @@ SwaggerRails.configure do |c| - # Define the swagger documents you'd like to expose and provide global metadata + # Define your swagger documents and provide global metadata + # Describe actual operations in your spec/test files c.swagger_doc 'v1/swagger.json' do { info: { diff --git a/spec/dummy/config/swagger/v1/swagger.json b/spec/dummy/config/swagger/v1/swagger.json deleted file mode 100644 index 1138a86..0000000 --- a/spec/dummy/config/swagger/v1/swagger.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "API V1", - "version": "v1" - }, - "paths": { - "/blogs": { - "post": { - "summary": "creates a new blog", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "blog", - "in": "body", - "schema": { - "type": "object", - "properties": { - "title": { - "type": "string" - }, - "content": { - "type": "string" - } - } - } - } - ], - "responses": { - "201": { - "description": "valid request" - }, - "422": { - "description": "invalid request" - } - } - }, - "get": { - "summary": "searches existing blogs", - "produces": [ - "application/json" - ], - "parameters": [ - - ], - "responses": { - "200": { - "description": "valid request" - } - } - } - }, - "/blogs/{id}": { - "get": { - "summary": "retreives a specific blog", - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "id", - "in": "path", - "type": "string" - } - ], - "responses": { - "200": { - "description": "blog found" - } - } - } - } - } -} \ No newline at end of file diff --git a/spec/dummy/spec/integration/blogs_spec.rb b/spec/dummy/spec/integration/blogs_spec.rb index 66a734d..d957668 100644 --- a/spec/dummy/spec/integration/blogs_spec.rb +++ b/spec/dummy/spec/integration/blogs_spec.rb @@ -15,9 +15,8 @@ describe 'Blogs API', docs_path: 'blogs/v1/swagger.json' do } } - let(:blog) { { title: 'foo', content: 'bar' } } - response '201', 'valid request' do + let(:blog) { { title: 'foo', content: 'bar' } } run_test! end