prmd 0.12.0 → 0.13.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 +4 -4
- data/README.md +2 -1
- data/docs/schemata.md +1 -0
- data/lib/prmd/core/renderer.rb +2 -1
- data/lib/prmd/rake_tasks/doc.rb +2 -0
- data/lib/prmd/templates/schema.erb +1 -0
- data/lib/prmd/templates/schemata/helper.erb +1 -1
- data/lib/prmd/templates/schemata/link.md.erb +1 -1
- data/lib/prmd/templates/table_of_contents.erb +9 -0
- data/lib/prmd/version.rb +1 -1
- data/schemas/interagent-hyper-schema.json +1 -1
- data/test/commands/render_test.rb +11 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 906209c8a327e103f1392faff3f4c7a35caac7b9
|
4
|
+
data.tar.gz: 42fbce50f4e8477a1a5c1607521b49101a37b349
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b246f23874af73656586f681cc2002ce8f37ba313ec128dc17ae4ee84814b641fd6bd42fd05007d4f040a289276b8be1fe7167990f6041b43c66ea2009339fb
|
7
|
+
data.tar.gz: 7bb6505cccc8df5313a2fd1b87411feac21ac4e7f126046be329a3a0d52e7bcd7f58428f66b8295c3583d5892d63b4f6b74c98499873031e8971f3cac302cede
|
data/README.md
CHANGED
@@ -129,7 +129,8 @@ Available options (and their defaults)
|
|
129
129
|
{
|
130
130
|
"doc": {
|
131
131
|
"url_style": "default", // can also be "json"
|
132
|
-
"disable_title_and_description": false // remove the title and the description, useful when using your own custom header
|
132
|
+
"disable_title_and_description": false, // remove the title and the description, useful when using your own custom header
|
133
|
+
"toc": false // insert the table of content for json scheme documentation to the top of the file. (default disable)
|
133
134
|
}
|
134
135
|
}
|
135
136
|
```
|
data/docs/schemata.md
CHANGED
data/lib/prmd/core/renderer.rb
CHANGED
data/lib/prmd/rake_tasks/doc.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
response_example = link['response_example']
|
4
4
|
link_schema_properties_template = Prmd::Template.load_template('link_schema_properties.md.erb', options[:template])
|
5
5
|
-%>
|
6
|
-
###
|
6
|
+
### <a name="link-<%= link['method'] %>-<%= resource %>-<%= link['href'] %>"><%= title %> <%= link['title'] %></a>
|
7
7
|
|
8
8
|
<%= link['description'] %>
|
9
9
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# The table of contents
|
2
|
+
<% schema['properties'].keys.sort.map do |key| %>
|
3
|
+
<% resource, property = key, schema['properties'][key] %>
|
4
|
+
<% _, schemata = schema.dereference(property) %>
|
5
|
+
- <a href="#resource-<%= resource %>"><%= schemata['title'].split(' - ', 2).last %></a>
|
6
|
+
<% schemata.fetch('links', []).each do |l| %>
|
7
|
+
- <a href="#link-<%= l['method'] %>-<%= resource %>-<%= l['href'] %>"><%= l['method'] %> <%= l['href'] %></a>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
data/lib/prmd/version.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
module Prmd
|
3
3
|
# Well, duh, its a Version module, what did you expect?
|
4
4
|
module Version
|
5
|
-
MAJOR, MINOR, TEENY, PATCH = 0,
|
5
|
+
MAJOR, MINOR, TEENY, PATCH = 0, 13, 0, nil
|
6
6
|
# version string
|
7
7
|
# @return [String]
|
8
8
|
STRING = [MAJOR, MINOR, TEENY, PATCH].compact.join('.').freeze
|
@@ -28,11 +28,20 @@ class InteragentRenderTest < Minitest::Test
|
|
28
28
|
def test_render_for_schema_with_property_defined_with_oneOf
|
29
29
|
markdown = render
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
assert_match(/\*\*options\/\[OPTION1\]\.type\*\*/, markdown)
|
32
|
+
assert_match(/\*\*options\/\[OPTION2\]\.type\*\*/, markdown)
|
33
33
|
end
|
34
34
|
|
35
|
+
def test_render_for_toc
|
36
|
+
schema = Prmd::Schema.new(data)
|
37
|
+
template = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'prmd', 'templates'))
|
38
|
+
markdown = Prmd.render(schema, template: template, doc: { toc: true })
|
35
39
|
|
40
|
+
assert_match /^# The table of contents/, markdown
|
41
|
+
assert_match '<a href="#resource-app"', markdown
|
42
|
+
assert_match '- <a href="#link-POST-app-/apps">POST /apps', markdown
|
43
|
+
assert_match '<a name="link-POST-app-/apps"', markdown
|
44
|
+
end
|
36
45
|
|
37
46
|
def test_render_for_example_as_an_array
|
38
47
|
# matches -d '[{...}]' taking into account line breaks and spacing
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prmd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- geemus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erubis
|
@@ -149,6 +149,7 @@ files:
|
|
149
149
|
- lib/prmd/templates/schemata/helper.erb
|
150
150
|
- lib/prmd/templates/schemata/link.md.erb
|
151
151
|
- lib/prmd/templates/schemata/link_curl_example.md.erb
|
152
|
+
- lib/prmd/templates/table_of_contents.erb
|
152
153
|
- lib/prmd/url_generator.rb
|
153
154
|
- lib/prmd/url_generators/generators/default.rb
|
154
155
|
- lib/prmd/url_generators/generators/json.rb
|