mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-23 06:16:42 +00:00
Adding description (Implementation Notes) for HTTP operations
This commit is contained in:
parent
cd5ba67227
commit
1bd138b0fb
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,3 +13,4 @@ bower_components/*
|
|||||||
bower_components/swagger-ui/*
|
bower_components/swagger-ui/*
|
||||||
!bower_components/swagger-ui/dist
|
!bower_components/swagger-ui/dist
|
||||||
.ruby-version
|
.ruby-version
|
||||||
|
.idea
|
||||||
4
Gemfile
4
Gemfile
@ -19,3 +19,7 @@ group :development, :test do
|
|||||||
gem 'pry'
|
gem 'pry'
|
||||||
gem 'generator_spec'
|
gem 'generator_spec'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
group :test do
|
||||||
|
gem 'test-unit'
|
||||||
|
end
|
||||||
|
|||||||
12
Gemfile.lock
12
Gemfile.lock
@ -1,9 +1,9 @@
|
|||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
swagger_rails (1.0.0.pre.beta2)
|
swagger_rails (1.0.0.pre.beta3)
|
||||||
rack
|
rack
|
||||||
rails (>= 3.1, < 5)
|
rails (>= 3.1, <= 5)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
@ -54,6 +54,7 @@ GEM
|
|||||||
mime-types (1.25.1)
|
mime-types (1.25.1)
|
||||||
multi_json (1.11.2)
|
multi_json (1.11.2)
|
||||||
polyglot (0.3.5)
|
polyglot (0.3.5)
|
||||||
|
power_assert (0.2.6)
|
||||||
pry (0.10.3)
|
pry (0.10.3)
|
||||||
coderay (~> 1.1.0)
|
coderay (~> 1.1.0)
|
||||||
method_source (~> 0.8.1)
|
method_source (~> 0.8.1)
|
||||||
@ -107,12 +108,14 @@ GEM
|
|||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
tilt (~> 1.1, != 1.3.0)
|
tilt (~> 1.1, != 1.3.0)
|
||||||
sqlite3 (1.3.11)
|
sqlite3 (1.3.11)
|
||||||
|
test-unit (3.1.5)
|
||||||
|
power_assert
|
||||||
thor (0.19.1)
|
thor (0.19.1)
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
treetop (1.4.15)
|
treetop (1.4.15)
|
||||||
polyglot
|
polyglot
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
tzinfo (0.3.50)
|
tzinfo (0.3.51)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
@ -123,6 +126,7 @@ DEPENDENCIES
|
|||||||
rspec-rails (~> 3.0)
|
rspec-rails (~> 3.0)
|
||||||
sqlite3
|
sqlite3
|
||||||
swagger_rails!
|
swagger_rails!
|
||||||
|
test-unit
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.10.6
|
1.12.5
|
||||||
|
|||||||
2
Rakefile
2
Rakefile
@ -1,3 +1,5 @@
|
|||||||
|
require 'rails'
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'bundler/setup'
|
require 'bundler/setup'
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
|
|||||||
@ -20,6 +20,10 @@ module SwaggerRails
|
|||||||
describe(http_verb, metadata, &block)
|
describe(http_verb, metadata, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def operation_description(message)
|
||||||
|
metadata[:operation_description] = message
|
||||||
|
end
|
||||||
|
|
||||||
[ :get, :post, :patch, :put, :delete, :head ].each do |http_verb|
|
[ :get, :post, :patch, :put, :delete, :head ].each do |http_verb|
|
||||||
define_method(http_verb) do |summary=nil, &block|
|
define_method(http_verb) do |summary=nil, &block|
|
||||||
operation(http_verb, summary, &block)
|
operation(http_verb, summary, &block)
|
||||||
|
|||||||
@ -53,6 +53,7 @@ module SwaggerRails
|
|||||||
{
|
{
|
||||||
tags: [ find_root_of(metadata)[:description] ] ,
|
tags: [ find_root_of(metadata)[:description] ] ,
|
||||||
summary: metadata[:summary],
|
summary: metadata[:summary],
|
||||||
|
description: metadata[:operation_description],
|
||||||
consumes: metadata[:consumes],
|
consumes: metadata[:consumes],
|
||||||
produces: metadata[:produces],
|
produces: metadata[:produces],
|
||||||
parameters: metadata[:parameters],
|
parameters: metadata[:parameters],
|
||||||
|
|||||||
@ -7,6 +7,7 @@ describe 'Blogs API', swagger_doc: 'v1/swagger.json' do
|
|||||||
post 'creates a new blog' do
|
post 'creates a new blog' do
|
||||||
consumes 'application/json'
|
consumes 'application/json'
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
|
operation_description 'Creates a new blog. You can provide detailed description here which will show up in Implementation Notes.'
|
||||||
parameter :blog, :in => :body, schema: {
|
parameter :blog, :in => :body, schema: {
|
||||||
:type => :object,
|
:type => :object,
|
||||||
:properties => {
|
:properties => {
|
||||||
@ -36,7 +37,7 @@ describe 'Blogs API', swagger_doc: 'v1/swagger.json' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
path '/blogs/{id}' do
|
path '/blogs/{id}' do
|
||||||
get 'retreives a specific blog' do
|
get 'retrieves a specific blog' do
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
parameter :id, :in => :path, :type => :string
|
parameter :id, :in => :path, :type => :string
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user