openapi-explorer 0.8.264 → 0.8.265
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.
- package/CHANGELOG.md +1 -0
- package/dist/openapi-explorer.min.js +3 -3
- package/dist/openapi-explorer.min.js.LICENSE.txt +1 -1
- package/dist/openapi-explorer.min.js.LICENSE.txt.gz +0 -0
- package/dist/openapi-explorer.min.js.gz +0 -0
- package/dist/openapi-explorer.min.js.map +1 -1
- package/dist/report.html +2 -2
- package/package.json +1 -1
- package/src/utils/spec-parser.js +12 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-explorer",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.265",
|
|
4
4
|
"description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
|
|
5
5
|
"author": "Rhosys Developers <developers@rhosys.ch>",
|
|
6
6
|
"repository": {
|
package/src/utils/spec-parser.js
CHANGED
|
@@ -5,12 +5,21 @@ import { invalidCharsRegEx } from './common-utils';
|
|
|
5
5
|
|
|
6
6
|
export default async function ProcessSpec(requiresLookup, specUrlOrObject, serverUrl = '') {
|
|
7
7
|
let specMeta;
|
|
8
|
+
|
|
9
|
+
// Dynamically resolve non yaml or json files and insert their descriptions where necessary
|
|
10
|
+
function responseInterceptor(val) {
|
|
11
|
+
if (val.ok && val.text && val.parseError && val.parseError.name === 'YAMLException' && (!val.headers['content-type'] || val.headers['content-type'].match('text/plain'))) {
|
|
12
|
+
val.body = val.text;
|
|
13
|
+
}
|
|
14
|
+
return val;
|
|
15
|
+
}
|
|
16
|
+
|
|
8
17
|
if (requiresLookup) {
|
|
9
|
-
specMeta = await SwaggerClient(specUrlOrObject);
|
|
18
|
+
specMeta = await SwaggerClient({ url: specUrlOrObject, responseInterceptor });
|
|
10
19
|
} else if (typeof specUrlOrObject === 'string') {
|
|
11
|
-
specMeta = await SwaggerClient({ spec: yaml.load(specUrlOrObject) });
|
|
20
|
+
specMeta = await SwaggerClient({ spec: yaml.load(specUrlOrObject), responseInterceptor });
|
|
12
21
|
} else {
|
|
13
|
-
specMeta = await SwaggerClient({ spec: specUrlOrObject });
|
|
22
|
+
specMeta = await SwaggerClient({ spec: specUrlOrObject, responseInterceptor });
|
|
14
23
|
}
|
|
15
24
|
|
|
16
25
|
const jsonParsedSpec = specMeta.spec;
|