rapipdf 2.2.1 → 3.0.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.
Files changed (175) hide show
  1. package/README.md +66 -14
  2. package/dist/chunks/generate-BQLGaRvK.js +386 -0
  3. package/dist/chunks/generate-BQLGaRvK.js.LICENSE.txt +224 -0
  4. package/dist/chunks/localize-CRvDVkIz.js +8 -0
  5. package/dist/node.js +13096 -0
  6. package/dist/node.js.LICENSE.txt +195 -0
  7. package/dist/rapipdf-min.js +352 -90
  8. package/dist/rapipdf-min.js.LICENSE.txt +224 -0
  9. package/dist/rapipdf.js +69 -0
  10. package/package.json +58 -52
  11. package/src/node.d.ts +82 -0
  12. package/src/rapipdf.d.ts +50 -0
  13. package/.babelrc +0 -11
  14. package/.eslintrc +0 -28
  15. package/dist/index.html +0 -7
  16. package/dist/index.html.gz +0 -0
  17. package/dist/rapipdf-min.js.gz +0 -0
  18. package/dist/rapipdf-min.js.map +0 -1
  19. package/dist/rapipdf-min.js.map.gz +0 -0
  20. package/dist/report.html +0 -53
  21. package/docs/api.html +0 -285
  22. package/docs/examples/example1.html +0 -68
  23. package/docs/examples/list.html +0 -27
  24. package/docs/examples/rapidoc-regular.woff2 +0 -0
  25. package/docs/examples/rapidoc-semi-bold.woff2 +0 -0
  26. package/docs/examples/roboto-mono-bold.woff2 +0 -0
  27. package/docs/examples/roboto-mono-regular.woff2 +0 -0
  28. package/docs/highlight/CHANGES.md +0 -1803
  29. package/docs/highlight/LICENSE +0 -24
  30. package/docs/highlight/README.md +0 -188
  31. package/docs/highlight/README.ru.md +0 -142
  32. package/docs/highlight/highlight.pack.js +0 -2
  33. package/docs/highlight/styles/a11y-dark.css +0 -99
  34. package/docs/highlight/styles/a11y-light.css +0 -99
  35. package/docs/highlight/styles/agate.css +0 -108
  36. package/docs/highlight/styles/an-old-hope.css +0 -89
  37. package/docs/highlight/styles/androidstudio.css +0 -66
  38. package/docs/highlight/styles/arduino-light.css +0 -88
  39. package/docs/highlight/styles/arta.css +0 -73
  40. package/docs/highlight/styles/ascetic.css +0 -45
  41. package/docs/highlight/styles/atelier-cave-dark.css +0 -83
  42. package/docs/highlight/styles/atelier-cave-light.css +0 -85
  43. package/docs/highlight/styles/atelier-dune-dark.css +0 -69
  44. package/docs/highlight/styles/atelier-dune-light.css +0 -69
  45. package/docs/highlight/styles/atelier-estuary-dark.css +0 -84
  46. package/docs/highlight/styles/atelier-estuary-light.css +0 -84
  47. package/docs/highlight/styles/atelier-forest-dark.css +0 -69
  48. package/docs/highlight/styles/atelier-forest-light.css +0 -69
  49. package/docs/highlight/styles/atelier-heath-dark.css +0 -69
  50. package/docs/highlight/styles/atelier-heath-light.css +0 -69
  51. package/docs/highlight/styles/atelier-lakeside-dark.css +0 -69
  52. package/docs/highlight/styles/atelier-lakeside-light.css +0 -69
  53. package/docs/highlight/styles/atelier-plateau-dark.css +0 -84
  54. package/docs/highlight/styles/atelier-plateau-light.css +0 -84
  55. package/docs/highlight/styles/atelier-savanna-dark.css +0 -84
  56. package/docs/highlight/styles/atelier-savanna-light.css +0 -84
  57. package/docs/highlight/styles/atelier-seaside-dark.css +0 -69
  58. package/docs/highlight/styles/atelier-seaside-light.css +0 -69
  59. package/docs/highlight/styles/atelier-sulphurpool-dark.css +0 -69
  60. package/docs/highlight/styles/atelier-sulphurpool-light.css +0 -69
  61. package/docs/highlight/styles/atom-one-dark-reasonable.css +0 -77
  62. package/docs/highlight/styles/atom-one-dark.css +0 -96
  63. package/docs/highlight/styles/atom-one-light.css +0 -96
  64. package/docs/highlight/styles/brown-paper.css +0 -64
  65. package/docs/highlight/styles/brown-papersq.png +0 -0
  66. package/docs/highlight/styles/codepen-embed.css +0 -60
  67. package/docs/highlight/styles/color-brewer.css +0 -71
  68. package/docs/highlight/styles/darcula.css +0 -77
  69. package/docs/highlight/styles/dark.css +0 -63
  70. package/docs/highlight/styles/darkula.css +0 -6
  71. package/docs/highlight/styles/default.css +0 -99
  72. package/docs/highlight/styles/docco.css +0 -97
  73. package/docs/highlight/styles/dracula.css +0 -76
  74. package/docs/highlight/styles/far.css +0 -71
  75. package/docs/highlight/styles/foundation.css +0 -88
  76. package/docs/highlight/styles/github-gist.css +0 -71
  77. package/docs/highlight/styles/github.css +0 -99
  78. package/docs/highlight/styles/gml.css +0 -78
  79. package/docs/highlight/styles/googlecode.css +0 -89
  80. package/docs/highlight/styles/grayscale.css +0 -101
  81. package/docs/highlight/styles/gruvbox-dark.css +0 -108
  82. package/docs/highlight/styles/gruvbox-light.css +0 -108
  83. package/docs/highlight/styles/hopscotch.css +0 -83
  84. package/docs/highlight/styles/hybrid.css +0 -102
  85. package/docs/highlight/styles/idea.css +0 -97
  86. package/docs/highlight/styles/ir-black.css +0 -73
  87. package/docs/highlight/styles/isbl-editor-dark.css +0 -112
  88. package/docs/highlight/styles/isbl-editor-light.css +0 -112
  89. package/docs/highlight/styles/kimbie.dark.css +0 -74
  90. package/docs/highlight/styles/kimbie.light.css +0 -74
  91. package/docs/highlight/styles/lightfair.css +0 -87
  92. package/docs/highlight/styles/magula.css +0 -70
  93. package/docs/highlight/styles/mono-blue.css +0 -59
  94. package/docs/highlight/styles/monokai-sublime.css +0 -83
  95. package/docs/highlight/styles/monokai.css +0 -70
  96. package/docs/highlight/styles/nord.css +0 -309
  97. package/docs/highlight/styles/obsidian.css +0 -88
  98. package/docs/highlight/styles/ocean.css +0 -74
  99. package/docs/highlight/styles/paraiso-dark.css +0 -72
  100. package/docs/highlight/styles/paraiso-light.css +0 -72
  101. package/docs/highlight/styles/pojoaque.css +0 -83
  102. package/docs/highlight/styles/pojoaque.jpg +0 -0
  103. package/docs/highlight/styles/purebasic.css +0 -96
  104. package/docs/highlight/styles/qtcreator_dark.css +0 -83
  105. package/docs/highlight/styles/qtcreator_light.css +0 -83
  106. package/docs/highlight/styles/railscasts.css +0 -106
  107. package/docs/highlight/styles/rainbow.css +0 -85
  108. package/docs/highlight/styles/routeros.css +0 -108
  109. package/docs/highlight/styles/school-book.css +0 -72
  110. package/docs/highlight/styles/school-book.png +0 -0
  111. package/docs/highlight/styles/shades-of-purple.css +0 -97
  112. package/docs/highlight/styles/solarized-dark.css +0 -84
  113. package/docs/highlight/styles/solarized-light.css +0 -84
  114. package/docs/highlight/styles/sunburst.css +0 -102
  115. package/docs/highlight/styles/tomorrow-night-blue.css +0 -75
  116. package/docs/highlight/styles/tomorrow-night-bright.css +0 -74
  117. package/docs/highlight/styles/tomorrow-night-eighties.css +0 -74
  118. package/docs/highlight/styles/tomorrow-night.css +0 -75
  119. package/docs/highlight/styles/tomorrow.css +0 -72
  120. package/docs/highlight/styles/vs.css +0 -68
  121. package/docs/highlight/styles/vs2015.css +0 -115
  122. package/docs/highlight/styles/xcode.css +0 -104
  123. package/docs/highlight/styles/xt256.css +0 -92
  124. package/docs/highlight/styles/zenburn.css +0 -80
  125. package/docs/images/console.svg +0 -12
  126. package/docs/images/dark_ss.png +0 -0
  127. package/docs/images/easy.svg +0 -14
  128. package/docs/images/fast.svg +0 -8
  129. package/docs/images/gears.svg +0 -11
  130. package/docs/images/light_ss.png +0 -0
  131. package/docs/images/logo-outline.png +0 -0
  132. package/docs/images/logo.png +0 -0
  133. package/docs/images/love.svg +0 -8
  134. package/docs/images/mask.svg +0 -16
  135. package/docs/images/mouse.svg +0 -7
  136. package/docs/images/pdf_sample1.png +0 -0
  137. package/docs/images/pdf_sample2.png +0 -0
  138. package/docs/images/webcomponent.svg +0 -13
  139. package/docs/index.css +0 -257
  140. package/docs/index.html +0 -186
  141. package/docs/rapipdf-min.js +0 -95
  142. package/docs/specs/allof-primitives.json +0 -80
  143. package/docs/specs/allof.json +0 -73
  144. package/docs/specs/anyof.json +0 -84
  145. package/docs/specs/basic.json +0 -75
  146. package/docs/specs/bitbucket.json +0 -12916
  147. package/docs/specs/data-types.yaml +0 -168
  148. package/docs/specs/gcloud.json +0 -1347
  149. package/docs/specs/no-server.json +0 -1
  150. package/docs/specs/oneof.json +0 -64
  151. package/docs/specs/petstore.json +0 -1042
  152. package/docs/specs/petstore_extended.yaml +0 -889
  153. package/docs/specs/temp.json +0 -53
  154. package/docs/specs/test-specs/large-models.json +0 -5998
  155. package/docs/specs/test-specs/long-descriptions.json +0 -5443
  156. package/docs/specs/test-specs/long-paths.json +0 -9562
  157. package/docs/specs/test-specs/oneof-allof-nested.yaml +0 -105
  158. package/docs/specs/test-specs/partial-spec-main.json +0 -29
  159. package/docs/specs/test-specs/partial.json +0 -17
  160. package/docs/specs/test-specs/petstore_complex_request.yaml +0 -335
  161. package/docs/specs/test-specs/petstore_experimental.yaml +0 -167
  162. package/docs/specs/test-specs/xxx-of-with-primitives-and-recursive-model.yaml +0 -952
  163. package/docs/welcome.html +0 -186
  164. package/index.html +0 -48
  165. package/logo.png +0 -0
  166. package/src/index.js +0 -3
  167. package/src/markdown.js +0 -120
  168. package/src/object-tree-gen.js +0 -370
  169. package/src/pdf-gen.js +0 -113
  170. package/src/pdf-parts-gen.js +0 -488
  171. package/src/rapipdf.js +0 -246
  172. package/src/spec-parser.js +0 -178
  173. package/src/table-layouts.js +0 -35
  174. package/src/vfs_fonts.js +0 -7
  175. package/webpack.config.js +0 -118
