json-schema-docs 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd5892af89b1910f3b373a462c2fb4854cf1626b15031f44a7f3d5b6b7280c3d
4
- data.tar.gz: 65c3110d0ab1e4397fafca814423daae4bc5bf3c5e34bdb087c9fa346e0615f5
3
+ metadata.gz: 3049cd9fed945058bbd3d668f0cda02d75f50aa114ea0e93e7aa3ed17313011b
4
+ data.tar.gz: f247ed95de772c8461e7022dc12a1d922288cb9b85d4d259c2a904ccfb09bae3
5
5
  SHA512:
6
- metadata.gz: b9dbb7897d5d73835f56ad12cdbacf9e0aa14ba97a6e7ee04c630ba0158bac274cc03b8216102b2034ba580d49b54352b3bfe7f65a3254c30a6814e5b6eeb94d
7
- data.tar.gz: 98ba7a96d3e77c85d4ca35bf7f56254b35ad62cd6162978a3ce2d95bf20c35e3d9a2b17894a7457c1a8d625aa702ff255068eeaedfef5b71b6d601284c97b074
6
+ metadata.gz: ce9a9ef62d0216c5f7fb110850c71d2b1f9da4738f12eb204fa588d22078ba046361907b0594fb9fc8ec919fb52b16060f8c6ffd163d17251ceeeb60228f1b25
7
+ data.tar.gz: 180f02533338faa832fe751eea09c7cde31ee9abcb81e4d19b384bb09d3dc2a29313cc1e882b17a97497f01640b738906890666766d1964a08ec04eae7b702cf
data/.gitignore CHANGED
@@ -10,5 +10,5 @@
10
10
  /output/
11
11
  test/json-schema-docs/fixtures/output
12
12
  /.sass-cache/
13
- /output/
13
+ output/
14
14
  .byebug_history
@@ -24,10 +24,10 @@ module JsonSchemaDocs
24
24
 
25
25
  @parsed_schema.each_pair do |resource, schemata|
26
26
  %i(endpoint object).each do |type|
27
- contents = render(type, schemata)
27
+ contents = render(type, resource, schemata)
28
28
  write_file(type, resource, contents)
29
29
 
30
- contents = render(type, schemata)
30
+ contents = render(type, resource, schemata)
31
31
  write_file(type, resource, contents)
32
32
  end
33
33
  end
@@ -35,10 +35,11 @@ module JsonSchemaDocs
35
35
 
36
36
  private
37
37
 
38
- def render(type, schemata)
38
+ def render(type, resource, schemata)
39
39
  layout = instance_variable_get("@json_schema_#{type}_template")
40
40
  opts = @options.merge(helper_methods)
41
41
 
42
+ opts[:schemata_resource] = resource
42
43
  opts[:schemata] = schemata
43
44
  layout.result(OpenStruct.new(opts).instance_eval { binding })
44
45
  end
@@ -1,6 +1,6 @@
1
- # <a class="header-link" name="resource-<%= schemata['title'] %>"><%= schemata['title'] %></a>
1
+ # <a class="header-link" name="resource-<%= slugify.(schemata['title']) %>"><%= schemata['title'] %></a>
2
2
 
3
- <% (schemata['links'] || []).each do |link, datum| %>
3
+ <% schemata['links'].each do |link, datum| %>
4
4
 
5
5
  ## <a class="header-link" name="link-<%= link['method'] %>-<%= resource %>-<%= link['href'] %>"><%= schemata['title'] %> <%= link['title'] %></a>
6
6
 
@@ -44,8 +44,10 @@ module JsonSchemaDocs
44
44
  end
45
45
  end
46
46
 
47
+ schemata['links'] ||= []
48
+
47
49
  # establish full link description
48
- (schemata['links'] || []).each do |link, datum|
50
+ schemata['links'].each do |link, datum|
49
51
  link_path = build_link_path(@schema, link)
50
52
  response_example = link['response_example']
51
53
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module JsonSchemaDocs
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.1.1'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-schema-docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-02 00:00:00.000000000 Z
11
+ date: 2019-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prmd