jdoc 0.4.2 → 0.4.3
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 +4 -4
- data/CHANGELOG.md +33 -0
- data/README.md +1 -1
- data/bin/jdoc +24 -2
- data/lib/jdoc/link.rb +2 -2
- data/lib/jdoc/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bbc21692c07ab9fe470cc9bb20a30396e5305765
|
|
4
|
+
data.tar.gz: 3c48d113af68dd3e9b4157f005c16619edc7b1ab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a8eae9246f34f5cf66827f490ab48a99abf017597280f39269007c981a54b4dd9e062c513cda93ed098a140e03099e09ef880276a132350accabe4b41b5dbe3
|
|
7
|
+
data.tar.gz: 5e4cd2d1ef3dd61fb3e4d7617806b0c9c0fcf2eddd9f8e45025721690f59aa41366bbbf09f0efa8fc50835ca0c435d4d7c309e6c13301123279531da00825436
|
data/CHANGELOG.md
CHANGED
|
@@ -1,90 +1,123 @@
|
|
|
1
|
+
## 0.4.3
|
|
2
|
+
|
|
3
|
+
- Add some CLI options (Thx @k1LoW)
|
|
4
|
+
|
|
1
5
|
## 0.4.2
|
|
6
|
+
|
|
2
7
|
- Show reason phrase in response example (Thx @minodisk)
|
|
3
8
|
|
|
4
9
|
## 0.4.1
|
|
10
|
+
|
|
5
11
|
- Use 204 for `mediaType: "null"`
|
|
6
12
|
|
|
7
13
|
## 0.4.0
|
|
14
|
+
|
|
8
15
|
- Recognize `mediaType: 'null'` as "No response body"
|
|
9
16
|
|
|
10
17
|
## 0.3.4
|
|
18
|
+
|
|
11
19
|
- Treat empty request parameters as no request body
|
|
12
20
|
|
|
13
21
|
## 0.3.3
|
|
22
|
+
|
|
14
23
|
- Improve pattern format in properties section
|
|
15
24
|
|
|
16
25
|
## 0.3.2
|
|
26
|
+
|
|
17
27
|
- Add generator options to change template
|
|
18
28
|
- Add request parameters for each endpoint
|
|
19
29
|
|
|
20
30
|
## 0.3.1
|
|
31
|
+
|
|
21
32
|
- Add error handling for ExampleNotFound
|
|
22
33
|
|
|
23
34
|
## 0.3.0
|
|
35
|
+
|
|
24
36
|
- Change example response status and body to PUT & DELETE requests
|
|
25
37
|
- Improve request path example by resolving variable in path
|
|
26
38
|
|
|
27
39
|
## 0.2.1
|
|
40
|
+
|
|
28
41
|
- Support multipart/form-data
|
|
29
42
|
|
|
30
43
|
## 0.2.0
|
|
44
|
+
|
|
31
45
|
- Show schema description on docs if exists
|
|
32
46
|
|
|
33
47
|
## 0.1.9
|
|
48
|
+
|
|
34
49
|
- Support property that has no type
|
|
35
50
|
|
|
36
51
|
## 0.1.8
|
|
52
|
+
|
|
37
53
|
- Support property that is an array of primitive values
|
|
38
54
|
|
|
39
55
|
## 0.1.7
|
|
56
|
+
|
|
40
57
|
- Support query string example in GET request
|
|
41
58
|
- Improve the description property visibility
|
|
42
59
|
|
|
43
60
|
## 0.1.6
|
|
61
|
+
|
|
44
62
|
- Disable `<em>` feature of Redcarpet
|
|
45
63
|
|
|
46
64
|
## 0.1.5
|
|
65
|
+
|
|
47
66
|
- Fix ToC link on HTML docs
|
|
48
67
|
|
|
49
68
|
## 0.1.4
|
|
69
|
+
|
|
50
70
|
- Provide :html option to render docs in HTML
|
|
51
71
|
|
|
52
72
|
## 0.1.3
|
|
73
|
+
|
|
53
74
|
- Use its pointer name if a resource has no title property
|
|
54
75
|
|
|
55
76
|
## 0.1.2
|
|
77
|
+
|
|
56
78
|
- Use .schema property for request body if exists
|
|
57
79
|
- Improve array resource handling
|
|
58
80
|
|
|
59
81
|
## 0.1.1
|
|
82
|
+
|
|
60
83
|
- Support has-one relation
|
|
61
84
|
|
|
62
85
|
## 0.1.0
|
|
86
|
+
|
|
63
87
|
- Show resources which have no links
|
|
64
88
|
|
|
65
89
|
## 0.0.9
|
|
90
|
+
|
|
66
91
|
- Support array property
|
|
67
92
|
|
|
68
93
|
## 0.0.8
|
|
94
|
+
|
|
69
95
|
- Fix resource equality
|
|
70
96
|
|
|
71
97
|
## 0.0.7
|
|
98
|
+
|
|
72
99
|
- Support `false` & `null` example value
|
|
73
100
|
|
|
74
101
|
## 0.0.6
|
|
102
|
+
|
|
75
103
|
- Use root API endpoint at example response
|
|
76
104
|
|
|
77
105
|
## 0.0.5
|
|
106
|
+
|
|
78
107
|
- Remove dependency on multi_json
|
|
79
108
|
|
|
80
109
|
## 0.0.4
|
|
110
|
+
|
|
81
111
|
- Support whitespace and multiple templates in href
|
|
82
112
|
|
|
83
113
|
## 0.0.3
|
|
114
|
+
|
|
84
115
|
- Fix missing gem dependencies
|
|
85
116
|
|
|
86
117
|
## 0.0.2
|
|
118
|
+
|
|
87
119
|
- Remove dependency on rack-spec
|
|
88
120
|
|
|
89
121
|
## 0.0.1
|
|
122
|
+
|
|
90
123
|
- 1st Release
|
data/README.md
CHANGED
|
@@ -10,5 +10,5 @@ $ gem install jdoc
|
|
|
10
10
|
See [example-api-documentation.md](example-api-documentation.md) generated by the following command.
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
|
-
$ jdoc spec/fixtures/schema.
|
|
13
|
+
$ jdoc spec/fixtures/schema.yml > example-api-documentation.md
|
|
14
14
|
```
|
data/bin/jdoc
CHANGED
|
@@ -2,9 +2,26 @@
|
|
|
2
2
|
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
|
3
3
|
require "jdoc"
|
|
4
4
|
require "yaml"
|
|
5
|
+
require "optparse"
|
|
6
|
+
|
|
7
|
+
opt = OptionParser.new
|
|
8
|
+
banner = 'Usage: jdoc <schema.json or schema.yml> [options]'
|
|
9
|
+
opt.banner = banner
|
|
10
|
+
Version = Jdoc::VERSION
|
|
11
|
+
options = {
|
|
12
|
+
html: false,
|
|
13
|
+
html_template_path: nil,
|
|
14
|
+
markdown_template_path: nil
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
opt.on("--html") { |_| options[:html] = true }
|
|
18
|
+
opt.on("--html-template-path ERB_FILE") { |v| options[:html_template_path] = v }
|
|
19
|
+
opt.on("--markdown-template-path ERB_FILE") { |v| options[:markdown_template_path] = v }
|
|
20
|
+
|
|
21
|
+
opt.parse!(ARGV)
|
|
5
22
|
|
|
6
23
|
unless path = ARGV[0]
|
|
7
|
-
puts
|
|
24
|
+
puts banner
|
|
8
25
|
exit
|
|
9
26
|
end
|
|
10
27
|
|
|
@@ -16,4 +33,9 @@ else
|
|
|
16
33
|
schema = JSON.parse(str)
|
|
17
34
|
end
|
|
18
35
|
|
|
19
|
-
puts Jdoc::Generator.call(
|
|
36
|
+
puts Jdoc::Generator.call(
|
|
37
|
+
schema,
|
|
38
|
+
html: options[:html],
|
|
39
|
+
html_template_path: options[:html_template_path],
|
|
40
|
+
markdown_template_path: options[:markdown_template_path],
|
|
41
|
+
)
|
data/lib/jdoc/link.rb
CHANGED
|
@@ -55,7 +55,7 @@ module Jdoc
|
|
|
55
55
|
# @return [String] Request path name, defined at href property
|
|
56
56
|
# @note URI Template is replaced with placeholder
|
|
57
57
|
# @example
|
|
58
|
-
# link.path #=> "
|
|
58
|
+
# link.path #=> "/apps/:id"
|
|
59
59
|
def path
|
|
60
60
|
@path ||= @raw_link.href.gsub(/{(.+?)}/) do
|
|
61
61
|
":" + CGI.unescape($1).gsub(/[()\s]/, "").split("/").last
|
|
@@ -65,7 +65,7 @@ module Jdoc
|
|
|
65
65
|
# @returns [String] Path with embedded example variable
|
|
66
66
|
# @raise [Rack::Spec::Mock::ExampleNotFound]
|
|
67
67
|
# @example
|
|
68
|
-
# link.example_path #=> "
|
|
68
|
+
# link.example_path #=> "/apps/1"
|
|
69
69
|
def example_path
|
|
70
70
|
@example_path ||= @raw_link.href.gsub(/{\((.+?)\)}/) do
|
|
71
71
|
pointer = CGI.unescape($1)
|
data/lib/jdoc/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jdoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryo Nakamura
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-05-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
186
186
|
version: '0'
|
|
187
187
|
requirements: []
|
|
188
188
|
rubyforge_project:
|
|
189
|
-
rubygems_version: 2.
|
|
189
|
+
rubygems_version: 2.5.2
|
|
190
190
|
signing_key:
|
|
191
191
|
specification_version: 4
|
|
192
192
|
summary: Generate API documentation from JSON Schema.
|
|
@@ -194,4 +194,3 @@ test_files:
|
|
|
194
194
|
- spec/fixtures/schema.yml
|
|
195
195
|
- spec/jdoc/generator_spec.rb
|
|
196
196
|
- spec/spec_helper.rb
|
|
197
|
-
has_rdoc:
|