package/src/rapipdf.js DELETED
@@ -1,246 +0,0 @@
1
- import createPdf from '@/pdf-gen';
2
-
3
- const tmpl = document.createElement('template');
4
- tmpl.innerHTML = `
5
- <style>
6
- :host{
7
- --primary-color:#0078d7;
8
- --border-radius:2px;
9
- --input-bg:#fff;
10
- --fg:#333;
11
- --primary-text:#fff;
12
- --font-size:13px;
13
- display:block;
14
- width:350px;
15
- }
16
-
17
- .spec-input {
18
- border-radius:var(--border-radius);
19
- border:1px solid var(--primary-color);
20
- background:var(--input-bg);
21
- font-size: inherit;
22
- color:var(--fg);
23
- transition: border .2s;
24
- outline: none;
25
- padding:6px 5px;
26
- box-sizing: border-box;
27
- flex:1;
28
- }
29
- .spec-input:focus {
30
- outline: 1px dotted var(--fg);
31
- outline-offset: -3px;
32
- }
33
-
34
- .btn-default {
35
- border-radius: 0 var(--border-radius) var(--border-radius) 0;
36
- font-size: 85%;
37
- font-weight: 600;
38
- display: inline-block;
39
- padding: 8px 16px;
40
- outline: none;
41
- outline-offset: -2px;
42
- line-height: 1;
43
- text-align: center;
44
- white-space: nowrap;
45
- background-color:var(--primary-color);
46
- color:var(--primary-text);
47
- border: 0px solid var(--primary-color);
48
- transition: background-color 0.2s;
49
- user-select: none;
50
- cursor: pointer;
51
- }
52
- .btn-default:focus{
53
- outline: 1px solid var(--primary-text);
54
- }
55
-
56
- </style>
57
- <div style='display:flex; width:100%; height: 100%;'>
58
- <input class="spec-input" id="spec-url" type="text" placeholder="Spec URL" value="" tabindex="0">
59
- <button class="btn-default" type="button" style="margin-left:-1px" tabindex="0">GENERATE PDF</button>
60
- </div>
61
- `;
62
-
63
- export default customElements.define('rapi-pdf', class RapiPdf extends HTMLElement {
64
- constructor() {
65
- super(); // always call super() first in the constructor.
66
- const shadowRoot = this.attachShadow({ mode: 'open' });
67
- const elFromTemplate = tmpl.content.cloneNode(true);
68
- this.inputEl = elFromTemplate.querySelector('.spec-input');
69
- this.btnEl = elFromTemplate.querySelector('.btn-default');
70
-
71
- // Initialize attributes if not defined
72
- shadowRoot.appendChild(elFromTemplate);
73
- }
74
-
75
- static get properties() {
76
- return {
77
- localize: { type: Object },
78
- };
79
- }
80
-
81
- connectedCallback() {
82
- // Add Event Listeners
83
- this.inputEl.addEventListener('change', (e) => this.onChangeInput(e));
84
- this.inputEl.addEventListener('keyup', (e) => this.onKeyUp(e));
85
- this.btnEl.addEventListener('click', () => this.generatePdf());
86
- let localizeObj = {};
87
- if (this.children[0]) {
88
- const localizeStr = this.children[0].content.textContent;
89
- try {
90
- localizeObj = JSON.parse(localizeStr);
91
- } catch (e) {
92
- localizeObj = {};
93
- }
94
- }
95
-
96
- this.localize = {
97
- index: 'INDEX',
98
- api: 'API',
99
- apiList: 'API List',
100
- apiReference: 'API Reference',
101
- apiVersion: 'API Version',
102
- contact: 'CONTACT',
103
- name: 'NAME',
104
- email: 'EMAIL',
105
- url: 'URL',
106
- termsOfService: 'Terms of service',
107
- securityAndAuthentication: 'Security and Authentication',
108
- securitySchemes: 'SECURITY SCHEMES',
109
- key: 'KEY',
110
- type: 'TYPE',
111
- example: 'EXAMPLE',
112
- description: 'DESCRIPTION',
113
- request: 'REQUEST',
114
- requestBody: 'REQUEST BODY',
115
- response: 'RESPONSE',
116
- responseModel: 'RESPONSE MODEL',
117
- statusCode: 'STATUS CODE',
118
- deprecated: 'DEPRECATED',
119
- allowed: 'ALLOWED',
120
- default: 'DEFAULT',
121
- readOnly: 'READ ONLY',
122
- writeOnly: 'WRITE ONLY',
123
- enumValues: 'ENUM',
124
- pattern: 'PATTERN',
125
- parameters: 'Parameters',
126
- noRequestParameters: 'No request parameters',
127
- method: 'METHOD',
128
- ...localizeObj,
129
- };
130
- }
131
-
132
- disconnectedCallback() {
133
- // Remove Event Listeners
134
- this.inputEl.removeEventListener('change', this.inputOnChange);
135
- this.inputEl.removeEventListener('keyup', this.onKeyUp);
136
- this.btnEl.removeEventListener('click', this.generatePdf);
137
- }
138
-
139
- static get observedAttributes() {
140
- return ['spec-url', 'button-bg', 'input-bg', 'button-color', 'input-color', 'button-label', 'hide-input'];
141
- }
142
-
143
- attributeChangedCallback(name, oldValue, newValue) {
144
- switch (name) {
145
- case 'spec-url':
146
- if (oldValue !== newValue) {
147
- this.inputEl.value = newValue;
148
- return true;
149
- }
150
- break;
151
- case 'button-label':
152
- if (oldValue !== newValue) {
153
- this.btnEl.innerText = newValue;
154
- return true;
155
- }
156
- break;
157
- case 'hide-input':
158
- if (oldValue !== newValue) {
159
- if (newValue === 'true') {
160
- this.inputEl.style.display = 'none';
161
- this.btnEl.style.borderRadius = 'var(--border-radius)';
162
- } else {
163
- this.inputEl.style.display = 'block';
164
- this.btnEl.style.borderRadius = '0 var(--border-radius) var(--border-radius) 0';
165
- }
166
- return true;
167
- }
168
- break;
169
- case 'button-bg':
170
- this.btnEl.style.backgroundColor = newValue;
171
- this.inputEl.style.borderColor = newValue;
172
- return true;
173
- case 'button-color':
174
- this.btnEl.style.color = newValue;
175
- return true;
176
- case 'input-bg':
177
- this.inputEl.style.backgroundColor = newValue;
178
- return true;
179
- case 'input-color':
180
- this.inputEl.style.color = newValue;
181
- return true;
182
- default:
183
- return true;
184
- }
185
- return true;
186
- }
187
-
188
- get specUrl() {
189
- return this.getAttribute('spec-url');
190
- }
191
-
192
- set specUrl(newSpecUrl) {
193
- this.setAttribute('spec-url', newSpecUrl);
194
- }
195
-
196
- onChangeInput(e) {
197
- this.specUrl = e.target.value;
198
- }
199
-
200
- onKeyUp(e) {
201
- if (e.keyCode === 13) {
202
- // In case of input keyup - first change event will fire which will set the new specUrl URL
203
- this.generatePdf();
204
- }
205
- }
206
-
207
- generatePdf(jsonObj) {
208
- const pdfSortTags = this.getAttribute('pdf-sort-tags') !== 'false';
209
- const pdfPrimaryColor = this.getAttribute('pdf-primary-color');
210
- const pdfAlternateColor = this.getAttribute('pdf-alternate-color');
211
- const pdfTitle = this.getAttribute('pdf-title') === null ? 'API Reference' : this.getAttribute('pdf-title');
212
- const pdfCoverText = this.getAttribute('pdf-cover-text') ? this.getAttribute('pdf-cover-text') : '';
213
- const pdfSecurityText = this.getAttribute('pdf-security-text') ? this.getAttribute('pdf-security-text') : '';
214
- const pdfApiText = this.getAttribute('pdf-api-text') ? this.getAttribute('pdf-api-text') : '';
215
- const pdfSchemaStyle = this.getAttribute('pdf-schema-style') === 'table' ? 'table' : 'object';
216
- const pdfFooterText = this.getAttribute('pdf-footer-text') ? this.getAttribute('pdf-footer-text') : '';
217
- const includeInfo = this.getAttribute('include-info') !== 'false';
218
- const includeToc = this.getAttribute('include-toc') !== 'false';
219
- const includeSecurity = this.getAttribute('include-security') !== 'false';
220
- const includeExample = this.getAttribute('include-example') === 'true';
221
- const includeApiDetails = this.getAttribute('include-api-details') !== 'false';
222
- const includeApiList = this.getAttribute('include-api-list') === 'true';
223
-
224
- const localize = this.localize;
225
- const options = {
226
- pdfSortTags,
227
- pdfPrimaryColor,
228
- pdfAlternateColor,
229
- pdfTitle,
230
- pdfCoverText,
231
- pdfSecurityText,
232
- pdfApiText,
233
- pdfSchemaStyle,
234
- pdfFooterText,
235
- includeInfo,
236
- includeToc,
237
- includeSecurity,
238
- includeExample,
239
- includeApiDetails,
240
- includeApiList,
241
- localize,
242
- };
243
- const spec = this.specUrl || jsonObj;
244
- createPdf(spec, options);
245
- }
246
- });
@@ -1,178 +0,0 @@
1
- // import JsonRefs from 'json-refs';
2
- import Swagger from 'swagger-client';
3
- import converter from 'swagger2openapi';
4
-
5
- export default async function ProcessSpec(specUrl, sortTags) {
6
- let jsonParsedSpec;
7
- let convertedSpec;
8
- const convertOptions = { patch: true, warnOnly: true };
9
- try {
10
- let specObj;
11
- if (typeof specUrl === 'string') {
12
- specObj = await Swagger(specUrl);
13
- } else {
14
- specObj = await Swagger({ spec: specUrl });
15
- }
16
- jsonParsedSpec = specObj.spec;
17
- if (specObj.spec.swagger) {
18
- convertedSpec = await converter.convertObj(specObj.spec, convertOptions);
19
- jsonParsedSpec = convertedSpec.openapi;
20
- }
21
- } catch (err) {
22
- console.info('%c There was an issue while parsing the spec %o ', 'color:orangered', err); // eslint-disable-line no-console
23
- }
24
-
25
- /*
26
- let resolvedRefSpec;
27
- const resolveOptions = { resolveCirculars: false };
28
- try {
29
- if (typeof specUrl === 'string') {
30
- convertedSpec = await converter.convertUrl(specUrl, convertOptions);
31
- } else {
32
- convertedSpec = await converter.convertObj(specUrl, convertOptions);
33
- }
34
- resolvedRefSpec = await JsonRefs.resolveRefs(convertedSpec.openapi, resolveOptions);
35
- jsonParsedSpec = resolvedRefSpec.resolved;
36
- } catch (err) {
37
- console.info('%c There was an issue while parsing the spec %o ', 'color:orangered', err); // eslint-disable-line no-console
38
- }
39
- */
40
-
41
- const openApiSpec = jsonParsedSpec;
42
- const methods = ['get', 'put', 'post', 'delete', 'patch', 'options', 'head'];
43
- const tags = [];
44
- let totalPathCount = 0;
45
- // For each path find the tag and push it into the corrosponding tag
46
- for (const path in openApiSpec.paths) {
47
- const commonParams = openApiSpec.paths[path].parameters;
48
- const commonPathProp = {
49
- summary: openApiSpec.paths[path].summary,
50
- description: openApiSpec.paths[path].description,
51
- servers: openApiSpec.paths[path].servers ? openApiSpec.paths[path].servers : [],
52
- parameters: openApiSpec.paths[path].parameters ? openApiSpec.paths[path].parameters : [],
53
- };
54
-
55
- if (openApiSpec.tags) {
56
- openApiSpec.tags.forEach(
57
- (tag) => tags.push({ name: tag.name, description: tag.description, paths: [] }),
58
- );
59
- }
60
-
61
- methods.forEach((methodName) => {
62
- let tagObj;
63
- let tagText;
64
- let tagDescr;
65
-
66
- if (openApiSpec.paths[path][methodName]) {
67
- const fullPath = openApiSpec.paths[path][methodName];
68
- // If path.methods are tagged, else generate it from path
69
- if (fullPath.tags) {
70
- tagText = fullPath.tags[0];
71
- if (openApiSpec.tags) {
72
- tagDescr = openApiSpec.tags.find((v) => (v.name === tagText));
73
- }
74
- } else {
75
- let firstWordEndIndex = path.indexOf('/', 1);
76
- if (firstWordEndIndex === -1) {
77
- firstWordEndIndex = (path.length - 1);
78
- } else {
79
- firstWordEndIndex -= 1;
80
- }
81
- tagText = path.substr(1, firstWordEndIndex);
82
- }
83
- tagObj = tags.find((v) => v.name === tagText);
84
-
85
- if (!tagObj) {
86
- tagObj = {
87
- name: tagText,
88
- description: tagDescr ? tagDescr.description : '',
89
- paths: [],
90
- };
91
- tags.push(tagObj);
92
- }
93
- // Generate Path summary and Description if it is missing for a method
94
- let summary = fullPath.summary ? fullPath.summary : '';
95
- const description = fullPath.description ? fullPath.description : '';
96
- if (!summary && description) {
97
- if (description.length > 100) {
98
- let charIndex = -1;
99
- charIndex = description.indexOf('\n');
100
- if (charIndex === -1 || charIndex > 100) {
101
- charIndex = description.indexOf('. ');
102
- }
103
- if (charIndex === -1 || charIndex > 100) {
104
- charIndex = description.indexOf('.');
105
- }
106
- if (charIndex === -1 || charIndex > 100) {
107
- summary = description;
108
- } else {
109
- summary = description.substr(0, charIndex);
110
- }
111
- } else {
112
- summary = description;
113
- }
114
- }
115
-
116
- // Merge Common Parameters with This methods parameters
117
- let finalParameters = [];
118
- if (commonParams) {
119
- if (fullPath.parameters) {
120
- finalParameters = commonParams.filter((commonParam) => {
121
- if (!fullPath.parameters.some((param) => (commonParam.name === param.name && commonParam.in === param.in))) {
122
- return commonParam;
123
- }
124
- }).concat(fullPath.parameters);
125
- } else {
126
- finalParameters = commonParams.slice(0);
127
- }
128
- } else {
129
- finalParameters = fullPath.parameters ? fullPath.parameters.slice(0) : [];
130
- }
131
-
132
- const pathObj = {
133
- summary,
134
- method: methodName,
135
- description: fullPath.description,
136
- path,
137
- operationId: fullPath.operationId,
138
- requestBody: fullPath.requestBody,
139
- parameters: finalParameters,
140
- servers: fullPath.servers ? commonPathProp.servers.concat(fullPath.servers) : commonPathProp.servers,
141
- responses: fullPath.responses,
142
- deprecated: fullPath.deprecated,
143
- security: fullPath.security,
144
- commonSummary: commonPathProp.summary,
145
- commonDescription: commonPathProp.description,
146
- };
147
-
148
- if (fullPath.tags) {
149
- fullPath.tags.forEach((mtag) => {
150
- const mtagObj = tags.find((v) => v.name === mtag);
151
- if (mtagObj) {
152
- mtagObj.paths.push(pathObj);
153
- }
154
- });
155
- } else {
156
- tagObj.paths.push(pathObj);
157
- }
158
- totalPathCount++;
159
- }
160
- }); // End of Methods
161
- }
162
-
163
- let securitySchemes = {};
164
-
165
- securitySchemes = (openApiSpec.components ? openApiSpec.components.securitySchemes : {});
166
- if (sortTags) {
167
- tags.sort((a, b) => (a.name < b.name ? -1 : (a.name > b.name ? 1 : 0)));
168
- }
169
- const parsedSpec = {
170
- info: openApiSpec.info,
171
- tags,
172
- externalDocs: openApiSpec.externalDocs,
173
- securitySchemes,
174
- basePath: openApiSpec.basePath, // Only available in swagger V2
175
- totalPathCount,
176
- };
177
- return parsedSpec;
178
- }
@@ -1,35 +0,0 @@
1
- /* eslint-disable no-unused-vars */
2
- export const rowLinesTableLayout = {
3
- hLineWidth(i, node) {
4
- return (i === 1 || i === node.table.body.length) ? 1 : 0.5;
5
- },
6
- vLineWidth() {
7
- return 0;
8
- },
9
- hLineColor(i, node) {
10
- return (i === 0 || i === 1 || i === node.table.body.length) ? '#777' : 'lightgray';
11
- },
12
- };
13
-
14
- export const indentGuideLayout = {
15
- hLineWidth() {
16
- return 0;
17
- },
18
- hLineColor(i, node) {
19
- return (i === 0 || i === node.table.body.length) ? 'black' : 'lightgray';
20
- },
21
- vLineWidth(i, node) {
22
- return (i === 0 && node.table.body.length > 3) ? 1 : 0;
23
- },
24
- vLineColor() { return '#F9EBEA'; },
25
- paddingTop() { return 0; },
26
- paddingBottom() { return 0; },
27
- };
28
-
29
- export const noBorderLayout = {
30
- defaultBorder: false,
31
- hLineWidth() { return 0; },
32
- vLineWidth() { return 0; },
33
- paddingTop() { return 0; },
34
- paddingBottom() { return 0; },
35
- };