1
- ## Easy Usage
2
- No Build steps!, No Frameworks!, Just copy the below script in an html, and open it in a browser !!!
3
-
4
- ### Use from CDN
1
+ ## OpenAPI Spec Viewer
2
+
3
+ ### Features
4
+ - Supports swagger 2.0 and OpenAPI 3.0
5
+ - Works with any framework
6
+ - Allows to make API calls
7
+ - Better Usability,
8
+ - all Models and Examples are expanded by default, eliminates the need to click and reveal.
9
+ - Request fields are pre-populated with sample data
10
+ - Takes only one click to make an API call
11
+ - Request and response can be placed side-by-side for easy comparison
12
+ - Branding and Personalization features makes it easy to follow any style guide
13
+ - Comes with 2 Themes (Dark and Light)
14
+ - Replace default logo with yours
15
+ - Typography, allows changing fonts
16
+ - Allows changing text-color, button-color, header-color and color of other UI elements
17
+ - Plenty of customization options
18
+ - Add external contents at the top and bottom of the document, you may add tables, images, link, text, forms etc
19
+ - Allows disabling API calling feature
20
+ - Hide the header so the user cant load any other OpenAPI Spec
21
+ - Hide Authentication and provide your own pre-generated api-key
22
+ - Embed it inside another HTML document
23
+ - Use it inside another framework (react, vue, angular, lit-element)
24
+ - Programmatically control the element using JavaScript - change its attributes, and it will react to those changes
25
+ - Style the element with standard css (change padding, position, border, margin )
26
+ - Lightweight and fast (under 125 KB gzipped)
27
+ - Load local json spec from the disk
28
+
29
+ ### Quickstart (Use from CDN)
30
+ Just copy the below script in an html, and open it in a browser !!!
5
31
``` html
6
32
<html >
7
33
<head >
@@ -16,6 +42,94 @@ No Build steps!, No Frameworks!, Just copy the below script in an html, and open
16
42
</html >
17
43
```
18
44
45
+ ### Demo & Examples
46
+
47
+ - [ Basic Example] ( example1.html )
48
+ ``` html
49
+ <rapi-doc
50
+ spec-url =" https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"
51
+ > </rapi-doc >
52
+ ```
53
+
54
+ - [ Dark Theme] ( example2.html )
55
+ ``` html
56
+ <rapi-doc
57
+ spec-url =" https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"
58
+ theme =" dark"
59
+ > </rapi-doc >
60
+ ```
61
+
62
+ - [ Change Header Color with Dark Theme] ( example3.html )
63
+ ``` html
64
+ <rapi-doc
65
+ spec-url =" https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"
66
+ header-color =" #2d87e2"
67
+ theme =" dark"
68
+ > </rapi-doc >
69
+ ```
70
+
71
+ - [ Integrate with any HTML document (Request/Response one below the other)] ( example4.html )
72
+ ``` html
73
+ <rapi-doc
74
+ spec-url =" https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"
75
+ theme =' dark'
76
+ show-header =' false'
77
+ show-info =' false'
78
+ show-authentication =' false'
79
+ theme =' dark'
80
+ layout =" column"
81
+ > </rapi-doc >
82
+ ```
83
+
84
+ - [ Change Font (you may use local fonts or define your own font)] ( example5.html )
85
+ ``` html
86
+ <head >
87
+ <link href =" https://fonts.googleapis.com/css?family=Varela+Round" rel =" stylesheet" >
88
+ </head >
89
+ <body >
90
+ <rapi-doc
91
+ spec-url =" https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"
92
+ regular-font =" 'Varela Round', 'Arial Rounded MT Bold', 'Helvetica Rounded' "
93
+ > </rapi-doc >
94
+ </body >
95
+ ```
96
+
97
+ - [ Change Logo] ( example6.html )
98
+ ``` html
99
+ <body >
100
+ <rapi-doc spec-url =" https://api.apis.guru/v2/specs/googleapis.com/youtube/v3/swagger.json" >
101
+ <img slot =" logo" src =" https://img.icons8.com/color/48/000000/youtube-play.png" >
102
+ </rapi-doc >
103
+ </body >
104
+ ```
105
+
106
+ - [ Add HTML content inside the spec] ( example7.html )
107
+ ``` html
108
+ <body >
109
+ <rapi-doc spec-url =" https://api.apis.guru/v2/specs/googleapis.com/youtube/v3/swagger.json" >
110
+
111
+ <!-- content at the top -->
112
+ <p >This is an example to add external html content </li >
113
+ <p >Ypu may add </li >
114
+ <ul >
115
+ <li > Table </li >
116
+ <li > Text </li >
117
+ <li > Images </li >
118
+ <li > Links </li >
119
+ <li > any HTML content </li >
120
+ </ul >
121
+
122
+ <!-- content at the bottom -->
123
+ <p slot =" footer" > This content will apear at the bottom </p >
124
+ </rapi-doc >
125
+ </body >
126
+ ```
127
+
128
+
129
+
130
+ - [ Change Attributes using JavaScript] ( example100.html )
131
+ use javascript ` Element.setAttribute() ` to change the elements attributes and see it reacts to those changes
132
+
19
133
### Use in a HTML/JS based project
20
134
21
135
- In your project folder, install rapidoc from npm.
@@ -51,10 +165,6 @@ npm install http-server -g
51
165
52
166
- in your browser visit ``` http://localhost:9000/index.html ```
53
167
54
-
55
- ## Branding, Styling and Personalization
56
- Style the element using standard ` css ` . Apply borders, padding, width, height etc in accordance to your brand requierment. You can also use many attributes to effect the interface.
57
-
58
168
## Attributes
59
169
<table >
60
170
<tr><th>Attribute</th> <th>Description </th> <th>Default</th></tr>
@@ -104,57 +214,10 @@ Style the element using standard `css`. Apply borders, padding, width, height et
104
214
<tr><td>layout </td> <td>request/response placement (row, column)</td> <td>row</td></tr>
105
215
</table >
106
216
107
- ## Examples
108
-
109
- - [ Basic Example] ( example1.html )
110
- ``` html
111
- <rapi-doc
112
- spec-url =" https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"
113
- > </rapi-doc >
114
- ```
115
-
116
- - [ Dark Theme] ( example2.html )
117
- ``` html
118
- <rapi-doc
119
- spec-url =" https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"
120
- theme =" dark"
121
- > </rapi-doc >
122
- ```
123
-
124
- - [ Change Header Color with Dark Theme] ( example3.html )
125
- ``` html
126
- <rapi-doc
127
- spec-url =" https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"
128
- header-color =" #2d87e2"
129
- theme =" dark"
130
- > </rapi-doc >
131
- ```
132
-
133
- - [ Integrate with any HTML document (Request/Response one below the other)] ( example4.html )
134
- ``` html
135
- <rapi-doc
136
- spec-url =" https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"
137
- theme =' dark'
138
- show-header =' false'
139
- show-info =' false'
140
- show-authentication =' false'
141
- theme =' dark'
142
- layout =" column"
143
- > </rapi-doc >
144
- ```
145
-
146
- - [ Change Font (you may use local fonts or define your own font)] ( example5.html )
147
- ``` html
148
- <head >
149
- <link href =" https://fonts.googleapis.com/css?family=Varela+Round" rel =" stylesheet" >
150
- </head >
151
- <body >
152
- <rapi-doc
153
- spec-url =" https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"
154
- regular-font =" 'Varela Round', 'Arial Rounded MT Bold', 'Helvetica Rounded' "
155
- > </rapi-doc >
156
- </body >
157
- ```
158
-
159
- - [ Change Attributes using JavaScript] ( example6.html )
160
-
217
+ ## Slots
218
+ <table >
219
+ <tr ><th >Slot Name</th > <th >Description </th ></tr >
220
+ <tr ><td >(default)</td > <td >any content placed inside `<rapi-doc >` will be shown under the header </td > </tr >
221
+ <tr ><td >logo</td > <td >use this slot to replace the logo </td > </tr >
222
+ <tr ><td >footer</td > <td > The conents of this slot will appear at the bottom of the spec</td > </tr >
223
+ </table >
0 commit comments