jdoc 0.4.3 → 0.5.0
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 +5 -5
- data/.github/release.yml +23 -0
- data/.github/workflows/bump-request.yml +26 -0
- data/.github/workflows/ci.yml +27 -0
- data/.github/workflows/github-label-sync.yml +18 -0
- data/.github/workflows/release.yml +14 -0
- data/.gitignore +0 -1
- data/Gemfile.lock +83 -0
- data/README.md +3 -0
- data/Rakefile +4 -0
- data/example-api-documentation.html +364 -0
- data/jdoc.gemspec +4 -4
- data/lib/jdoc/generator.rb +9 -12
- data/lib/jdoc/version.rb +1 -1
- data/lib/jdoc.rb +1 -1
- data/spec/jdoc/generator_spec.rb +10 -0
- data/spec/spec_helper.rb +0 -1
- metadata +17 -16
- data/CHANGELOG.md +0 -123
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4ee1b1514622a40fee3e0d8813c610f9f9c0bd31c97367693b2523663028a6f9
|
|
4
|
+
data.tar.gz: cbea57957aa93be238805ed0e7d6558fbef0405e53cffee35f0140d8a31b7701
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 00b3b964522b6260e4e6da08fc9eebb409ccb9a52a5cac65f1a80b3f1da8ba2ae3cd4a65d64e58f0365bb035bdf494d07874bb342b94f59a439e13e70b44b255
|
|
7
|
+
data.tar.gz: 69408fbfdddb4e79f76e266aca7cb5992b12e684fb0258c62983040b2a598ec9397ae33a5b838953e5b15d3957664c416eaff24bf1307d11e026c0e3b44f3824
|
data/.github/release.yml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
changelog:
|
|
2
|
+
categories:
|
|
3
|
+
- title: Added
|
|
4
|
+
labels:
|
|
5
|
+
- add
|
|
6
|
+
- title: Changed
|
|
7
|
+
labels:
|
|
8
|
+
- change
|
|
9
|
+
- title: Deprecated
|
|
10
|
+
labels:
|
|
11
|
+
- deprecate
|
|
12
|
+
- title: Fixed
|
|
13
|
+
labels:
|
|
14
|
+
- fix
|
|
15
|
+
- title: Removed
|
|
16
|
+
labels:
|
|
17
|
+
- remove
|
|
18
|
+
- title: Security
|
|
19
|
+
labels:
|
|
20
|
+
- security
|
|
21
|
+
- title: Others
|
|
22
|
+
labels:
|
|
23
|
+
- "*"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: bump-request
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
version:
|
|
7
|
+
description: Version to change to.
|
|
8
|
+
required: true
|
|
9
|
+
type: string
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
run:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v3
|
|
16
|
+
- name: Set up Ruby
|
|
17
|
+
uses: ruby/setup-ruby@v1
|
|
18
|
+
with:
|
|
19
|
+
ruby-version: '3.3'
|
|
20
|
+
bundler-cache: true
|
|
21
|
+
- uses: r7kamura/bump-request@v0
|
|
22
|
+
with:
|
|
23
|
+
command: |
|
|
24
|
+
sed -i -r 's/([0-9]+\.[0-9]+\.[0-9]+)/${{ inputs.version }}/' lib/*/version.rb
|
|
25
|
+
bundle install
|
|
26
|
+
version: ${{ inputs.version }}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
rspec:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
name: Ruby ${{ matrix.ruby }}
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
ruby:
|
|
16
|
+
- '3.3'
|
|
17
|
+
- '3.4'
|
|
18
|
+
- '4.0'
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v3
|
|
21
|
+
- name: Set up Ruby
|
|
22
|
+
uses: ruby/setup-ruby@v1
|
|
23
|
+
with:
|
|
24
|
+
ruby-version: ${{ matrix.ruby }}
|
|
25
|
+
bundler-cache: true
|
|
26
|
+
- name: Run the default task
|
|
27
|
+
run: bundle exec rake
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: github-label-sync
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
paths:
|
|
8
|
+
- .github/workflows/github-label-sync.yml
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: r7kamura/github-label-sync-action@v0
|
|
16
|
+
with:
|
|
17
|
+
source_path: labels-keepachangelog.yml
|
|
18
|
+
source_repository: r7kamura/github-label-presets
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
jdoc (0.5.0)
|
|
5
|
+
activesupport
|
|
6
|
+
erubi
|
|
7
|
+
json_schema
|
|
8
|
+
rack
|
|
9
|
+
redcarpet
|
|
10
|
+
|
|
11
|
+
GEM
|
|
12
|
+
remote: https://rubygems.org/
|
|
13
|
+
specs:
|
|
14
|
+
activesupport (7.1.6)
|
|
15
|
+
base64
|
|
16
|
+
benchmark (>= 0.3)
|
|
17
|
+
bigdecimal
|
|
18
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
19
|
+
connection_pool (>= 2.2.5)
|
|
20
|
+
drb
|
|
21
|
+
i18n (>= 1.6, < 2)
|
|
22
|
+
logger (>= 1.4.2)
|
|
23
|
+
minitest (>= 5.1)
|
|
24
|
+
mutex_m
|
|
25
|
+
securerandom (>= 0.3)
|
|
26
|
+
tzinfo (~> 2.0)
|
|
27
|
+
base64 (0.2.0)
|
|
28
|
+
benchmark (0.5.0)
|
|
29
|
+
bigdecimal (3.1.5)
|
|
30
|
+
coderay (1.1.3)
|
|
31
|
+
concurrent-ruby (1.2.2)
|
|
32
|
+
connection_pool (2.4.1)
|
|
33
|
+
diff-lcs (1.5.0)
|
|
34
|
+
drb (2.2.0)
|
|
35
|
+
ruby2_keywords
|
|
36
|
+
erubi (1.13.1)
|
|
37
|
+
i18n (1.14.1)
|
|
38
|
+
concurrent-ruby (~> 1.0)
|
|
39
|
+
json_schema (0.21.0)
|
|
40
|
+
logger (1.7.0)
|
|
41
|
+
method_source (1.0.0)
|
|
42
|
+
minitest (6.0.5)
|
|
43
|
+
drb (~> 2.0)
|
|
44
|
+
prism (~> 1.5)
|
|
45
|
+
mutex_m (0.2.0)
|
|
46
|
+
prism (1.9.0)
|
|
47
|
+
pry (0.14.2)
|
|
48
|
+
coderay (~> 1.1)
|
|
49
|
+
method_source (~> 1.0)
|
|
50
|
+
rack (3.0.8)
|
|
51
|
+
rake (13.4.2)
|
|
52
|
+
redcarpet (3.6.0)
|
|
53
|
+
rspec (3.12.0)
|
|
54
|
+
rspec-core (~> 3.12.0)
|
|
55
|
+
rspec-expectations (~> 3.12.0)
|
|
56
|
+
rspec-mocks (~> 3.12.0)
|
|
57
|
+
rspec-core (3.12.2)
|
|
58
|
+
rspec-support (~> 3.12.0)
|
|
59
|
+
rspec-expectations (3.12.3)
|
|
60
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
61
|
+
rspec-support (~> 3.12.0)
|
|
62
|
+
rspec-mocks (3.12.6)
|
|
63
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
64
|
+
rspec-support (~> 3.12.0)
|
|
65
|
+
rspec-support (3.12.1)
|
|
66
|
+
ruby2_keywords (0.0.5)
|
|
67
|
+
securerandom (0.4.1)
|
|
68
|
+
tzinfo (2.0.6)
|
|
69
|
+
concurrent-ruby (~> 1.0)
|
|
70
|
+
|
|
71
|
+
PLATFORMS
|
|
72
|
+
ruby
|
|
73
|
+
x86_64-linux
|
|
74
|
+
|
|
75
|
+
DEPENDENCIES
|
|
76
|
+
bundler (>= 1.6)
|
|
77
|
+
jdoc!
|
|
78
|
+
pry
|
|
79
|
+
rake (>= 13.2.0)
|
|
80
|
+
rspec (>= 2.14.1)
|
|
81
|
+
|
|
82
|
+
BUNDLED WITH
|
|
83
|
+
2.5.3
|
data/README.md
CHANGED
data/Rakefile
CHANGED
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
<!DOCTYPE HTML>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>API Docs</title>
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
width: 920px;
|
|
9
|
+
margin: 0 auto;
|
|
10
|
+
font-size: 14px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
a {
|
|
14
|
+
color: #4183C4;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
pre {
|
|
18
|
+
color: #393939;
|
|
19
|
+
background-color: #fafafb;
|
|
20
|
+
padding: 10px;
|
|
21
|
+
margin: 2em 0;
|
|
22
|
+
border: 1px solid #cacaca;
|
|
23
|
+
border-radius: 3px;
|
|
24
|
+
font: 12px/1.4em Consolas, 'Liberation Mono', Courier, monospace;
|
|
25
|
+
overflow: auto;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
ol code,
|
|
29
|
+
ul code,
|
|
30
|
+
p code {
|
|
31
|
+
font-size: 12px;
|
|
32
|
+
margin: 0;
|
|
33
|
+
border: 1px solid #ddd;
|
|
34
|
+
background-color: #f8f8f8;
|
|
35
|
+
border-radius: 3px;
|
|
36
|
+
padding: 0;
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
39
|
+
</head>
|
|
40
|
+
<body>
|
|
41
|
+
<h1 id="example-api">Example API</h1>
|
|
42
|
+
|
|
43
|
+
<p>A schema for a small example API.</p>
|
|
44
|
+
|
|
45
|
+
<ul>
|
|
46
|
+
<li><a href="#app">App</a>
|
|
47
|
+
|
|
48
|
+
<ul>
|
|
49
|
+
<li><a href="#post-apps">POST /apps</a></li>
|
|
50
|
+
<li><a href="#delete-appsid">DELETE /apps/:id</a></li>
|
|
51
|
+
<li><a href="#get-appsid">GET /apps/:id</a></li>
|
|
52
|
+
<li><a href="#get-apps">GET /apps</a></li>
|
|
53
|
+
<li><a href="#patch-appsid">PATCH /apps/:id</a></li>
|
|
54
|
+
<li><a href="#post-appsidfiles">POST /apps/:id/files</a></li>
|
|
55
|
+
</ul></li>
|
|
56
|
+
<li><a href="#recipe">Recipe</a>
|
|
57
|
+
|
|
58
|
+
<ul>
|
|
59
|
+
<li><a href="#get-recipes">GET /recipes</a></li>
|
|
60
|
+
</ul></li>
|
|
61
|
+
<li><a href="#user">User</a></li>
|
|
62
|
+
</ul>
|
|
63
|
+
|
|
64
|
+
<h2 id="app">App</h2>
|
|
65
|
+
|
|
66
|
+
<p>An app is a program to be deployed.</p>
|
|
67
|
+
|
|
68
|
+
<h3 id="properties">Properties</h3>
|
|
69
|
+
|
|
70
|
+
<ul>
|
|
71
|
+
<li>id
|
|
72
|
+
|
|
73
|
+
<ul>
|
|
74
|
+
<li>unique identifier of app</li>
|
|
75
|
+
<li>Example: <code>"01234567-89ab-cdef-0123-456789abcdef"</code></li>
|
|
76
|
+
<li>Type: string</li>
|
|
77
|
+
<li>Format: uuid</li>
|
|
78
|
+
<li>ReadOnly: true</li>
|
|
79
|
+
</ul></li>
|
|
80
|
+
<li>name
|
|
81
|
+
|
|
82
|
+
<ul>
|
|
83
|
+
<li>unique name of app</li>
|
|
84
|
+
<li>Example: <code>"example"</code></li>
|
|
85
|
+
<li>Type: string</li>
|
|
86
|
+
<li>Pattern: <code>/^[a-z][a-z0-9-]{3,50}$/</code></li>
|
|
87
|
+
</ul></li>
|
|
88
|
+
<li>private
|
|
89
|
+
|
|
90
|
+
<ul>
|
|
91
|
+
<li>true if this resource is private use</li>
|
|
92
|
+
<li>Example: <code>false</code></li>
|
|
93
|
+
<li>Type: boolean</li>
|
|
94
|
+
</ul></li>
|
|
95
|
+
<li>deleted_at
|
|
96
|
+
|
|
97
|
+
<ul>
|
|
98
|
+
<li>When this resource was deleted at</li>
|
|
99
|
+
<li>Example: <code>nil</code></li>
|
|
100
|
+
<li>Type: null</li>
|
|
101
|
+
</ul></li>
|
|
102
|
+
<li>user_ids
|
|
103
|
+
|
|
104
|
+
<ul>
|
|
105
|
+
<li>Type: array</li>
|
|
106
|
+
</ul></li>
|
|
107
|
+
<li>users
|
|
108
|
+
|
|
109
|
+
<ul>
|
|
110
|
+
<li>Type: array</li>
|
|
111
|
+
</ul></li>
|
|
112
|
+
</ul>
|
|
113
|
+
|
|
114
|
+
<h3 id="post-apps">POST /apps</h3>
|
|
115
|
+
|
|
116
|
+
<p>Create a new app.</p>
|
|
117
|
+
|
|
118
|
+
<ul>
|
|
119
|
+
<li>name
|
|
120
|
+
|
|
121
|
+
<ul>
|
|
122
|
+
<li>unique name of app</li>
|
|
123
|
+
<li>Example: <code>"example"</code></li>
|
|
124
|
+
<li>Type: string</li>
|
|
125
|
+
<li>Pattern: <code>/^[a-z][a-z0-9-]{3,50}$/</code></li>
|
|
126
|
+
</ul></li>
|
|
127
|
+
</ul>
|
|
128
|
+
|
|
129
|
+
<pre><code>POST /apps HTTP/1.1
|
|
130
|
+
Content-Type: application/json
|
|
131
|
+
Host: api.example.com
|
|
132
|
+
|
|
133
|
+
{
|
|
134
|
+
"name": "example"
|
|
135
|
+
}
|
|
136
|
+
</code></pre>
|
|
137
|
+
|
|
138
|
+
<pre><code>HTTP/1.1 201 Created
|
|
139
|
+
Content-Type: application/json
|
|
140
|
+
|
|
141
|
+
{
|
|
142
|
+
"id": "01234567-89ab-cdef-0123-456789abcdef",
|
|
143
|
+
"name": "example",
|
|
144
|
+
"private": false,
|
|
145
|
+
"deleted_at": null,
|
|
146
|
+
"user_ids": [
|
|
147
|
+
1
|
|
148
|
+
],
|
|
149
|
+
"users": [
|
|
150
|
+
{
|
|
151
|
+
"name": "alice"
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
</code></pre>
|
|
156
|
+
|
|
157
|
+
<h3 id="delete-apps-id">DELETE /apps/:id</h3>
|
|
158
|
+
|
|
159
|
+
<p>Delete an existing app.</p>
|
|
160
|
+
|
|
161
|
+
<pre><code>DELETE /apps/01234567-89ab-cdef-0123-456789abcdef HTTP/1.1
|
|
162
|
+
Host: api.example.com
|
|
163
|
+
</code></pre>
|
|
164
|
+
|
|
165
|
+
<pre><code>HTTP/1.1 204 No Content
|
|
166
|
+
</code></pre>
|
|
167
|
+
|
|
168
|
+
<h3 id="get-apps-id">GET /apps/:id</h3>
|
|
169
|
+
|
|
170
|
+
<p>Info for existing app.</p>
|
|
171
|
+
|
|
172
|
+
<pre><code>GET /apps/01234567-89ab-cdef-0123-456789abcdef HTTP/1.1
|
|
173
|
+
Host: api.example.com
|
|
174
|
+
</code></pre>
|
|
175
|
+
|
|
176
|
+
<pre><code>HTTP/1.1 200 OK
|
|
177
|
+
Content-Type: application/json
|
|
178
|
+
|
|
179
|
+
{
|
|
180
|
+
"id": "01234567-89ab-cdef-0123-456789abcdef",
|
|
181
|
+
"name": "example",
|
|
182
|
+
"private": false,
|
|
183
|
+
"deleted_at": null,
|
|
184
|
+
"user_ids": [
|
|
185
|
+
1
|
|
186
|
+
],
|
|
187
|
+
"users": [
|
|
188
|
+
{
|
|
189
|
+
"name": "alice"
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
</code></pre>
|
|
194
|
+
|
|
195
|
+
<h3 id="get-apps">GET /apps</h3>
|
|
196
|
+
|
|
197
|
+
<p>List existing apps.</p>
|
|
198
|
+
|
|
199
|
+
<pre><code>GET /apps HTTP/1.1
|
|
200
|
+
Host: api.example.com
|
|
201
|
+
</code></pre>
|
|
202
|
+
|
|
203
|
+
<pre><code>HTTP/1.1 200 OK
|
|
204
|
+
Content-Type: application/json
|
|
205
|
+
|
|
206
|
+
[
|
|
207
|
+
{
|
|
208
|
+
"id": "01234567-89ab-cdef-0123-456789abcdef",
|
|
209
|
+
"name": "example",
|
|
210
|
+
"private": false,
|
|
211
|
+
"deleted_at": null,
|
|
212
|
+
"user_ids": [
|
|
213
|
+
1
|
|
214
|
+
],
|
|
215
|
+
"users": [
|
|
216
|
+
{
|
|
217
|
+
"name": "alice"
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
</code></pre>
|
|
223
|
+
|
|
224
|
+
<h3 id="patch-apps-id">PATCH /apps/:id</h3>
|
|
225
|
+
|
|
226
|
+
<p>Update an existing app.</p>
|
|
227
|
+
|
|
228
|
+
<ul>
|
|
229
|
+
<li>name
|
|
230
|
+
|
|
231
|
+
<ul>
|
|
232
|
+
<li>unique name of app</li>
|
|
233
|
+
<li>Example: <code>"example"</code></li>
|
|
234
|
+
<li>Type: string</li>
|
|
235
|
+
<li>Pattern: <code>/^[a-z][a-z0-9-]{3,50}$/</code></li>
|
|
236
|
+
</ul></li>
|
|
237
|
+
</ul>
|
|
238
|
+
|
|
239
|
+
<pre><code>PATCH /apps/01234567-89ab-cdef-0123-456789abcdef HTTP/1.1
|
|
240
|
+
Content-Type: application/json
|
|
241
|
+
Host: api.example.com
|
|
242
|
+
|
|
243
|
+
{
|
|
244
|
+
"name": "example"
|
|
245
|
+
}
|
|
246
|
+
</code></pre>
|
|
247
|
+
|
|
248
|
+
<pre><code>HTTP/1.1 200 OK
|
|
249
|
+
Content-Type: application/json
|
|
250
|
+
|
|
251
|
+
{
|
|
252
|
+
"id": "01234567-89ab-cdef-0123-456789abcdef",
|
|
253
|
+
"name": "example",
|
|
254
|
+
"private": false,
|
|
255
|
+
"deleted_at": null,
|
|
256
|
+
"user_ids": [
|
|
257
|
+
1
|
|
258
|
+
],
|
|
259
|
+
"users": [
|
|
260
|
+
{
|
|
261
|
+
"name": "alice"
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
</code></pre>
|
|
266
|
+
|
|
267
|
+
<h3 id="post-apps-id-files">POST /apps/:id/files</h3>
|
|
268
|
+
|
|
269
|
+
<p>Upload an attachment file for an app</p>
|
|
270
|
+
|
|
271
|
+
<ul>
|
|
272
|
+
<li>file
|
|
273
|
+
|
|
274
|
+
<ul>
|
|
275
|
+
<li>an attachment of app</li>
|
|
276
|
+
<li>Example: <code>"... contents of file ..."</code></li>
|
|
277
|
+
<li>Type: string</li>
|
|
278
|
+
</ul></li>
|
|
279
|
+
</ul>
|
|
280
|
+
|
|
281
|
+
<pre><code>POST /apps/01234567-89ab-cdef-0123-456789abcdef/files HTTP/1.1
|
|
282
|
+
Content-Type: multipart/form-data; boundary=---BoundaryX
|
|
283
|
+
Host: api.example.com
|
|
284
|
+
|
|
285
|
+
-----BoundaryX
|
|
286
|
+
Content-Disposition: form-data; name="[file]"
|
|
287
|
+
|
|
288
|
+
... contents of file ...
|
|
289
|
+
|
|
290
|
+
-----BoundaryX--
|
|
291
|
+
</code></pre>
|
|
292
|
+
|
|
293
|
+
<pre><code>HTTP/1.1 201 Created
|
|
294
|
+
Content-Type: application/json
|
|
295
|
+
|
|
296
|
+
{
|
|
297
|
+
"id": "01234567-89ab-cdef-0123-456789abcdef",
|
|
298
|
+
"name": "example",
|
|
299
|
+
"private": false,
|
|
300
|
+
"deleted_at": null,
|
|
301
|
+
"user_ids": [
|
|
302
|
+
1
|
|
303
|
+
],
|
|
304
|
+
"users": [
|
|
305
|
+
{
|
|
306
|
+
"name": "alice"
|
|
307
|
+
}
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
</code></pre>
|
|
311
|
+
|
|
312
|
+
<h2 id="recipe">Recipe</h2>
|
|
313
|
+
|
|
314
|
+
<h3 id="properties">Properties</h3>
|
|
315
|
+
|
|
316
|
+
<ul>
|
|
317
|
+
<li>name
|
|
318
|
+
|
|
319
|
+
<ul>
|
|
320
|
+
<li>Example: <code>"Sushi"</code></li>
|
|
321
|
+
</ul></li>
|
|
322
|
+
<li>user
|
|
323
|
+
|
|
324
|
+
<ul>
|
|
325
|
+
<li>Type: object</li>
|
|
326
|
+
</ul></li>
|
|
327
|
+
</ul>
|
|
328
|
+
|
|
329
|
+
<h3 id="get-recipes">GET /recipes</h3>
|
|
330
|
+
|
|
331
|
+
<p>List recipes</p>
|
|
332
|
+
|
|
333
|
+
<pre><code>GET /recipes HTTP/1.1
|
|
334
|
+
Host: api.example.com
|
|
335
|
+
</code></pre>
|
|
336
|
+
|
|
337
|
+
<pre><code>HTTP/1.1 200 OK
|
|
338
|
+
Content-Type: application/json
|
|
339
|
+
|
|
340
|
+
[
|
|
341
|
+
{
|
|
342
|
+
"name": "Sushi",
|
|
343
|
+
"user": {
|
|
344
|
+
"name": "alice"
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
]
|
|
348
|
+
</code></pre>
|
|
349
|
+
|
|
350
|
+
<h2 id="user">User</h2>
|
|
351
|
+
|
|
352
|
+
<h3 id="properties">Properties</h3>
|
|
353
|
+
|
|
354
|
+
<ul>
|
|
355
|
+
<li>name
|
|
356
|
+
|
|
357
|
+
<ul>
|
|
358
|
+
<li>Example: <code>"alice"</code></li>
|
|
359
|
+
<li>Type: string</li>
|
|
360
|
+
</ul></li>
|
|
361
|
+
</ul>
|
|
362
|
+
|
|
363
|
+
</body>
|
|
364
|
+
</html>
|
data/jdoc.gemspec
CHANGED
|
@@ -17,12 +17,12 @@ Gem::Specification.new do |spec|
|
|
|
17
17
|
spec.require_paths = ["lib"]
|
|
18
18
|
|
|
19
19
|
spec.add_dependency "activesupport"
|
|
20
|
-
spec.add_dependency "
|
|
20
|
+
spec.add_dependency "erubi"
|
|
21
21
|
spec.add_dependency "json_schema"
|
|
22
22
|
spec.add_dependency "rack"
|
|
23
23
|
spec.add_dependency "redcarpet"
|
|
24
|
-
spec.add_development_dependency "bundler", "
|
|
24
|
+
spec.add_development_dependency "bundler", ">= 1.6"
|
|
25
25
|
spec.add_development_dependency "pry"
|
|
26
|
-
spec.add_development_dependency "rake"
|
|
27
|
-
spec.add_development_dependency "rspec", "2.14.1"
|
|
26
|
+
spec.add_development_dependency "rake", ">= 13.2.0"
|
|
27
|
+
spec.add_development_dependency "rspec", ">= 2.14.1"
|
|
28
28
|
end
|
data/lib/jdoc/generator.rb
CHANGED
|
@@ -5,8 +5,8 @@ module Jdoc
|
|
|
5
5
|
|
|
6
6
|
# Utility wrapper for Jdoc::Generator#call
|
|
7
7
|
# @return [String]
|
|
8
|
-
def self.call(*args)
|
|
9
|
-
new(*args).call
|
|
8
|
+
def self.call(*args, **kwargs)
|
|
9
|
+
new(*args, **kwargs).call
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
# @param schema [Hash] JSON Schema represented as a Hash
|
|
@@ -24,10 +24,10 @@ module Jdoc
|
|
|
24
24
|
# @note Add some fix to adapt to GitHub anchor style
|
|
25
25
|
# @return [String] Generated text
|
|
26
26
|
def call
|
|
27
|
-
markdown =
|
|
27
|
+
markdown = render_erb(markdown_template, schema: schema)
|
|
28
28
|
if @html
|
|
29
29
|
html = markdown_parser.render(markdown)
|
|
30
|
-
html =
|
|
30
|
+
html = render_erb(html_template, body: html)
|
|
31
31
|
html.gsub(/id="(.+)"/) {|text| text.tr("/:", "") }
|
|
32
32
|
else
|
|
33
33
|
markdown
|
|
@@ -38,9 +38,11 @@ module Jdoc
|
|
|
38
38
|
|
|
39
39
|
private
|
|
40
40
|
|
|
41
|
-
# @return [
|
|
42
|
-
def
|
|
43
|
-
|
|
41
|
+
# @return [String]
|
|
42
|
+
def render_erb(template, **variables)
|
|
43
|
+
b = binding
|
|
44
|
+
variables.each { |k, v| b.local_variable_set(k, v) }
|
|
45
|
+
eval(Erubi::Engine.new(template).src, b)
|
|
44
46
|
end
|
|
45
47
|
|
|
46
48
|
# @returns [String] Path to ERB template to render HTML
|
|
@@ -66,11 +68,6 @@ module Jdoc
|
|
|
66
68
|
)
|
|
67
69
|
end
|
|
68
70
|
|
|
69
|
-
# @return [Erubis::Eruby] Renderer to render Markdown that takes schema data
|
|
70
|
-
def markdown_renderer
|
|
71
|
-
Erubis::Eruby.new(markdown_template)
|
|
72
|
-
end
|
|
73
|
-
|
|
74
71
|
# @return [String] Content of specified Markdown template
|
|
75
72
|
def markdown_template
|
|
76
73
|
File.read(markdown_template_path)
|
data/lib/jdoc/version.rb
CHANGED
data/lib/jdoc.rb
CHANGED
data/spec/jdoc/generator_spec.rb
CHANGED
|
@@ -19,5 +19,15 @@ describe Jdoc::Generator do
|
|
|
19
19
|
it "returns a String of API documentation in Markdown from given JSON Schema" do
|
|
20
20
|
should == File.read(File.expand_path("../../../example-api-documentation.md", __FILE__))
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
context "with html: true" do
|
|
24
|
+
subject do
|
|
25
|
+
described_class.call(schema, html: true)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "returns a String of API documentation in HTML from given JSON Schema" do
|
|
29
|
+
should == File.read(File.expand_path("../../../example-api-documentation.html", __FILE__))
|
|
30
|
+
end
|
|
31
|
+
end
|
|
22
32
|
end
|
|
23
33
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jdoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryo Nakamura
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activesupport
|
|
@@ -25,7 +24,7 @@ dependencies:
|
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
25
|
version: '0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
27
|
+
name: erubi
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
30
|
- - ">="
|
|
@@ -84,14 +83,14 @@ dependencies:
|
|
|
84
83
|
name: bundler
|
|
85
84
|
requirement: !ruby/object:Gem::Requirement
|
|
86
85
|
requirements:
|
|
87
|
-
- - "
|
|
86
|
+
- - ">="
|
|
88
87
|
- !ruby/object:Gem::Version
|
|
89
88
|
version: '1.6'
|
|
90
89
|
type: :development
|
|
91
90
|
prerelease: false
|
|
92
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
92
|
requirements:
|
|
94
|
-
- - "
|
|
93
|
+
- - ">="
|
|
95
94
|
- !ruby/object:Gem::Version
|
|
96
95
|
version: '1.6'
|
|
97
96
|
- !ruby/object:Gem::Dependency
|
|
@@ -114,29 +113,28 @@ dependencies:
|
|
|
114
113
|
requirements:
|
|
115
114
|
- - ">="
|
|
116
115
|
- !ruby/object:Gem::Version
|
|
117
|
-
version:
|
|
116
|
+
version: 13.2.0
|
|
118
117
|
type: :development
|
|
119
118
|
prerelease: false
|
|
120
119
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
120
|
requirements:
|
|
122
121
|
- - ">="
|
|
123
122
|
- !ruby/object:Gem::Version
|
|
124
|
-
version:
|
|
123
|
+
version: 13.2.0
|
|
125
124
|
- !ruby/object:Gem::Dependency
|
|
126
125
|
name: rspec
|
|
127
126
|
requirement: !ruby/object:Gem::Requirement
|
|
128
127
|
requirements:
|
|
129
|
-
- -
|
|
128
|
+
- - ">="
|
|
130
129
|
- !ruby/object:Gem::Version
|
|
131
130
|
version: 2.14.1
|
|
132
131
|
type: :development
|
|
133
132
|
prerelease: false
|
|
134
133
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
134
|
requirements:
|
|
136
|
-
- -
|
|
135
|
+
- - ">="
|
|
137
136
|
- !ruby/object:Gem::Version
|
|
138
137
|
version: 2.14.1
|
|
139
|
-
description:
|
|
140
138
|
email:
|
|
141
139
|
- r7kamura@gmail.com
|
|
142
140
|
executables:
|
|
@@ -144,13 +142,19 @@ executables:
|
|
|
144
142
|
extensions: []
|
|
145
143
|
extra_rdoc_files: []
|
|
146
144
|
files:
|
|
145
|
+
- ".github/release.yml"
|
|
146
|
+
- ".github/workflows/bump-request.yml"
|
|
147
|
+
- ".github/workflows/ci.yml"
|
|
148
|
+
- ".github/workflows/github-label-sync.yml"
|
|
149
|
+
- ".github/workflows/release.yml"
|
|
147
150
|
- ".gitignore"
|
|
148
|
-
- CHANGELOG.md
|
|
149
151
|
- Gemfile
|
|
152
|
+
- Gemfile.lock
|
|
150
153
|
- LICENSE.txt
|
|
151
154
|
- README.md
|
|
152
155
|
- Rakefile
|
|
153
156
|
- bin/jdoc
|
|
157
|
+
- example-api-documentation.html
|
|
154
158
|
- example-api-documentation.md
|
|
155
159
|
- jdoc.gemspec
|
|
156
160
|
- lib/jdoc.rb
|
|
@@ -170,7 +174,6 @@ homepage: https://github.com/r7kamura/jdoc
|
|
|
170
174
|
licenses:
|
|
171
175
|
- MIT
|
|
172
176
|
metadata: {}
|
|
173
|
-
post_install_message:
|
|
174
177
|
rdoc_options: []
|
|
175
178
|
require_paths:
|
|
176
179
|
- lib
|
|
@@ -185,9 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
185
188
|
- !ruby/object:Gem::Version
|
|
186
189
|
version: '0'
|
|
187
190
|
requirements: []
|
|
188
|
-
|
|
189
|
-
rubygems_version: 2.5.2
|
|
190
|
-
signing_key:
|
|
191
|
+
rubygems_version: 3.6.9
|
|
191
192
|
specification_version: 4
|
|
192
193
|
summary: Generate API documentation from JSON Schema.
|
|
193
194
|
test_files:
|
data/CHANGELOG.md
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
## 0.4.3
|
|
2
|
-
|
|
3
|
-
- Add some CLI options (Thx @k1LoW)
|
|
4
|
-
|
|
5
|
-
## 0.4.2
|
|
6
|
-
|
|
7
|
-
- Show reason phrase in response example (Thx @minodisk)
|
|
8
|
-
|
|
9
|
-
## 0.4.1
|
|
10
|
-
|
|
11
|
-
- Use 204 for `mediaType: "null"`
|
|
12
|
-
|
|
13
|
-
## 0.4.0
|
|
14
|
-
|
|
15
|
-
- Recognize `mediaType: 'null'` as "No response body"
|
|
16
|
-
|
|
17
|
-
## 0.3.4
|
|
18
|
-
|
|
19
|
-
- Treat empty request parameters as no request body
|
|
20
|
-
|
|
21
|
-
## 0.3.3
|
|
22
|
-
|
|
23
|
-
- Improve pattern format in properties section
|
|
24
|
-
|
|
25
|
-
## 0.3.2
|
|
26
|
-
|
|
27
|
-
- Add generator options to change template
|
|
28
|
-
- Add request parameters for each endpoint
|
|
29
|
-
|
|
30
|
-
## 0.3.1
|
|
31
|
-
|
|
32
|
-
- Add error handling for ExampleNotFound
|
|
33
|
-
|
|
34
|
-
## 0.3.0
|
|
35
|
-
|
|
36
|
-
- Change example response status and body to PUT & DELETE requests
|
|
37
|
-
- Improve request path example by resolving variable in path
|
|
38
|
-
|
|
39
|
-
## 0.2.1
|
|
40
|
-
|
|
41
|
-
- Support multipart/form-data
|
|
42
|
-
|
|
43
|
-
## 0.2.0
|
|
44
|
-
|
|
45
|
-
- Show schema description on docs if exists
|
|
46
|
-
|
|
47
|
-
## 0.1.9
|
|
48
|
-
|
|
49
|
-
- Support property that has no type
|
|
50
|
-
|
|
51
|
-
## 0.1.8
|
|
52
|
-
|
|
53
|
-
- Support property that is an array of primitive values
|
|
54
|
-
|
|
55
|
-
## 0.1.7
|
|
56
|
-
|
|
57
|
-
- Support query string example in GET request
|
|
58
|
-
- Improve the description property visibility
|
|
59
|
-
|
|
60
|
-
## 0.1.6
|
|
61
|
-
|
|
62
|
-
- Disable `<em>` feature of Redcarpet
|
|
63
|
-
|
|
64
|
-
## 0.1.5
|
|
65
|
-
|
|
66
|
-
- Fix ToC link on HTML docs
|
|
67
|
-
|
|
68
|
-
## 0.1.4
|
|
69
|
-
|
|
70
|
-
- Provide :html option to render docs in HTML
|
|
71
|
-
|
|
72
|
-
## 0.1.3
|
|
73
|
-
|
|
74
|
-
- Use its pointer name if a resource has no title property
|
|
75
|
-
|
|
76
|
-
## 0.1.2
|
|
77
|
-
|
|
78
|
-
- Use .schema property for request body if exists
|
|
79
|
-
- Improve array resource handling
|
|
80
|
-
|
|
81
|
-
## 0.1.1
|
|
82
|
-
|
|
83
|
-
- Support has-one relation
|
|
84
|
-
|
|
85
|
-
## 0.1.0
|
|
86
|
-
|
|
87
|
-
- Show resources which have no links
|
|
88
|
-
|
|
89
|
-
## 0.0.9
|
|
90
|
-
|
|
91
|
-
- Support array property
|
|
92
|
-
|
|
93
|
-
## 0.0.8
|
|
94
|
-
|
|
95
|
-
- Fix resource equality
|
|
96
|
-
|
|
97
|
-
## 0.0.7
|
|
98
|
-
|
|
99
|
-
- Support `false` & `null` example value
|
|
100
|
-
|
|
101
|
-
## 0.0.6
|
|
102
|
-
|
|
103
|
-
- Use root API endpoint at example response
|
|
104
|
-
|
|
105
|
-
## 0.0.5
|
|
106
|
-
|
|
107
|
-
- Remove dependency on multi_json
|
|
108
|
-
|
|
109
|
-
## 0.0.4
|
|
110
|
-
|
|
111
|
-
- Support whitespace and multiple templates in href
|
|
112
|
-
|
|
113
|
-
## 0.0.3
|
|
114
|
-
|
|
115
|
-
- Fix missing gem dependencies
|
|
116
|
-
|
|
117
|
-
## 0.0.2
|
|
118
|
-
|
|
119
|
-
- Remove dependency on rack-spec
|
|
120
|
-
|
|
121
|
-
## 0.0.1
|
|
122
|
-
|
|
123
|
-
- 1st Release
|