jdoc 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d15231d47a686a9226e686f608bed11b376f3368
4
- data.tar.gz: 05a43e5ce89ec70fc444f7861fb9eec825f3990f
3
+ metadata.gz: bbc21692c07ab9fe470cc9bb20a30396e5305765
4
+ data.tar.gz: 3c48d113af68dd3e9b4157f005c16619edc7b1ab
5
5
  SHA512:
6
- metadata.gz: 23cce94dbe1d36ae3524d3fe06e7626a7ce79fffc87ac089041cac4521197ee301407226aa01de4dc6bc28da93a22e0eb6a18978a7092e41c39296377335f4a5
7
- data.tar.gz: 10c0212757b32120bef86909438ae78f15e198733bd49c4ab9ecffbb1cce1a876b476e603a04927911d12c68822888e5a8f9eafb165b2e78839fd6a995fff50f
6
+ metadata.gz: 5a8eae9246f34f5cf66827f490ab48a99abf017597280f39269007c981a54b4dd9e062c513cda93ed098a140e03099e09ef880276a132350accabe4b41b5dbe3
7
+ data.tar.gz: 5e4cd2d1ef3dd61fb3e4d7617806b0c9c0fcf2eddd9f8e45025721690f59aa41366bbbf09f0efa8fc50835ca0c435d4d7c309e6c13301123279531da00825436
@@ -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.json > example-api-documentation.md
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 "usage: #{$0} <schema.json or schema.yml>"
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(schema)
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
+ )
@@ -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 #=> "GET /apps/:id"
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 #=> "GET /apps/1"
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)
@@ -1,3 +1,3 @@
1
1
  module Jdoc
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
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.2
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: 2015-02-24 00:00:00.000000000 Z
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.2.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: