json-schema-docs 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +48 -9
- data/Rakefile +1 -8
- data/json-schema-docs.gemspec +11 -0
- data/lib/json-schema-docs.rb +1 -0
- data/lib/json-schema-docs/configuration.rb +25 -2
- data/lib/json-schema-docs/generator.rb +93 -21
- data/lib/json-schema-docs/helpers.rb +17 -1
- data/lib/json-schema-docs/landing_pages/index.md +7 -0
- data/lib/json-schema-docs/layouts/assets/_sass/_content.scss +518 -0
- data/lib/json-schema-docs/layouts/assets/_sass/_header.scss +59 -0
- data/lib/json-schema-docs/layouts/assets/_sass/_links.scss +33 -0
- data/lib/json-schema-docs/layouts/assets/_sass/_normalize.scss +127 -0
- data/lib/json-schema-docs/layouts/assets/_sass/_resource.scss +23 -0
- data/lib/json-schema-docs/layouts/assets/_sass/_sidebar.scss +75 -0
- data/lib/json-schema-docs/layouts/assets/css/screen.scss +32 -0
- data/lib/json-schema-docs/layouts/default.html.erb +43 -0
- data/lib/json-schema-docs/layouts/includes/{example.md.erb → curl_example.html.erb} +3 -3
- data/lib/json-schema-docs/layouts/includes/resource_example.html.erb +3 -0
- data/lib/json-schema-docs/layouts/includes/{response.md.erb → response.html.erb} +5 -5
- data/lib/json-schema-docs/layouts/includes/sidebar.html.erb +31 -0
- data/lib/json-schema-docs/layouts/links.html.erb +73 -0
- data/lib/json-schema-docs/layouts/resource.html.erb +42 -0
- data/lib/json-schema-docs/parser.rb +12 -6
- data/lib/json-schema-docs/renderer.rb +67 -0
- data/lib/json-schema-docs/version.rb +1 -1
- metadata +144 -6
- data/lib/json-schema-docs/layouts/endpoint.md.erb +0 -39
- data/lib/json-schema-docs/layouts/object.md.erb +0 -17
@@ -0,0 +1,59 @@
|
|
1
|
+
#top-nav {
|
2
|
+
height: 30px;
|
3
|
+
line-height: 30px;
|
4
|
+
background-color: #27272b;
|
5
|
+
a {
|
6
|
+
text-decoration: none;
|
7
|
+
}
|
8
|
+
}
|
9
|
+
#top-nav-links {
|
10
|
+
list-style-type: none;
|
11
|
+
position: absolute;
|
12
|
+
top: 0;
|
13
|
+
right: 30px;
|
14
|
+
li {
|
15
|
+
float: left;
|
16
|
+
margin-left: 20px;
|
17
|
+
}
|
18
|
+
a {
|
19
|
+
display: inline-block;
|
20
|
+
height: 30px;
|
21
|
+
padding: 0 5px;
|
22
|
+
color: #fff;
|
23
|
+
font-size: 10px;
|
24
|
+
letter-spacing: 1.5px;
|
25
|
+
text-transform: uppercase;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
#site-nav {
|
29
|
+
position: relative;
|
30
|
+
height: 70px;
|
31
|
+
background-color: #fff;
|
32
|
+
border-bottom: 1px solid #eee;
|
33
|
+
padding: 14px 30px;
|
34
|
+
a {
|
35
|
+
vertical-align: bottom;
|
36
|
+
}
|
37
|
+
span {
|
38
|
+
vertical-align: bottom;
|
39
|
+
}
|
40
|
+
select {
|
41
|
+
vertical-align: bottom;
|
42
|
+
}
|
43
|
+
.sub-title {
|
44
|
+
margin: 0 8px;
|
45
|
+
position: relative;
|
46
|
+
top: 1px;
|
47
|
+
}
|
48
|
+
.logo {
|
49
|
+
img {
|
50
|
+
height: 50px;
|
51
|
+
margin-bottom: -20px;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
.search-box {
|
55
|
+
position: absolute;
|
56
|
+
right: 30px;
|
57
|
+
top: 20px;
|
58
|
+
}
|
59
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
.link-copy-wrapper {
|
2
|
+
display: table;
|
3
|
+
width: 100%;
|
4
|
+
}
|
5
|
+
|
6
|
+
.link-properties {
|
7
|
+
display: table-cell;
|
8
|
+
width: 33%;
|
9
|
+
|
10
|
+
ul.link-properties-list li {
|
11
|
+
list-style: none;
|
12
|
+
}
|
13
|
+
|
14
|
+
span.link-properties-item-type {
|
15
|
+
color: gray;
|
16
|
+
text-transform: lowercase;
|
17
|
+
}
|
18
|
+
|
19
|
+
span.link-properties-required {
|
20
|
+
color: orange;
|
21
|
+
text-transform: lowercase;
|
22
|
+
}
|
23
|
+
|
24
|
+
span.link-properties-optional {
|
25
|
+
color: gray;
|
26
|
+
text-transform: lowercase;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
.link-example {
|
31
|
+
display: table-cell;
|
32
|
+
width: 64%;
|
33
|
+
}
|
@@ -0,0 +1,127 @@
|
|
1
|
+
* {
|
2
|
+
box-sizing: border-box;
|
3
|
+
}
|
4
|
+
html,
|
5
|
+
body,
|
6
|
+
div,
|
7
|
+
span,
|
8
|
+
applet,
|
9
|
+
object,
|
10
|
+
iframe,
|
11
|
+
h1,
|
12
|
+
h2,
|
13
|
+
h3,
|
14
|
+
h4,
|
15
|
+
h5,
|
16
|
+
h6,
|
17
|
+
p,
|
18
|
+
blockquote,
|
19
|
+
pre,
|
20
|
+
a,
|
21
|
+
abbr,
|
22
|
+
acronym,
|
23
|
+
address,
|
24
|
+
big,
|
25
|
+
cite,
|
26
|
+
code,
|
27
|
+
del,
|
28
|
+
dfn,
|
29
|
+
em,
|
30
|
+
img,
|
31
|
+
ins,
|
32
|
+
kbd,
|
33
|
+
q,
|
34
|
+
s,
|
35
|
+
samp,
|
36
|
+
small,
|
37
|
+
strike,
|
38
|
+
strong,
|
39
|
+
sub,
|
40
|
+
sup,
|
41
|
+
tt,
|
42
|
+
var,
|
43
|
+
b,
|
44
|
+
u,
|
45
|
+
i,
|
46
|
+
center,
|
47
|
+
dl,
|
48
|
+
dt,
|
49
|
+
dd,
|
50
|
+
ol,
|
51
|
+
ul,
|
52
|
+
li,
|
53
|
+
fieldset,
|
54
|
+
form,
|
55
|
+
label,
|
56
|
+
legend,
|
57
|
+
table,
|
58
|
+
caption,
|
59
|
+
tbody,
|
60
|
+
tfoot,
|
61
|
+
thead,
|
62
|
+
tr,
|
63
|
+
th,
|
64
|
+
td,
|
65
|
+
article,
|
66
|
+
aside,
|
67
|
+
canvas,
|
68
|
+
details,
|
69
|
+
embed,
|
70
|
+
figure,
|
71
|
+
figcaption,
|
72
|
+
footer,
|
73
|
+
header,
|
74
|
+
hgroup,
|
75
|
+
menu,
|
76
|
+
nav,
|
77
|
+
output,
|
78
|
+
ruby,
|
79
|
+
section,
|
80
|
+
summary,
|
81
|
+
time,
|
82
|
+
mark,
|
83
|
+
audio,
|
84
|
+
video {
|
85
|
+
margin: 0;
|
86
|
+
padding: 0;
|
87
|
+
border: 0;
|
88
|
+
font-size: 100%;
|
89
|
+
font: inherit;
|
90
|
+
vertical-align: baseline;
|
91
|
+
}
|
92
|
+
/* HTML5 display-role reset for older browsers */
|
93
|
+
article,
|
94
|
+
aside,
|
95
|
+
details,
|
96
|
+
figcaption,
|
97
|
+
figure,
|
98
|
+
footer,
|
99
|
+
header,
|
100
|
+
hgroup,
|
101
|
+
menu,
|
102
|
+
nav,
|
103
|
+
section {
|
104
|
+
display: block;
|
105
|
+
}
|
106
|
+
body {
|
107
|
+
line-height: 1;
|
108
|
+
}
|
109
|
+
ol,
|
110
|
+
ul {
|
111
|
+
list-style: none;
|
112
|
+
}
|
113
|
+
blockquote,
|
114
|
+
q {
|
115
|
+
quotes: none;
|
116
|
+
}
|
117
|
+
blockquote:before,
|
118
|
+
blockquote:after,
|
119
|
+
q:before,
|
120
|
+
q:after {
|
121
|
+
content: '';
|
122
|
+
content: none;
|
123
|
+
}
|
124
|
+
table {
|
125
|
+
border-collapse: collapse;
|
126
|
+
border-spacing: 0;
|
127
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
.resource-copy-wrapper {
|
2
|
+
display: table;
|
3
|
+
width: 100%;
|
4
|
+
}
|
5
|
+
|
6
|
+
.resource-attributes {
|
7
|
+
display: table-cell;
|
8
|
+
width: 33%;
|
9
|
+
|
10
|
+
ul.resource-attributes-list li {
|
11
|
+
list-style: none;
|
12
|
+
}
|
13
|
+
|
14
|
+
span.resource-attributes-item-type {
|
15
|
+
color: gray;
|
16
|
+
text-transform: lowercase;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
.resource-example {
|
21
|
+
display: table-cell;
|
22
|
+
width: 64%;
|
23
|
+
}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
#sidebar {
|
2
|
+
background-color: #fff;
|
3
|
+
position: fixed;
|
4
|
+
z-index: 2;
|
5
|
+
top: 30px;
|
6
|
+
left: 0;
|
7
|
+
bottom: 0;
|
8
|
+
width: 300px;
|
9
|
+
padding: 20px 30px;
|
10
|
+
overflow-x: hidden;
|
11
|
+
overflow-y: scroll;
|
12
|
+
-webkit-overflow-scrolling: touch;
|
13
|
+
-ms-overflow-style: none;
|
14
|
+
font-family: "ProximaNova-Semibold";
|
15
|
+
border-right: 1px solid #eee;
|
16
|
+
font-size: 16px;
|
17
|
+
line-height: 1.1em;
|
18
|
+
&::-webkit-scrollbar {
|
19
|
+
width: 0 !important;
|
20
|
+
}
|
21
|
+
li {
|
22
|
+
margin-bottom: 0.6em;
|
23
|
+
}
|
24
|
+
a {
|
25
|
+
color: #444;
|
26
|
+
text-decoration: none;
|
27
|
+
&:hover {
|
28
|
+
color: #de4f4f;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
a.current {
|
32
|
+
color: #de4f4f;
|
33
|
+
}
|
34
|
+
a.H2 {
|
35
|
+
font-weight: bold;
|
36
|
+
}
|
37
|
+
.categories {
|
38
|
+
> li {
|
39
|
+
> p {
|
40
|
+
margin-top: 1.5em;
|
41
|
+
border-top: 1px solid #eee;
|
42
|
+
text-transform: uppercase;
|
43
|
+
padding-top: 1.2em;
|
44
|
+
margin-bottom: 1em;
|
45
|
+
color: #999;
|
46
|
+
font-size: 0.8em;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
.sub-menu {
|
51
|
+
font-family: "ProximaNova-Regular";
|
52
|
+
padding-left: 20px;
|
53
|
+
margin: 0.6em 0;
|
54
|
+
font-size: 14px;
|
55
|
+
.active {
|
56
|
+
position: relative;
|
57
|
+
color: #de4f4f;
|
58
|
+
&:before {
|
59
|
+
content: "";
|
60
|
+
position: absolute;
|
61
|
+
top: 2px;
|
62
|
+
left: -15px;
|
63
|
+
display: inline-block;
|
64
|
+
width: 0;
|
65
|
+
height: 0;
|
66
|
+
border-top: 4px solid transparent;
|
67
|
+
border-bottom: 4px solid transparent;
|
68
|
+
border-left: 6px solid #de4f4f;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
ul.menu-subroot {
|
73
|
+
padding-left: 10px;
|
74
|
+
}
|
75
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
@charset "utf-8";
|
2
|
+
|
3
|
+
@import "../_sass/_normalize.scss";
|
4
|
+
|
5
|
+
body {
|
6
|
+
-webkit-font-smoothing: antialiased;
|
7
|
+
-moz-osx-font-smoothing: grayscale;
|
8
|
+
font-size: 16px;
|
9
|
+
font-weight: 400;
|
10
|
+
color: #444;
|
11
|
+
}
|
12
|
+
|
13
|
+
#wrap {
|
14
|
+
padding-top: 100px;
|
15
|
+
padding-left: 300px;
|
16
|
+
height: 100%;
|
17
|
+
}
|
18
|
+
#header {
|
19
|
+
position: fixed;
|
20
|
+
z-index: 2;
|
21
|
+
top: 0;
|
22
|
+
left: 0;
|
23
|
+
width: 100%;
|
24
|
+
height: 100px;
|
25
|
+
font-family: "ProximaNova-Semibold";
|
26
|
+
}
|
27
|
+
|
28
|
+
@import "../_sass/_header";
|
29
|
+
@import "../_sass/_sidebar";
|
30
|
+
@import "../_sass/_content";
|
31
|
+
@import "../_sass/_resource";
|
32
|
+
@import "../_sass/_links";
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<meta name="description" content="<%= name %> Reference documentation" />
|
6
|
+
<meta
|
7
|
+
name="viewport"
|
8
|
+
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
|
9
|
+
/>
|
10
|
+
<title><%= title || name %></title>
|
11
|
+
<link rel="stylesheet" href="<%= base_url %>/assets/style.css" />
|
12
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.2.2/anchor.min.js"></script>
|
13
|
+
<script>
|
14
|
+
// Add anchors on DOMContentLoaded
|
15
|
+
document.addEventListener("DOMContentLoaded", function(event) {
|
16
|
+
anchors.options = {
|
17
|
+
placement: "left",
|
18
|
+
visible: "hover",
|
19
|
+
icon: "¶"
|
20
|
+
};
|
21
|
+
anchors.add("h2, h3, h4, h5, h6, .anchored");
|
22
|
+
});
|
23
|
+
</script>
|
24
|
+
</head>
|
25
|
+
<body>
|
26
|
+
<div id="wrap">
|
27
|
+
<div id="header"></div>
|
28
|
+
<div id="sidebar">
|
29
|
+
<%= include.('sidebar.html.erb', name: name) %>
|
30
|
+
</div>
|
31
|
+
<div id="content">
|
32
|
+
<%= contents %>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<!-- mobile only -->
|
36
|
+
<div id="mobile-header">
|
37
|
+
<a class="menu-button"></a>
|
38
|
+
<a class="logo" href="<%= base_url.present? ? base_url : '/' %>"> </a>
|
39
|
+
</div>
|
40
|
+
<div id="mobile-shade"></div>
|
41
|
+
</div>
|
42
|
+
</body>
|
43
|
+
</html>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
<h2>Curl Example</h2>
|
2
2
|
|
3
|
-
|
3
|
+
<pre lang="bash">
|
4
4
|
$ curl -n <%= example[:request] -%><%- unless example[:http_headers].empty? %> \<%- end -%>
|
5
5
|
<%- if !example[:data].nil? %>
|
6
6
|
<%= example[:data] -%>
|
@@ -8,4 +8,4 @@ $ curl -n <%= example[:request] -%><%- unless example[:http_headers].empty? %> \
|
|
8
8
|
<%- example[:http_headers].each do |key, value| %>
|
9
9
|
-H "<%= key %>: <%= value %>"<%- if key != example[:http_headers].keys.last %> \<%- end -%>
|
10
10
|
<%- end %>
|
11
|
-
|
11
|
+
</pre>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<ul class="categories">
|
2
|
+
<li>
|
3
|
+
<ul class="menu-root">
|
4
|
+
<li>
|
5
|
+
<a href="<%= base_url.present? ? base_url : '/' %>">Reference</a>
|
6
|
+
</li>
|
7
|
+
</ul>
|
8
|
+
</li>
|
9
|
+
|
10
|
+
<li>
|
11
|
+
<p><a href="<%= base_url %>/types">Types</a></p>
|
12
|
+
<ul class="menu-root">
|
13
|
+
<% types.().each do |type| %>
|
14
|
+
<li>
|
15
|
+
<a
|
16
|
+
href="<%= base_url %>/resources/<%= type.downcase %>/"
|
17
|
+
class="sidebar-link<% if name == type %> current<% end %>"
|
18
|
+
>
|
19
|
+
<%= type %>
|
20
|
+
</a>
|
21
|
+
</li>
|
22
|
+
<% if name == type %>
|
23
|
+
<ul class="menu-subroot">
|
24
|
+
<% schemata.(name)['links'].each do |link| %>
|
25
|
+
<li class="menu-subroot-item"><a href="<%= base_url %>/resources/<%= type.downcase %>/links#link-<%= link['method'] %>-<%= link['title'] %>"><%= link['title'] %></a></li>
|
26
|
+
<% end %>
|
27
|
+
</ul>
|
28
|
+
<% end %> <% end %>
|
29
|
+
</ul>
|
30
|
+
</li>
|
31
|
+
</ul>
|