api_doc_server 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +38 -0
- data/.gitignore +10 -0
- data/.rubocop.yml +194 -0
- data/.rubocop_todo.yml +0 -0
- data/.travis.yml +3 -0
- data/CHANGELOG.md +10 -0
- data/Gemfile +5 -0
- data/MIT-LICENSE +20 -0
- data/README.md +96 -0
- data/Rakefile +30 -0
- data/api_doc_server.gemspec +25 -0
- data/app/assets/javascripts/api_doc_server/application.js +1 -0
- data/app/assets/javascripts/api_doc_server/redoc.js +35833 -0
- data/app/assets/javascripts/api_doc_server/redoc.min.js +8 -0
- data/app/assets/javascripts/api_doc_server/redoc.min.map +1 -0
- data/app/controllers/api_doc_server/application_controller.rb +18 -0
- data/app/controllers/api_doc_server/docs_controller.rb +36 -0
- data/app/views/api_doc_server/docs/index.html.erb +8 -0
- data/app/views/api_doc_server/docs/show.html.erb +8 -0
- data/app/views/layouts/swagger.html.erb +26 -0
- data/bin/rails +12 -0
- data/bin/rubocop +37 -0
- data/config/routes.rb +13 -0
- data/lib/api_doc_server.rb +21 -0
- data/lib/api_doc_server/configuration.rb +22 -0
- data/lib/api_doc_server/engine.rb +14 -0
- data/lib/api_doc_server/version.rb +21 -0
- data/lib/tasks/rubocop.rake +41 -0
- data/package.json +9 -0
- data/test/controllers/api_doc_server/docs_controller_test.rb +27 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +5 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +34 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/config/application.rb +22 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +46 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/api_doc_server.rb +3 -0
- data/test/dummy/config/locales/en.yml +2 -0
- data/test/dummy/config/puma.rb +47 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/api_docs/404.html +67 -0
- data/test/dummy/public/api_docs/v1/NewPet.yaml +9 -0
- data/test/dummy/public/api_docs/v1/Pet.yaml +12 -0
- data/test/dummy/public/api_docs/v1/parameters.yaml +16 -0
- data/test/dummy/public/api_docs/v1/swagger.yml +119 -0
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/test_helper.rb +17 -0
- data/update_assets.sh +30 -0
- metadata +187 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
tagsParam:
|
2
|
+
name: tags
|
3
|
+
in: query
|
4
|
+
description: tags to filter by
|
5
|
+
required: false
|
6
|
+
type: array
|
7
|
+
collectionFormat: csv
|
8
|
+
items:
|
9
|
+
type: string
|
10
|
+
limitsParam:
|
11
|
+
name: limit
|
12
|
+
in: query
|
13
|
+
description: maximum number of results to return
|
14
|
+
required: false
|
15
|
+
type: integer
|
16
|
+
format: int32
|
@@ -0,0 +1,119 @@
|
|
1
|
+
swagger: "2.0"
|
2
|
+
info:
|
3
|
+
version: 1.0.0
|
4
|
+
title: Swagger Petstore
|
5
|
+
description: A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification
|
6
|
+
termsOfService: http://helloreverb.com/terms/
|
7
|
+
contact:
|
8
|
+
name: Wordnik API Team
|
9
|
+
email: foo@example.com
|
10
|
+
url: http://madskristensen.net
|
11
|
+
license:
|
12
|
+
name: MIT
|
13
|
+
url: http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
|
14
|
+
host: petstore.swagger.wordnik.com
|
15
|
+
basePath: /api
|
16
|
+
schemes:
|
17
|
+
- http
|
18
|
+
consumes:
|
19
|
+
- application/json
|
20
|
+
produces:
|
21
|
+
- application/json
|
22
|
+
securityDefinitions:
|
23
|
+
petstore_auth:
|
24
|
+
type: oauth2
|
25
|
+
authorizationUrl: http://petstore.swagger.io/oauth/dialog
|
26
|
+
flow: implicit
|
27
|
+
scopes:
|
28
|
+
write:pets: modify pets in your account
|
29
|
+
read:pets: read your pets
|
30
|
+
api_key:
|
31
|
+
type: apiKey
|
32
|
+
name: api_key
|
33
|
+
in: header
|
34
|
+
paths:
|
35
|
+
/pets:
|
36
|
+
get:
|
37
|
+
description: |
|
38
|
+
Returns all pets from the system that the user has access to
|
39
|
+
Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.
|
40
|
+
Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.
|
41
|
+
operationId: findPets
|
42
|
+
parameters:
|
43
|
+
- $ref: 'parameters.yaml#/tagsParam'
|
44
|
+
- $ref: 'parameters.yaml#/limitsParam'
|
45
|
+
responses:
|
46
|
+
"200":
|
47
|
+
description: pet response
|
48
|
+
schema:
|
49
|
+
type: array
|
50
|
+
items:
|
51
|
+
$ref: 'Pet.yaml'
|
52
|
+
default:
|
53
|
+
description: unexpected error
|
54
|
+
schema:
|
55
|
+
$ref: '../common/Error.yaml'
|
56
|
+
security:
|
57
|
+
- oauth2: ["read:pets"]
|
58
|
+
post:
|
59
|
+
description: Creates a new pet in the store. Duplicates are allowed
|
60
|
+
operationId: addPet
|
61
|
+
parameters:
|
62
|
+
- name: pet
|
63
|
+
in: body
|
64
|
+
description: Pet to add to the store
|
65
|
+
required: true
|
66
|
+
schema:
|
67
|
+
$ref: 'NewPet.yaml'
|
68
|
+
responses:
|
69
|
+
"200":
|
70
|
+
description: pet response
|
71
|
+
schema:
|
72
|
+
$ref: 'Pet.yaml'
|
73
|
+
default:
|
74
|
+
description: unexpected error
|
75
|
+
schema:
|
76
|
+
$ref: '../common/Error.yaml'
|
77
|
+
security:
|
78
|
+
- oauth2: ["read:pets"]
|
79
|
+
/pets/{id}:
|
80
|
+
get:
|
81
|
+
description: Returns a user based on a single ID, if the user does not have access to the pet
|
82
|
+
operationId: find pet by id
|
83
|
+
parameters:
|
84
|
+
- name: id
|
85
|
+
in: path
|
86
|
+
description: ID of pet to fetch
|
87
|
+
required: true
|
88
|
+
type: integer
|
89
|
+
format: int64
|
90
|
+
responses:
|
91
|
+
"200":
|
92
|
+
description: pet response
|
93
|
+
schema:
|
94
|
+
$ref: 'Pet.yaml'
|
95
|
+
default:
|
96
|
+
description: unexpected error
|
97
|
+
schema:
|
98
|
+
$ref: '../common/Error.yaml'
|
99
|
+
security:
|
100
|
+
- oauth2: ["read:pets"]
|
101
|
+
delete:
|
102
|
+
description: deletes a single pet based on the ID supplied
|
103
|
+
operationId: deletePet
|
104
|
+
parameters:
|
105
|
+
- name: id
|
106
|
+
in: path
|
107
|
+
description: ID of pet to delete
|
108
|
+
required: true
|
109
|
+
type: integer
|
110
|
+
format: int64
|
111
|
+
responses:
|
112
|
+
"204":
|
113
|
+
description: pet deleted
|
114
|
+
default:
|
115
|
+
description: unexpected error
|
116
|
+
schema:
|
117
|
+
$ref: '../common/Error.yaml'
|
118
|
+
security:
|
119
|
+
- oauth2: ["read:pets"]
|
File without changes
|
File without changes
|
File without changes
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV['RAILS_ENV'] = 'test'
|
3
|
+
|
4
|
+
require File.expand_path('../../test/dummy/config/environment.rb', __FILE__)
|
5
|
+
require 'rails/test_help'
|
6
|
+
|
7
|
+
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
8
|
+
# to be shown.
|
9
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
10
|
+
|
11
|
+
# Load fixtures from the engine
|
12
|
+
if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
13
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path('../fixtures', __FILE__)
|
14
|
+
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
|
15
|
+
ActiveSupport::TestCase.file_fixture_path = ActiveSupport::TestCase.fixture_path + '/files'
|
16
|
+
ActiveSupport::TestCase.fixtures :all
|
17
|
+
end
|
data/update_assets.sh
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# Usage:
|
4
|
+
# 1. npm install
|
5
|
+
# 1. ./update_assets.sh
|
6
|
+
# 1. review any changes manually, ignoring where where the engine adds configurations
|
7
|
+
DIST_PATH="node_modules/redoc/dist"
|
8
|
+
ASSETS_PATH="app/assets"
|
9
|
+
npm install
|
10
|
+
command -v beautify >/dev/null || npm install -g beautify
|
11
|
+
|
12
|
+
strip_trailing_whitespace() {
|
13
|
+
git ls-files app/assets/**/*{erb,css,html,js} | while read -r file ; do sed -i '' -e's/[[:space:]]*$//' "$file"; done
|
14
|
+
}
|
15
|
+
|
16
|
+
# node_modules/redoc/dist/
|
17
|
+
# ├── redoc.min.js
|
18
|
+
# └── redoc.min.map
|
19
|
+
|
20
|
+
# javascript
|
21
|
+
mkdir -p "${ASSETS_PATH}/javascripts/api_doc_server/"
|
22
|
+
cp "${DIST_PATH}/redoc.min.map" "${ASSETS_PATH}/javascripts/api_doc_server/"
|
23
|
+
cp "${DIST_PATH}/redoc.min.js" "${ASSETS_PATH}/javascripts/api_doc_server/redoc.min.js"
|
24
|
+
cp "${DIST_PATH}/redoc.min.js" "${ASSETS_PATH}/javascripts/api_doc_server/redoc.js"
|
25
|
+
|
26
|
+
# beautify to more easily see diff
|
27
|
+
beautify -o "${ASSETS_PATH}/javascripts/api_doc_server/redoc.js" -f js "${ASSETS_PATH}/javascripts/api_doc_server/redoc.js"
|
28
|
+
|
29
|
+
# Strip trailing whitespace
|
30
|
+
strip_trailing_whitespace
|
metadata
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: api_doc_server
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Benjamin Fleischer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.2'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '6'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '4.2'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '6'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rubocop
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
description: Mountable Rails engine that serves API Docs for your Swagger/OpenAPI
|
48
|
+
docs.
|
49
|
+
email:
|
50
|
+
- github@benjaminfleischer.com
|
51
|
+
executables: []
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- ".codeclimate.yml"
|
56
|
+
- ".gitignore"
|
57
|
+
- ".rubocop.yml"
|
58
|
+
- ".rubocop_todo.yml"
|
59
|
+
- ".travis.yml"
|
60
|
+
- CHANGELOG.md
|
61
|
+
- Gemfile
|
62
|
+
- MIT-LICENSE
|
63
|
+
- README.md
|
64
|
+
- Rakefile
|
65
|
+
- api_doc_server.gemspec
|
66
|
+
- app/assets/javascripts/api_doc_server/application.js
|
67
|
+
- app/assets/javascripts/api_doc_server/redoc.js
|
68
|
+
- app/assets/javascripts/api_doc_server/redoc.min.js
|
69
|
+
- app/assets/javascripts/api_doc_server/redoc.min.map
|
70
|
+
- app/controllers/api_doc_server/application_controller.rb
|
71
|
+
- app/controllers/api_doc_server/docs_controller.rb
|
72
|
+
- app/views/api_doc_server/docs/index.html.erb
|
73
|
+
- app/views/api_doc_server/docs/show.html.erb
|
74
|
+
- app/views/layouts/swagger.html.erb
|
75
|
+
- bin/rails
|
76
|
+
- bin/rubocop
|
77
|
+
- config/routes.rb
|
78
|
+
- lib/api_doc_server.rb
|
79
|
+
- lib/api_doc_server/configuration.rb
|
80
|
+
- lib/api_doc_server/engine.rb
|
81
|
+
- lib/api_doc_server/version.rb
|
82
|
+
- lib/tasks/rubocop.rake
|
83
|
+
- package.json
|
84
|
+
- test/controllers/api_doc_server/docs_controller_test.rb
|
85
|
+
- test/dummy/Rakefile
|
86
|
+
- test/dummy/app/assets/config/manifest.js
|
87
|
+
- test/dummy/app/assets/images/.keep
|
88
|
+
- test/dummy/app/assets/javascripts/application.js
|
89
|
+
- test/dummy/app/assets/stylesheets/application.css
|
90
|
+
- test/dummy/app/controllers/application_controller.rb
|
91
|
+
- test/dummy/app/controllers/concerns/.keep
|
92
|
+
- test/dummy/app/helpers/application_helper.rb
|
93
|
+
- test/dummy/app/views/layouts/application.html.erb
|
94
|
+
- test/dummy/bin/bundle
|
95
|
+
- test/dummy/bin/rails
|
96
|
+
- test/dummy/bin/rake
|
97
|
+
- test/dummy/bin/setup
|
98
|
+
- test/dummy/bin/update
|
99
|
+
- test/dummy/config.ru
|
100
|
+
- test/dummy/config/application.rb
|
101
|
+
- test/dummy/config/boot.rb
|
102
|
+
- test/dummy/config/environment.rb
|
103
|
+
- test/dummy/config/environments/development.rb
|
104
|
+
- test/dummy/config/environments/test.rb
|
105
|
+
- test/dummy/config/initializers/api_doc_server.rb
|
106
|
+
- test/dummy/config/locales/en.yml
|
107
|
+
- test/dummy/config/puma.rb
|
108
|
+
- test/dummy/config/routes.rb
|
109
|
+
- test/dummy/config/secrets.yml
|
110
|
+
- test/dummy/config/spring.rb
|
111
|
+
- test/dummy/log/.keep
|
112
|
+
- test/dummy/public/422.html
|
113
|
+
- test/dummy/public/500.html
|
114
|
+
- test/dummy/public/api_docs/404.html
|
115
|
+
- test/dummy/public/api_docs/v1/NewPet.yaml
|
116
|
+
- test/dummy/public/api_docs/v1/Pet.yaml
|
117
|
+
- test/dummy/public/api_docs/v1/parameters.yaml
|
118
|
+
- test/dummy/public/api_docs/v1/swagger.yml
|
119
|
+
- test/dummy/public/apple-touch-icon-precomposed.png
|
120
|
+
- test/dummy/public/apple-touch-icon.png
|
121
|
+
- test/dummy/public/favicon.ico
|
122
|
+
- test/test_helper.rb
|
123
|
+
- update_assets.sh
|
124
|
+
homepage: https://github.com/bf4/api_doc_server
|
125
|
+
licenses:
|
126
|
+
- MIT
|
127
|
+
metadata: {}
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '2.1'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
requirements: []
|
143
|
+
rubyforge_project:
|
144
|
+
rubygems_version: 2.6.13
|
145
|
+
signing_key:
|
146
|
+
specification_version: 4
|
147
|
+
summary: Mountable Rails engine that serves API Docs for your Swagger/OpenAPI docs.
|
148
|
+
test_files:
|
149
|
+
- test/controllers/api_doc_server/docs_controller_test.rb
|
150
|
+
- test/dummy/Rakefile
|
151
|
+
- test/dummy/app/assets/config/manifest.js
|
152
|
+
- test/dummy/app/assets/images/.keep
|
153
|
+
- test/dummy/app/assets/javascripts/application.js
|
154
|
+
- test/dummy/app/assets/stylesheets/application.css
|
155
|
+
- test/dummy/app/controllers/application_controller.rb
|
156
|
+
- test/dummy/app/controllers/concerns/.keep
|
157
|
+
- test/dummy/app/helpers/application_helper.rb
|
158
|
+
- test/dummy/app/views/layouts/application.html.erb
|
159
|
+
- test/dummy/bin/bundle
|
160
|
+
- test/dummy/bin/rails
|
161
|
+
- test/dummy/bin/rake
|
162
|
+
- test/dummy/bin/setup
|
163
|
+
- test/dummy/bin/update
|
164
|
+
- test/dummy/config.ru
|
165
|
+
- test/dummy/config/application.rb
|
166
|
+
- test/dummy/config/boot.rb
|
167
|
+
- test/dummy/config/environment.rb
|
168
|
+
- test/dummy/config/environments/development.rb
|
169
|
+
- test/dummy/config/environments/test.rb
|
170
|
+
- test/dummy/config/initializers/api_doc_server.rb
|
171
|
+
- test/dummy/config/locales/en.yml
|
172
|
+
- test/dummy/config/puma.rb
|
173
|
+
- test/dummy/config/routes.rb
|
174
|
+
- test/dummy/config/secrets.yml
|
175
|
+
- test/dummy/config/spring.rb
|
176
|
+
- test/dummy/log/.keep
|
177
|
+
- test/dummy/public/422.html
|
178
|
+
- test/dummy/public/500.html
|
179
|
+
- test/dummy/public/api_docs/404.html
|
180
|
+
- test/dummy/public/api_docs/v1/NewPet.yaml
|
181
|
+
- test/dummy/public/api_docs/v1/Pet.yaml
|
182
|
+
- test/dummy/public/api_docs/v1/parameters.yaml
|
183
|
+
- test/dummy/public/api_docs/v1/swagger.yml
|
184
|
+
- test/dummy/public/apple-touch-icon-precomposed.png
|
185
|
+
- test/dummy/public/apple-touch-icon.png
|
186
|
+
- test/dummy/public/favicon.ico
|
187
|
+
- test/test_helper.rb
|