@asyncapi/react-component 1.0.0-next.5 → 1.0.0-next.50
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/README.md +75 -4
- package/browser/index.js +32 -14
- package/browser/index.js.LICENSE.txt +88 -0
- package/browser/standalone/index.js +32 -0
- package/browser/standalone/index.js.LICENSE.txt +112 -0
- package/browser/standalone/without-parser.js +14 -0
- package/browser/standalone/without-parser.js.LICENSE.txt +110 -0
- package/browser/without-parser.js +14 -12
- package/browser/without-parser.js.LICENSE.txt +86 -0
- package/lib/cjs/components/Bindings.js +12 -4
- package/lib/cjs/components/Bindings.js.map +1 -1
- package/lib/cjs/components/CollapseButton.js +11 -7
- package/lib/cjs/components/CollapseButton.js.map +1 -1
- package/lib/cjs/components/Extensions.js +4 -3
- package/lib/cjs/components/Extensions.js.map +1 -1
- package/lib/cjs/components/Href.js +2 -1
- package/lib/cjs/components/Href.js.map +1 -1
- package/lib/cjs/components/JSONSnippet.js +17 -0
- package/lib/cjs/components/JSONSnippet.js.map +1 -0
- package/lib/cjs/components/Markdown.js +4 -4
- package/lib/cjs/components/Markdown.js.map +1 -1
- package/lib/cjs/components/Schema.js +75 -58
- package/lib/cjs/components/Schema.js.map +1 -1
- package/lib/cjs/components/Tag.js +3 -2
- package/lib/cjs/components/Tag.js.map +1 -1
- package/lib/cjs/components/Tags.js +2 -1
- package/lib/cjs/components/Tags.js.map +1 -1
- package/lib/cjs/components/index.js +6 -2
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/config/config.js.map +1 -1
- package/lib/cjs/config/default.js +9 -1
- package/lib/cjs/config/default.js.map +1 -1
- package/lib/cjs/config/index.js +5 -1
- package/lib/cjs/config/index.js.map +1 -1
- package/lib/cjs/constants.js +5 -48
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/containers/AsyncApi/AsyncApi.js +8 -2
- package/lib/cjs/containers/AsyncApi/AsyncApi.js.map +1 -1
- package/lib/cjs/containers/AsyncApi/Layout.js +33 -21
- package/lib/cjs/containers/AsyncApi/Layout.js.map +1 -1
- package/lib/cjs/containers/AsyncApi/Standalone.js +8 -2
- package/lib/cjs/containers/AsyncApi/Standalone.js.map +1 -1
- package/lib/cjs/containers/Error/Error.js +4 -3
- package/lib/cjs/containers/Error/Error.js.map +1 -1
- package/lib/cjs/containers/Info/Info.js +11 -10
- package/lib/cjs/containers/Info/Info.js.map +1 -1
- package/lib/cjs/containers/Messages/Message.js +23 -10
- package/lib/cjs/containers/Messages/Message.js.map +1 -1
- package/lib/cjs/containers/Messages/MessageExample.js +26 -14
- package/lib/cjs/containers/Messages/MessageExample.js.map +1 -1
- package/lib/cjs/containers/Messages/Messages.js +11 -7
- package/lib/cjs/containers/Messages/Messages.js.map +1 -1
- package/lib/cjs/containers/Operations/Operation.js +73 -37
- package/lib/cjs/containers/Operations/Operation.js.map +1 -1
- package/lib/cjs/containers/Operations/Operations.js +16 -13
- package/lib/cjs/containers/Operations/Operations.js.map +1 -1
- package/lib/cjs/containers/Schemas/Schema.js +21 -0
- package/lib/cjs/containers/Schemas/Schema.js.map +1 -0
- package/lib/cjs/containers/Schemas/Schemas.js +28 -0
- package/lib/cjs/containers/Schemas/Schemas.js.map +1 -0
- package/lib/cjs/containers/Servers/Security.js +150 -0
- package/lib/cjs/containers/Servers/Security.js.map +1 -0
- package/lib/cjs/containers/Servers/Server.js +15 -8
- package/lib/cjs/containers/Servers/Server.js.map +1 -1
- package/lib/cjs/containers/Servers/Servers.js +7 -4
- package/lib/cjs/containers/Servers/Servers.js.map +1 -1
- package/lib/cjs/containers/Sidebar/Sidebar.js +213 -140
- package/lib/cjs/containers/Sidebar/Sidebar.js.map +1 -1
- package/lib/cjs/contexts/index.js +6 -1
- package/lib/cjs/contexts/index.js.map +1 -1
- package/lib/cjs/contexts/useConfig.js +10 -0
- package/lib/cjs/contexts/useConfig.js.map +1 -0
- package/lib/cjs/contexts/useSpec.js +7 -3
- package/lib/cjs/contexts/useSpec.js.map +1 -1
- package/lib/cjs/helpers/common.js +17 -0
- package/lib/cjs/helpers/common.js.map +1 -0
- package/lib/cjs/helpers/index.js +7 -4
- package/lib/cjs/helpers/index.js.map +1 -1
- package/lib/cjs/helpers/marked.js +34 -0
- package/lib/cjs/helpers/marked.js.map +1 -0
- package/lib/cjs/helpers/message.js +39 -9
- package/lib/cjs/helpers/message.js.map +1 -1
- package/lib/cjs/helpers/parser.js +14 -15
- package/lib/cjs/helpers/parser.js.map +1 -1
- package/lib/cjs/helpers/schema.js +157 -135
- package/lib/cjs/helpers/schema.js.map +1 -1
- package/lib/cjs/helpers/server.js +49 -0
- package/lib/cjs/helpers/server.js.map +1 -1
- package/lib/cjs/helpers/specification.js +36 -21
- package/lib/cjs/helpers/specification.js.map +1 -1
- package/lib/cjs/index.js +3 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types.js +4 -51
- package/lib/cjs/types.js.map +1 -1
- package/lib/cjs/without-parser.js +3 -0
- package/lib/cjs/without-parser.js.map +1 -1
- package/lib/esm/components/Bindings.js +10 -3
- package/lib/esm/components/Bindings.js.map +1 -1
- package/lib/esm/components/CollapseButton.js +9 -6
- package/lib/esm/components/CollapseButton.js.map +1 -1
- package/lib/esm/components/Extensions.js +2 -2
- package/lib/esm/components/Extensions.js.map +1 -1
- package/lib/esm/components/Href.js.map +1 -1
- package/lib/esm/components/JSONSnippet.js +10 -0
- package/lib/esm/components/JSONSnippet.js.map +1 -0
- package/lib/esm/components/Markdown.js +2 -3
- package/lib/esm/components/Markdown.js.map +1 -1
- package/lib/esm/components/Schema.js +69 -57
- package/lib/esm/components/Schema.js.map +1 -1
- package/lib/esm/components/Tag.js +1 -1
- package/lib/esm/components/Tag.js.map +1 -1
- package/lib/esm/components/Tags.js.map +1 -1
- package/lib/esm/components/index.js +1 -1
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/config/config.js.map +1 -1
- package/lib/esm/config/default.js +9 -1
- package/lib/esm/config/default.js.map +1 -1
- package/lib/esm/config/index.js.map +1 -1
- package/lib/esm/constants.js +3 -47
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/containers/AsyncApi/AsyncApi.js +2 -0
- package/lib/esm/containers/AsyncApi/AsyncApi.js.map +1 -1
- package/lib/esm/containers/AsyncApi/Layout.js +28 -20
- package/lib/esm/containers/AsyncApi/Layout.js.map +1 -1
- package/lib/esm/containers/AsyncApi/Standalone.js +3 -1
- package/lib/esm/containers/AsyncApi/Standalone.js.map +1 -1
- package/lib/esm/containers/Error/Error.js +2 -2
- package/lib/esm/containers/Error/Error.js.map +1 -1
- package/lib/esm/containers/Info/Info.js +8 -8
- package/lib/esm/containers/Info/Info.js.map +1 -1
- package/lib/esm/containers/Messages/Message.js +21 -9
- package/lib/esm/containers/Messages/Message.js.map +1 -1
- package/lib/esm/containers/Messages/MessageExample.js +19 -13
- package/lib/esm/containers/Messages/MessageExample.js.map +1 -1
- package/lib/esm/containers/Messages/Messages.js +10 -7
- package/lib/esm/containers/Messages/Messages.js.map +1 -1
- package/lib/esm/containers/Operations/Operation.js +72 -38
- package/lib/esm/containers/Operations/Operation.js.map +1 -1
- package/lib/esm/containers/Operations/Operations.js +15 -13
- package/lib/esm/containers/Operations/Operations.js.map +1 -1
- package/lib/esm/containers/Schemas/Schema.js +14 -0
- package/lib/esm/containers/Schemas/Schema.js.map +1 -0
- package/lib/esm/containers/Schemas/Schemas.js +21 -0
- package/lib/esm/containers/Schemas/Schemas.js.map +1 -0
- package/lib/esm/containers/Servers/Security.js +143 -0
- package/lib/esm/containers/Servers/Security.js.map +1 -0
- package/lib/esm/containers/Servers/Server.js +15 -9
- package/lib/esm/containers/Servers/Server.js.map +1 -1
- package/lib/esm/containers/Servers/Servers.js +5 -3
- package/lib/esm/containers/Servers/Servers.js.map +1 -1
- package/lib/esm/containers/Sidebar/Sidebar.js +203 -135
- package/lib/esm/containers/Sidebar/Sidebar.js.map +1 -1
- package/lib/esm/contexts/index.js +1 -0
- package/lib/esm/contexts/index.js.map +1 -1
- package/lib/esm/contexts/useConfig.js +6 -0
- package/lib/esm/contexts/useConfig.js.map +1 -0
- package/lib/esm/contexts/useSpec.js +2 -2
- package/lib/esm/contexts/useSpec.js.map +1 -1
- package/lib/esm/helpers/common.js +14 -0
- package/lib/esm/helpers/common.js.map +1 -0
- package/lib/esm/helpers/index.js +2 -3
- package/lib/esm/helpers/index.js.map +1 -1
- package/lib/esm/helpers/marked.js +27 -0
- package/lib/esm/helpers/marked.js.map +1 -0
- package/lib/esm/helpers/message.js +38 -8
- package/lib/esm/helpers/message.js.map +1 -1
- package/lib/esm/helpers/parser.js +15 -13
- package/lib/esm/helpers/parser.js.map +1 -1
- package/lib/esm/helpers/schema.js +152 -127
- package/lib/esm/helpers/schema.js.map +1 -1
- package/lib/esm/helpers/server.js +49 -0
- package/lib/esm/helpers/server.js.map +1 -1
- package/lib/esm/helpers/specification.js +36 -18
- package/lib/esm/helpers/specification.js.map +1 -1
- package/lib/esm/index.js +2 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types.js +2 -46
- package/lib/esm/types.js.map +1 -1
- package/lib/esm/without-parser.js +2 -0
- package/lib/esm/without-parser.js.map +1 -1
- package/lib/types/components/Bindings.d.ts.map +1 -1
- package/lib/types/components/CollapseButton.d.ts +1 -0
- package/lib/types/components/CollapseButton.d.ts.map +1 -1
- package/lib/types/components/Extensions.d.ts.map +1 -1
- package/lib/types/components/JSONSnippet.d.ts +7 -0
- package/lib/types/components/JSONSnippet.d.ts.map +1 -0
- package/lib/types/components/Markdown.d.ts.map +1 -1
- package/lib/types/components/Schema.d.ts +5 -4
- package/lib/types/components/Schema.d.ts.map +1 -1
- package/lib/types/components/Tag.d.ts +2 -2
- package/lib/types/components/Tag.d.ts.map +1 -1
- package/lib/types/components/Tags.d.ts +2 -2
- package/lib/types/components/Tags.d.ts.map +1 -1
- package/lib/types/components/index.d.ts +1 -1
- package/lib/types/components/index.d.ts.map +1 -1
- package/lib/types/config/config.d.ts +8 -0
- package/lib/types/config/config.d.ts.map +1 -1
- package/lib/types/config/default.d.ts.map +1 -1
- package/lib/types/constants.d.ts +3 -26
- package/lib/types/constants.d.ts.map +1 -1
- package/lib/types/containers/AsyncApi/AsyncApi.d.ts +2 -2
- package/lib/types/containers/AsyncApi/AsyncApi.d.ts.map +1 -1
- package/lib/types/containers/AsyncApi/Layout.d.ts +2 -2
- package/lib/types/containers/AsyncApi/Layout.d.ts.map +1 -1
- package/lib/types/containers/AsyncApi/Standalone.d.ts +2 -2
- package/lib/types/containers/AsyncApi/Standalone.d.ts.map +1 -1
- package/lib/types/containers/Info/Info.d.ts.map +1 -1
- package/lib/types/containers/Messages/Message.d.ts +3 -2
- package/lib/types/containers/Messages/Message.d.ts.map +1 -1
- package/lib/types/containers/Messages/MessageExample.d.ts +5 -4
- package/lib/types/containers/Messages/MessageExample.d.ts.map +1 -1
- package/lib/types/containers/Messages/Messages.d.ts.map +1 -1
- package/lib/types/containers/Operations/Operation.d.ts +4 -3
- package/lib/types/containers/Operations/Operation.d.ts.map +1 -1
- package/lib/types/containers/Operations/Operations.d.ts.map +1 -1
- package/lib/types/containers/Schemas/Schema.d.ts +9 -0
- package/lib/types/containers/Schemas/Schema.d.ts.map +1 -0
- package/lib/types/containers/Schemas/Schemas.d.ts +3 -0
- package/lib/types/containers/Schemas/Schemas.d.ts.map +1 -0
- package/lib/types/containers/Servers/Security.d.ts +10 -0
- package/lib/types/containers/Servers/Security.d.ts.map +1 -0
- package/lib/types/containers/Servers/Server.d.ts +2 -2
- package/lib/types/containers/Servers/Server.d.ts.map +1 -1
- package/lib/types/containers/Servers/Servers.d.ts.map +1 -1
- package/lib/types/containers/Sidebar/Sidebar.d.ts +1 -9
- package/lib/types/containers/Sidebar/Sidebar.d.ts.map +1 -1
- package/lib/types/contexts/index.d.ts +1 -0
- package/lib/types/contexts/index.d.ts.map +1 -1
- package/lib/types/contexts/useConfig.d.ts +5 -0
- package/lib/types/contexts/useConfig.d.ts.map +1 -0
- package/lib/types/contexts/useSpec.d.ts +3 -5
- package/lib/types/contexts/useSpec.d.ts.map +1 -1
- package/lib/types/helpers/common.d.ts +5 -0
- package/lib/types/helpers/common.d.ts.map +1 -0
- package/lib/types/helpers/index.d.ts +2 -3
- package/lib/types/helpers/index.d.ts.map +1 -1
- package/lib/types/helpers/marked.d.ts +4 -0
- package/lib/types/helpers/marked.d.ts.map +1 -0
- package/lib/types/helpers/message.d.ts +4 -3
- package/lib/types/helpers/message.d.ts.map +1 -1
- package/lib/types/helpers/parser.d.ts.map +1 -1
- package/lib/types/helpers/schema.d.ts +16 -12
- package/lib/types/helpers/schema.d.ts.map +1 -1
- package/lib/types/helpers/server.d.ts +6 -1
- package/lib/types/helpers/server.d.ts.map +1 -1
- package/lib/types/helpers/specification.d.ts +7 -4
- package/lib/types/helpers/specification.d.ts.map +1 -1
- package/lib/types/index.d.ts +2 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/types.d.ts +12 -305
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/without-parser.d.ts +2 -0
- package/lib/types/without-parser.d.ts.map +1 -1
- package/package.json +43 -19
- package/styles/default.css +907 -642
- package/styles/default.min.css +4 -2
- package/lib/cjs/components/Code.js +0 -15
- package/lib/cjs/components/Code.js.map +0 -1
- package/lib/cjs/containers/Servers/ServerSecurity.js +0 -101
- package/lib/cjs/containers/Servers/ServerSecurity.js.map +0 -1
- package/lib/cjs/helpers/bemClasses.js +0 -49
- package/lib/cjs/helpers/bemClasses.js.map +0 -1
- package/lib/cjs/helpers/formatJsonHighlight.js +0 -61
- package/lib/cjs/helpers/formatJsonHighlight.js.map +0 -1
- package/lib/cjs/helpers/toKebabCase.js +0 -15
- package/lib/cjs/helpers/toKebabCase.js.map +0 -1
- package/lib/esm/components/Code.js +0 -9
- package/lib/esm/components/Code.js.map +0 -1
- package/lib/esm/containers/Servers/ServerSecurity.js +0 -95
- package/lib/esm/containers/Servers/ServerSecurity.js.map +0 -1
- package/lib/esm/helpers/bemClasses.js +0 -46
- package/lib/esm/helpers/bemClasses.js.map +0 -1
- package/lib/esm/helpers/formatJsonHighlight.js +0 -57
- package/lib/esm/helpers/formatJsonHighlight.js.map +0 -1
- package/lib/esm/helpers/toKebabCase.js +0 -11
- package/lib/esm/helpers/toKebabCase.js.map +0 -1
- package/lib/types/components/Code.d.ts +0 -7
- package/lib/types/components/Code.d.ts.map +0 -1
- package/lib/types/containers/Servers/ServerSecurity.d.ts +0 -8
- package/lib/types/containers/Servers/ServerSecurity.d.ts.map +0 -1
- package/lib/types/helpers/bemClasses.d.ts +0 -14
- package/lib/types/helpers/bemClasses.d.ts.map +0 -1
- package/lib/types/helpers/formatJsonHighlight.d.ts +0 -2
- package/lib/types/helpers/formatJsonHighlight.d.ts.map +0 -1
- package/lib/types/helpers/toKebabCase.d.ts +0 -2
- package/lib/types/helpers/toKebabCase.d.ts.map +0 -1
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.SpecificationHelpers = void 0;
|
|
7
|
-
var
|
|
4
|
+
var parser_1 = require("@asyncapi/parser");
|
|
5
|
+
var document_1 = require("@asyncapi/parser/cjs/document");
|
|
8
6
|
var SpecificationHelpers = (function () {
|
|
9
7
|
function SpecificationHelpers() {
|
|
10
8
|
}
|
|
@@ -12,13 +10,12 @@ var SpecificationHelpers = (function () {
|
|
|
12
10
|
if (!schema) {
|
|
13
11
|
return undefined;
|
|
14
12
|
}
|
|
15
|
-
if (
|
|
13
|
+
if ((0, parser_1.isAsyncAPIDocument)(schema)) {
|
|
16
14
|
return schema;
|
|
17
15
|
}
|
|
18
|
-
if (
|
|
19
|
-
schema.
|
|
20
|
-
|
|
21
|
-
return schema;
|
|
16
|
+
if ((0, parser_1.isOldAsyncAPIDocument)(schema)) {
|
|
17
|
+
var parsedJSON = schema.json();
|
|
18
|
+
return (0, parser_1.toAsyncAPIDocument)(parsedJSON);
|
|
22
19
|
}
|
|
23
20
|
if (typeof schema === 'string') {
|
|
24
21
|
try {
|
|
@@ -28,10 +25,10 @@ var SpecificationHelpers = (function () {
|
|
|
28
25
|
return undefined;
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
|
-
if (
|
|
32
|
-
return
|
|
28
|
+
if ((0, document_1.isStringifiedDocument)(schema)) {
|
|
29
|
+
return (0, parser_1.unstringify)(schema);
|
|
33
30
|
}
|
|
34
|
-
return
|
|
31
|
+
return (0, parser_1.toAsyncAPIDocument)(schema);
|
|
35
32
|
};
|
|
36
33
|
SpecificationHelpers.containTags = function (schema, tags) {
|
|
37
34
|
var tagsToCheck = typeof schema.tags === 'function' ? schema.tags() : undefined;
|
|
@@ -45,19 +42,37 @@ var SpecificationHelpers = (function () {
|
|
|
45
42
|
};
|
|
46
43
|
SpecificationHelpers.operationsTags = function (spec) {
|
|
47
44
|
var tags = new Map();
|
|
48
|
-
Object.entries(spec.
|
|
49
|
-
var _ = _a[0],
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (subscribe && subscribe.hasTags()) {
|
|
56
|
-
subscribe.tags().forEach(function (tag) { return tags.set(tag.name(), tag); });
|
|
45
|
+
Object.entries(spec.operations().all()).forEach(function (_a) {
|
|
46
|
+
var _ = _a[0], operation = _a[1];
|
|
47
|
+
if ((operation === null || operation === void 0 ? void 0 : operation.tags().length) > 0) {
|
|
48
|
+
operation
|
|
49
|
+
.tags()
|
|
50
|
+
.all()
|
|
51
|
+
.forEach(function (tag) { return tags.set(tag.name(), tag); });
|
|
57
52
|
}
|
|
58
53
|
});
|
|
59
54
|
return Array.from(tags.values());
|
|
60
55
|
};
|
|
56
|
+
SpecificationHelpers.serversTags = function (spec) {
|
|
57
|
+
var tags = {};
|
|
58
|
+
Object.entries(spec.servers()).forEach(function (_a) {
|
|
59
|
+
var _ = _a[0], server = _a[1];
|
|
60
|
+
if (server.tags().length > 0) {
|
|
61
|
+
server
|
|
62
|
+
.tags()
|
|
63
|
+
.all()
|
|
64
|
+
.forEach(function (tag) {
|
|
65
|
+
if (tags[tag.name()]) {
|
|
66
|
+
tags[tag.name()] = [tags[tag.name()], _];
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
tags[tag.name()] = _;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return tags;
|
|
75
|
+
};
|
|
61
76
|
return SpecificationHelpers;
|
|
62
77
|
}());
|
|
63
78
|
exports.SpecificationHelpers = SpecificationHelpers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specification.js","sourceRoot":"","sources":["../../../src/helpers/specification.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"specification.js","sourceRoot":"","sources":["../../../src/helpers/specification.ts"],"names":[],"mappings":";;;AAAA,2CAO0B;AAC1B,0DAAsE;AAEtE;IAAA;IA6FA,CAAC;IAzFQ,uCAAkB,GAAzB,UACE,MAAW;QAEX,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,IAAA,2BAAkB,EAAC,MAAM,CAAC,EAAE;YAC9B,OAAO,MAAM,CAAC;SACf;QAED,IAAI,IAAA,8BAAqB,EAAC,MAAM,CAAC,EAAE;YAEjC,IAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;YACjC,OAAO,IAAA,2BAAkB,EAAC,UAAU,CAAC,CAAC;SACvC;QAGD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;YAC9B,IAAI;gBACF,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aAC7B;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,SAAS,CAAC;aAClB;SACF;QAGD,IAAI,IAAA,gCAAqB,EAAC,MAAM,CAAC,EAAE;YACjC,OAAO,IAAA,oBAAW,EAAC,MAAM,CAAC,CAAC;SAC5B;QAED,OAAO,IAAA,2BAAkB,EAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAKM,gCAAW,GAAlB,UACE,MAAW,EACX,IAAmC;QAEnC,IAAM,WAAW,GACf,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAChE,IAAI,WAAW,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YAC5D,OAAO,KAAK,CAAC;SACd;QACD,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC3C,OAAO,WAAW,CAAC,IAAI,CAAC,UAAC,GAAiB;YACxC,OAAC,IAAuB,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,IAAI,EAAE,EAAvB,CAAuB,CAAC;QAA3D,CAA2D,CAC5D,CAAC;IACJ,CAAC;IAKM,mCAAc,GAArB,UAAsB,IAA+B;QACnD,IAAM,IAAI,GAAG,IAAI,GAAG,EAAwB,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,UAAC,EAAc;gBAAb,CAAC,QAAA,EAAE,SAAS,QAAA;YAC5D,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,GAAG,MAAM,IAAG,CAAC,EAAE;gBAChC,SAAS;qBACN,IAAI,EAAE;qBACN,GAAG,EAAE;qBACL,OAAO,CAAC,UAAA,GAAG,IAAI,OAAA,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,EAAzB,CAAyB,CAAC,CAAC;aAC9C;QACH,CAAC,CAAC,CAAC;QACH,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACnC,CAAC;IAKM,gCAAW,GAAlB,UAAmB,IAA+B;QAChD,IAAM,IAAI,GAAG,EAA0B,CAAC;QACxC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,UAAC,EAAW;gBAAV,CAAC,QAAA,EAAE,MAAM,QAAA;YAChD,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC5B,MAAM;qBACH,IAAI,EAAE;qBACN,GAAG,EAAE;qBACL,OAAO,CAAC,UAAA,GAAG;oBACV,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE;wBACpB,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;qBAC1C;yBAAM;wBACL,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;qBACtB;gBACH,CAAC,CAAC,CAAC;aACN;QACH,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IACH,2BAAC;AAAD,CAAC,AA7FD,IA6FC;AA7FY,oDAAoB","sourcesContent":["import {\n AsyncAPIDocumentInterface,\n TagInterface,\n isAsyncAPIDocument,\n isOldAsyncAPIDocument,\n toAsyncAPIDocument,\n unstringify,\n} from '@asyncapi/parser';\nimport { isStringifiedDocument } from '@asyncapi/parser/cjs/document';\n\nexport class SpecificationHelpers {\n /**\n * Returns parsed AsyncAPI specification.\n */\n static retrieveParsedSpec(\n schema: any,\n ): AsyncAPIDocumentInterface | undefined {\n if (!schema) {\n return undefined;\n }\n\n if (isAsyncAPIDocument(schema)) {\n return schema;\n }\n\n if (isOldAsyncAPIDocument(schema)) {\n // Is from old parser\n const parsedJSON = schema.json();\n return toAsyncAPIDocument(parsedJSON);\n }\n\n // check if input is a string and try parse it\n if (typeof schema === 'string') {\n try {\n schema = JSON.parse(schema);\n } catch (e) {\n return undefined;\n }\n }\n\n // at the end check if schema is a parsed JS object (as output from AsyncAPI Parser)\n if (isStringifiedDocument(schema)) {\n return unstringify(schema);\n }\n\n return toAsyncAPIDocument(schema);\n }\n\n /**\n * Check if given schema have one of the specified tags.\n */\n static containTags(\n schema: any,\n tags: TagInterface | TagInterface[],\n ): boolean {\n const tagsToCheck =\n typeof schema.tags === 'function' ? schema.tags() : undefined;\n if (tagsToCheck === undefined || !Array.isArray(tagsToCheck)) {\n return false;\n }\n tags = Array.isArray(tags) ? tags : [tags];\n return tagsToCheck.some((tag: TagInterface) =>\n (tags as TagInterface[]).some(t => t.name() === tag.name()),\n );\n }\n\n /**\n * Return all tags from operations\n */\n static operationsTags(spec: AsyncAPIDocumentInterface) {\n const tags = new Map<string, TagInterface>();\n Object.entries(spec.operations().all()).forEach(([_, operation]) => {\n if (operation?.tags().length > 0) {\n operation\n .tags()\n .all()\n .forEach(tag => tags.set(tag.name(), tag));\n }\n });\n return Array.from(tags.values());\n }\n\n /**\n * Return all tags from servers\n */\n static serversTags(spec: AsyncAPIDocumentInterface) {\n const tags = {} as { string: string[] };\n Object.entries(spec.servers()).forEach(([_, server]) => {\n if (server.tags().length > 0) {\n server\n .tags()\n .all()\n .forEach(tag => {\n if (tags[tag.name()]) {\n tags[tag.name()] = [tags[tag.name()], _];\n } else {\n tags[tag.name()] = _;\n }\n });\n }\n });\n return tags;\n }\n}\n"]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -3,9 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AsyncApiComponentWP = void 0;
|
|
6
|
+
exports.hljs = exports.AsyncApiComponentWP = void 0;
|
|
7
7
|
var AsyncApi_1 = __importDefault(require("./containers/AsyncApi/AsyncApi"));
|
|
8
8
|
var Standalone_1 = __importDefault(require("./containers/AsyncApi/Standalone"));
|
|
9
9
|
exports.AsyncApiComponentWP = Standalone_1.default;
|
|
10
|
+
var helpers_1 = require("./helpers");
|
|
11
|
+
Object.defineProperty(exports, "hljs", { enumerable: true, get: function () { return helpers_1.hljs; } });
|
|
10
12
|
exports.default = AsyncApi_1.default;
|
|
11
13
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,4EAA+D;AAC/D,gFAAmE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,4EAA+D;AAC/D,gFAAmE;AAQ1D,8BARF,oBAAmB,CAQE;AAF5B,qCAAiC;AAEH,qFAFrB,cAAI,OAEqB;AAClC,kBAAe,kBAAiB,CAAC","sourcesContent":["import AsyncApiComponent from './containers/AsyncApi/AsyncApi';\nimport AsyncApiComponentWP from './containers/AsyncApi/Standalone';\n\nexport { AsyncApiProps } from './containers/AsyncApi/AsyncApi';\nexport { ConfigInterface } from './config/config';\nexport { FetchingSchemaInterface } from './types';\n\nimport { hljs } from './helpers';\n\nexport { AsyncApiComponentWP, hljs };\nexport default AsyncApiComponent;\n"]}
|
package/lib/cjs/types.js
CHANGED
|
@@ -1,60 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
BindingsType["http"] = "http";
|
|
7
|
-
BindingsType["ws"] = "ws";
|
|
8
|
-
BindingsType["kafka"] = "kafka";
|
|
9
|
-
BindingsType["amqp"] = "amqp";
|
|
10
|
-
BindingsType["amqp1"] = "amqp1";
|
|
11
|
-
BindingsType["mqtt"] = "mqtt";
|
|
12
|
-
BindingsType["mqtt5"] = "mqtt5";
|
|
13
|
-
BindingsType["nats"] = "nats";
|
|
14
|
-
BindingsType["jms"] = "jms";
|
|
15
|
-
BindingsType["sns"] = "sns";
|
|
16
|
-
BindingsType["sqs"] = "sqs";
|
|
17
|
-
BindingsType["stomp"] = "stomp";
|
|
18
|
-
BindingsType["redis"] = "redis";
|
|
19
|
-
})(BindingsType = exports.BindingsType || (exports.BindingsType = {}));
|
|
20
|
-
function isRawMessage(message) {
|
|
21
|
-
return !message.oneOf;
|
|
3
|
+
exports.PayloadType = exports.isFetchingSchemaInterface = void 0;
|
|
4
|
+
function isFetchingSchemaInterface(schema) {
|
|
5
|
+
return schema.url !== undefined;
|
|
22
6
|
}
|
|
23
|
-
exports.
|
|
7
|
+
exports.isFetchingSchemaInterface = isFetchingSchemaInterface;
|
|
24
8
|
var PayloadType;
|
|
25
9
|
(function (PayloadType) {
|
|
26
10
|
PayloadType["PUBLISH"] = "publish";
|
|
27
11
|
PayloadType["SUBSCRIBE"] = "subscribe";
|
|
28
12
|
})(PayloadType = exports.PayloadType || (exports.PayloadType = {}));
|
|
29
|
-
function isOneOfPayload(payload) {
|
|
30
|
-
return !!payload && payload.oneOf !== undefined;
|
|
31
|
-
}
|
|
32
|
-
exports.isOneOfPayload = isOneOfPayload;
|
|
33
|
-
function isAnyOfPayload(payload) {
|
|
34
|
-
return !!payload && payload.anyOf !== undefined;
|
|
35
|
-
}
|
|
36
|
-
exports.isAnyOfPayload = isAnyOfPayload;
|
|
37
|
-
var SecuritySchemeType;
|
|
38
|
-
(function (SecuritySchemeType) {
|
|
39
|
-
SecuritySchemeType["userPassword"] = "User / Password";
|
|
40
|
-
SecuritySchemeType["apiKey"] = "API key";
|
|
41
|
-
SecuritySchemeType["X509"] = "X509";
|
|
42
|
-
SecuritySchemeType["symmetricEncryption"] = "Symmetric Encryption";
|
|
43
|
-
SecuritySchemeType["asymmetricEncryption"] = "Asymmetric Encryption";
|
|
44
|
-
SecuritySchemeType["httpApiKey"] = "HTTP API key";
|
|
45
|
-
SecuritySchemeType["http"] = "HTTP";
|
|
46
|
-
SecuritySchemeType["oauth2"] = "OAuth2";
|
|
47
|
-
SecuritySchemeType["openIdConnect"] = "Open ID";
|
|
48
|
-
})(SecuritySchemeType = exports.SecuritySchemeType || (exports.SecuritySchemeType = {}));
|
|
49
|
-
var OAuthFlowsType;
|
|
50
|
-
(function (OAuthFlowsType) {
|
|
51
|
-
OAuthFlowsType["implicit"] = "Implicit";
|
|
52
|
-
OAuthFlowsType["password"] = "Password";
|
|
53
|
-
OAuthFlowsType["clientCredentials"] = "Client Credentials";
|
|
54
|
-
OAuthFlowsType["authorizationCode"] = "Authorization Code";
|
|
55
|
-
})(OAuthFlowsType = exports.OAuthFlowsType || (exports.OAuthFlowsType = {}));
|
|
56
|
-
function isFetchingSchemaInterface(schema) {
|
|
57
|
-
return schema.url !== undefined;
|
|
58
|
-
}
|
|
59
|
-
exports.isFetchingSchemaInterface = isFetchingSchemaInterface;
|
|
60
13
|
//# sourceMappingURL=types.js.map
|
package/lib/cjs/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAeA,SAAgB,yBAAyB,CACvC,MAAmB;IAEnB,OAAQ,MAAkC,CAAC,GAAG,KAAK,SAAS,CAAC;AAC/D,CAAC;AAJD,8DAIC;AAYD,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,sCAAuB,CAAA;AACzB,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB","sourcesContent":["import { AsyncAPIDocumentInterface } from '@asyncapi/parser';\n\nexport type PropsSchema =\n | string\n | FetchingSchemaInterface\n | AsyncAPIDocumentInterface\n | object;\n\nexport type NullableAsyncApi = AsyncAPIDocumentInterface | null;\n\nexport interface AsyncApiState {\n validatedSchema: NullableAsyncApi;\n error?: ErrorObject;\n}\n\nexport function isFetchingSchemaInterface(\n schema: PropsSchema,\n): schema is FetchingSchemaInterface {\n return (schema as FetchingSchemaInterface).url !== undefined;\n}\n\nexport interface FetchingSchemaInterface {\n url: string;\n requestOptions?: RequestInit;\n}\n\nexport interface ParserReturn {\n asyncapi?: AsyncAPIDocumentInterface;\n error?: ErrorObject;\n}\n\nexport enum PayloadType {\n PUBLISH = 'publish',\n SUBSCRIBE = 'subscribe',\n}\n\nexport interface MessageExample {\n name?: string;\n summary?: string;\n example: any;\n}\n\nexport interface ValidationError {\n title: string;\n location: {\n jsonPointer: string;\n startLine: number;\n startColumn: number;\n startOffset: number;\n endLine: number;\n endColumn: number;\n endOffset: number;\n };\n}\n\nexport interface ErrorObject {\n type: string;\n title: string;\n detail?: string;\n parsedJSON?: any;\n validationErrors?: ValidationError[];\n location?: {\n startLine: number;\n startColumn: number;\n startOffset: number;\n };\n refs?: Array<{\n title: string;\n jsonPointer: string;\n startLine: number;\n startColumn: number;\n startOffset: number;\n endLine: number;\n endColumn: number;\n endOffset: number;\n }>;\n}\n"]}
|
|
@@ -3,6 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.hljs = void 0;
|
|
6
7
|
var Standalone_1 = __importDefault(require("./containers/AsyncApi/Standalone"));
|
|
8
|
+
var helpers_1 = require("./helpers");
|
|
9
|
+
Object.defineProperty(exports, "hljs", { enumerable: true, get: function () { return helpers_1.hljs; } });
|
|
7
10
|
exports.default = Standalone_1.default;
|
|
8
11
|
//# sourceMappingURL=without-parser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"without-parser.js","sourceRoot":"","sources":["../../src/without-parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"without-parser.js","sourceRoot":"","sources":["../../src/without-parser.ts"],"names":[],"mappings":";;;;;;AAAA,gFAAiE;AAEjE,qCAAiC;AAExB,qFAFA,cAAI,OAEA;AACb,kBAAe,oBAAiB,CAAC","sourcesContent":["import AsyncApiComponent from './containers/AsyncApi/Standalone';\n\nimport { hljs } from './helpers';\n\nexport { hljs };\nexport default AsyncApiComponent;\n"]}
|
|
@@ -2,11 +2,18 @@ import React from 'react';
|
|
|
2
2
|
import { Schema } from './Schema';
|
|
3
3
|
import { SchemaHelpers } from '../helpers';
|
|
4
4
|
export var Bindings = function (_a) {
|
|
5
|
-
var _b = _a.name, name = _b === void 0 ? '
|
|
5
|
+
var _b = _a.name, name = _b === void 0 ? 'Binding specific information' : _b, bindings = _a.bindings;
|
|
6
6
|
if (!bindings || !Object.keys(bindings).length) {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
9
|
-
var
|
|
10
|
-
|
|
9
|
+
var renderedBindings = Object.entries(bindings).map(function (_a) {
|
|
10
|
+
var bindingName = _a[0], binding = _a[1];
|
|
11
|
+
var schema = SchemaHelpers.jsonToSchema(binding);
|
|
12
|
+
var schemaName = (React.createElement("div", { className: "inline-block text-sm" },
|
|
13
|
+
React.createElement("span", null, name),
|
|
14
|
+
React.createElement("span", { className: "bg-teal-500 font-bold no-underline text-white uppercase rounded mx-2 px-2 py-1 text-xs" }, bindingName)));
|
|
15
|
+
return (schema && (React.createElement(Schema, { schemaName: schemaName, schema: schema, key: bindingName, onlyTitle: true })));
|
|
16
|
+
});
|
|
17
|
+
return React.createElement(React.Fragment, null, renderedBindings);
|
|
11
18
|
};
|
|
12
19
|
//# sourceMappingURL=Bindings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bindings.js","sourceRoot":"","sources":["../../../src/components/Bindings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAO3C,MAAM,CAAC,IAAM,QAAQ,GAAmC,UAAC,EAGxD;QAFC,
|
|
1
|
+
{"version":3,"file":"Bindings.js","sourceRoot":"","sources":["../../../src/components/Bindings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAO3C,MAAM,CAAC,IAAM,QAAQ,GAAmC,UAAC,EAGxD;QAFC,YAAqC,EAArC,IAAI,mBAAG,8BAA8B,KAAA,EACrC,QAAQ,cAAA;IAER,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE;QAC9C,OAAO,IAAI,CAAC;KACb;IAED,IAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CACnD,UAAC,EAAsB;YAArB,WAAW,QAAA,EAAE,OAAO,QAAA;QACpB,IAAM,MAAM,GAAG,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACnD,IAAM,UAAU,GAAG,CACjB,6BAAK,SAAS,EAAC,sBAAsB;YACnC,kCAAO,IAAI,CAAQ;YACnB,8BAAM,SAAS,EAAC,wFAAwF,IACrG,WAAW,CACP,CACH,CACP,CAAC;QACF,OAAO,CACL,MAAM,IAAI,CACR,oBAAC,MAAM,IACL,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,IAAI,GACf,CACH,CACF,CAAC;IACJ,CAAC,CACF,CAAC;IACF,OAAO,0CAAG,gBAAgB,CAAI,CAAC;AACjC,CAAC,CAAC","sourcesContent":["import React from 'react';\n\nimport { Schema } from './Schema';\n\nimport { SchemaHelpers } from '../helpers';\n\ninterface Props {\n name?: string;\n bindings: any;\n}\n\nexport const Bindings: React.FunctionComponent<Props> = ({\n name = 'Binding specific information',\n bindings,\n}) => {\n if (!bindings || !Object.keys(bindings).length) {\n return null;\n }\n\n const renderedBindings = Object.entries(bindings).map(\n ([bindingName, binding]) => {\n const schema = SchemaHelpers.jsonToSchema(binding);\n const schemaName = (\n <div className=\"inline-block text-sm\">\n <span>{name}</span>\n <span className=\"bg-teal-500 font-bold no-underline text-white uppercase rounded mx-2 px-2 py-1 text-xs\">\n {bindingName}\n </span>\n </div>\n );\n return (\n schema && (\n <Schema\n schemaName={schemaName}\n schema={schema}\n key={bindingName}\n onlyTitle={true}\n />\n )\n );\n },\n );\n return <>{renderedBindings}</>;\n};\n"]}
|
|
@@ -21,12 +21,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import React from 'react';
|
|
24
|
+
var HiChevronRight = function (props) {
|
|
25
|
+
if (props === void 0) { props = {}; }
|
|
26
|
+
return (React.createElement("svg", __assign({ stroke: "currentColor", fill: "currentColor", strokeWidth: "0", viewBox: "0 0 20 20", height: "1em", width: "1em", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
27
|
+
React.createElement("path", { fillRule: "evenodd", d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", clipRule: "evenodd" })));
|
|
28
|
+
};
|
|
24
29
|
export var CollapseButton = function (_a) {
|
|
25
|
-
var chevronProps = _a.chevronProps, children = _a.children, rest = __rest(_a, ["chevronProps", "children"]);
|
|
26
|
-
return (React.createElement("button", __assign({}, rest, { className: "focus:outline-none "
|
|
27
|
-
children,
|
|
28
|
-
React.createElement(
|
|
29
|
-
'') }),
|
|
30
|
-
React.createElement("polygon", { points: "17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " }))));
|
|
30
|
+
var chevronProps = _a.chevronProps, _b = _a.expanded, expanded = _b === void 0 ? false : _b, children = _a.children, rest = __rest(_a, ["chevronProps", "expanded", "children"]);
|
|
31
|
+
return (React.createElement("button", __assign({}, rest, { className: "focus:outline-none ".concat(rest.className), type: "button" }),
|
|
32
|
+
React.createElement("div", { className: "inline-block" }, children),
|
|
33
|
+
React.createElement(HiChevronRight, __assign({}, chevronProps, { className: "inline-block align-baseline cursor-pointer ml-0.5 -mb-1 w-5 h-5 transform transition-transform duration-150 ease-linear ".concat(expanded ? '-rotate-90' : '', " ").concat((chevronProps === null || chevronProps === void 0 ? void 0 : chevronProps.className) || '') }))));
|
|
31
34
|
};
|
|
32
35
|
//# sourceMappingURL=CollapseButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapseButton.js","sourceRoot":"","sources":["../../../src/components/CollapseButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAA8C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CollapseButton.js","sourceRoot":"","sources":["../../../src/components/CollapseButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAA8C,MAAM,OAAO,CAAC;AAOnE,IAAM,cAAc,GAAG,UAAC,KAAqC;IAArC,sBAAA,EAAA,UAAqC;IAAK,OAAA,CAEhE,sCACE,MAAM,EAAC,cAAc,EACrB,IAAI,EAAC,cAAc,EACnB,WAAW,EAAC,GAAG,EACf,OAAO,EAAC,WAAW,EACnB,MAAM,EAAC,KAAK,EACZ,KAAK,EAAC,KAAK,EACX,KAAK,EAAC,4BAA4B,IAC9B,KAAK;QAET,8BACE,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,oHAAoH,EACtH,QAAQ,EAAC,SAAS,GAClB,CACE,CACP;AAlBiE,CAkBjE,CAAC;AAEF,MAAM,CAAC,IAAM,cAAc,GAAmC,UAAC,EAK9D;IAJC,IAAA,YAAY,kBAAA,EACZ,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,QAAQ,cAAA,EACL,IAAI,cAJsD,wCAK9D,CADQ;IACH,OAAA,CACJ,2CACM,IAAI,IACR,SAAS,EAAE,6BAAsB,IAAI,CAAC,SAAS,CAAE,EACjD,IAAI,EAAC,QAAQ;QAEb,6BAAK,SAAS,EAAC,cAAc,IAAE,QAAQ,CAAO;QAC9C,oBAAC,cAAc,eACT,YAAY,IAChB,SAAS,EAAE,kIACT,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,cAC1B,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,SAAS,KAAI,EAAE,CAAE,IACnC,CACK,CACV,CAAA;CAAA,CAAC","sourcesContent":["import React, { ButtonHTMLAttributes, SVGAttributes } from 'react';\n\ninterface Props extends ButtonHTMLAttributes<HTMLButtonElement> {\n chevronProps?: SVGAttributes<SVGElement>;\n expanded?: boolean;\n}\n\nconst HiChevronRight = (props: SVGAttributes<SVGElement> = {}) => (\n // Copied from https://icon-sets.iconify.design/heroicons-solid/chevron-right/\n <svg\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n viewBox=\"0 0 20 20\"\n height=\"1em\"\n width=\"1em\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z\"\n clipRule=\"evenodd\"\n />\n </svg>\n);\n\nexport const CollapseButton: React.FunctionComponent<Props> = ({\n chevronProps,\n expanded = false,\n children,\n ...rest\n}) => (\n <button\n {...rest}\n className={`focus:outline-none ${rest.className}`}\n type=\"button\"\n >\n <div className=\"inline-block\">{children}</div>\n <HiChevronRight\n {...chevronProps}\n className={`inline-block align-baseline cursor-pointer ml-0.5 -mb-1 w-5 h-5 transform transition-transform duration-150 ease-linear ${\n expanded ? '-rotate-90' : ''\n } ${chevronProps?.className || ''}`}\n />\n </button>\n);\n"]}
|
|
@@ -8,7 +8,7 @@ export var Extensions = function (_a) {
|
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
10
|
var schema = SchemaHelpers.jsonToSchema(extensions);
|
|
11
|
-
return (React.createElement("div", { className: "mt-2" },
|
|
12
|
-
React.createElement(Schema, { schemaName: name, schema: schema })));
|
|
11
|
+
return (schema && (React.createElement("div", { className: "mt-2" },
|
|
12
|
+
React.createElement(Schema, { schemaName: name, schema: schema, onlyTitle: true }))));
|
|
13
13
|
};
|
|
14
14
|
//# sourceMappingURL=Extensions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Extensions.js","sourceRoot":"","sources":["../../../src/components/Extensions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAO3C,MAAM,CAAC,IAAM,UAAU,GAAmC,UAAC,EAG1D;QAFC,YAAmB,EAAnB,IAAI,mBAAG,YAAY,KAAA,EACnB,IAAI,UAAA;IAEJ,IAAM,UAAU,GAAG,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC3D,IAAI,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;QAClD,OAAO,IAAI,CAAC;KACb;IAED,IAAM,MAAM,GAAG,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACtD,OAAO,CACL,6BAAK,SAAS,EAAC,MAAM;QACnB,oBAAC,MAAM,IAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAI,
|
|
1
|
+
{"version":3,"file":"Extensions.js","sourceRoot":"","sources":["../../../src/components/Extensions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAO3C,MAAM,CAAC,IAAM,UAAU,GAAmC,UAAC,EAG1D;QAFC,YAAmB,EAAnB,IAAI,mBAAG,YAAY,KAAA,EACnB,IAAI,UAAA;IAEJ,IAAM,UAAU,GAAG,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC3D,IAAI,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;QAClD,OAAO,IAAI,CAAC;KACb;IAED,IAAM,MAAM,GAAG,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACtD,OAAO,CACL,MAAM,IAAI,CACR,6BAAK,SAAS,EAAC,MAAM;QACnB,oBAAC,MAAM,IAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,GAAI,CACzD,CACP,CACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\n\nimport { Schema } from './Schema';\n\nimport { SchemaHelpers } from '../helpers';\n\ninterface Props {\n name?: string;\n item: any;\n}\n\nexport const Extensions: React.FunctionComponent<Props> = ({\n name = 'Extensions',\n item,\n}) => {\n const extensions = SchemaHelpers.getCustomExtensions(item);\n if (!extensions || !Object.keys(extensions).length) {\n return null;\n }\n\n const schema = SchemaHelpers.jsonToSchema(extensions);\n return (\n schema && (\n <div className=\"mt-2\">\n <Schema schemaName={name} schema={schema} onlyTitle={true} />\n </div>\n )\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Href.js","sourceRoot":"","sources":["../../../src/components/Href.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,CAAC,IAAM,IAAI,GAAmC,UAAC,EAKpD;QAJC,IAAI,UAAA,EACJ,KAAK,WAAA,EACL,SAAS,eAAA,EACT,QAAQ,cAAA;IACJ,OAAA,CACJ,2BACE,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,8BAA8B,IAEjC,QAAQ,CACP,CACL;AAVK,CAUL,CAAC"}
|
|
1
|
+
{"version":3,"file":"Href.js","sourceRoot":"","sources":["../../../src/components/Href.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,CAAC,IAAM,IAAI,GAAmC,UAAC,EAKpD;QAJC,IAAI,UAAA,EACJ,KAAK,WAAA,EACL,SAAS,eAAA,EACT,QAAQ,cAAA;IACJ,OAAA,CACJ,2BACE,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,8BAA8B,IAEjC,QAAQ,CACP,CACL;AAVK,CAUL,CAAC","sourcesContent":["import React from 'react';\n\ninterface Props {\n href: string;\n title?: string;\n className?: string;\n}\n\nexport const Href: React.FunctionComponent<Props> = ({\n href,\n title,\n className,\n children,\n}) => (\n <a\n href={href}\n title={title}\n className={className}\n target=\"_blank\"\n rel=\"nofollow noopener noreferrer\"\n >\n {children}\n </a>\n);\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Markdown } from './index';
|
|
3
|
+
export var JSONSnippet = function (_a) {
|
|
4
|
+
var snippet = _a.snippet;
|
|
5
|
+
if (typeof snippet === 'object') {
|
|
6
|
+
snippet = '```json\n' + JSON.stringify(snippet, undefined, 2) + '\n```';
|
|
7
|
+
}
|
|
8
|
+
return React.createElement(Markdown, null, snippet);
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=JSONSnippet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSONSnippet.js","sourceRoot":"","sources":["../../../src/components/JSONSnippet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAMnC,MAAM,CAAC,IAAM,WAAW,GAAmC,UAAC,EAAW;QAAT,OAAO,aAAA;IACnE,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAE/B,OAAO,GAAG,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC;KACzE;IAED,OAAO,oBAAC,QAAQ,QAAE,OAAO,CAAY,CAAC;AACxC,CAAC,CAAC","sourcesContent":["import React from 'react';\n\nimport { Markdown } from './index';\n\ninterface Props {\n snippet: string | object;\n}\n\nexport const JSONSnippet: React.FunctionComponent<Props> = ({ snippet }) => {\n if (typeof snippet === 'object') {\n // change code to markdown's json code block\n snippet = '```json\\n' + JSON.stringify(snippet, undefined, 2) + '\\n```';\n }\n\n return <Markdown>{snippet}</Markdown>;\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { sanitize } from 'isomorphic-dompurify';
|
|
3
|
-
import
|
|
3
|
+
import { renderMarkdown } from '../helpers';
|
|
4
4
|
export var Markdown = function (_a) {
|
|
5
5
|
var children = _a.children;
|
|
6
6
|
if (!children) {
|
|
@@ -9,7 +9,6 @@ export var Markdown = function (_a) {
|
|
|
9
9
|
if (typeof children !== 'string') {
|
|
10
10
|
return React.createElement(React.Fragment, null, children);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
return (React.createElement("div", { className: "prose max-w-max text-sm", dangerouslySetInnerHTML: { __html: sanitize(html) } }));
|
|
12
|
+
return (React.createElement("div", { className: "prose max-w-none text-sm", dangerouslySetInnerHTML: { __html: sanitize(renderMarkdown(children)) } }));
|
|
14
13
|
};
|
|
15
14
|
//# sourceMappingURL=Markdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.js","sourceRoot":"","sources":["../../../src/components/Markdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Markdown.js","sourceRoot":"","sources":["../../../src/components/Markdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,CAAC,IAAM,QAAQ,GAA4B,UAAC,EAAY;QAAV,QAAQ,cAAA;IAC1D,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,IAAI,CAAC;KACb;IACD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;QAChC,OAAO,0CAAG,QAAQ,CAAI,CAAC;KACxB;IAED,OAAO,CACL,6BACE,SAAS,EAAC,0BAA0B,EACpC,uBAAuB,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,EAAE,GACvE,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { sanitize } from 'isomorphic-dompurify';\n\nimport { renderMarkdown } from '../helpers';\n\nexport const Markdown: React.FunctionComponent = ({ children }) => {\n if (!children) {\n return null;\n }\n if (typeof children !== 'string') {\n return <>{children}</>;\n }\n\n return (\n <div\n className=\"prose max-w-none text-sm\"\n dangerouslySetInnerHTML={{ __html: sanitize(renderMarkdown(children)) }}\n />\n );\n};\n"]}
|
|
@@ -1,37 +1,50 @@
|
|
|
1
|
-
import React, { useState, useContext } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useContext } from 'react';
|
|
2
2
|
import { Href, CollapseButton, Markdown, Extensions } from './index';
|
|
3
3
|
import { SchemaHelpers } from '../helpers';
|
|
4
|
-
var SchemaContext = React.createContext({
|
|
4
|
+
var SchemaContext = React.createContext({
|
|
5
|
+
reverse: false,
|
|
6
|
+
deepExpanded: false,
|
|
7
|
+
});
|
|
5
8
|
export var Schema = function (_a) {
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
9
|
+
var _b, _c, _d, _e, _f;
|
|
10
|
+
var schemaName = _a.schemaName, schema = _a.schema, _g = _a.required, required = _g === void 0 ? false : _g, _h = _a.isPatternProperty, isPatternProperty = _h === void 0 ? false : _h, _j = _a.isProperty, isProperty = _j === void 0 ? false : _j, _k = _a.isCircular, isCircular = _k === void 0 ? false : _k, dependentRequired = _a.dependentRequired, _l = _a.expanded, propExpanded = _l === void 0 ? false : _l, _m = _a.onlyTitle, onlyTitle = _m === void 0 ? false : _m;
|
|
11
|
+
var _o = useContext(SchemaContext), reverse = _o.reverse, deepExpanded = _o.deepExpanded;
|
|
12
|
+
var _p = useState(propExpanded), expanded = _p[0], setExpanded = _p[1];
|
|
13
|
+
var _q = useState(false), deepExpand = _q[0], setDeepExpand = _q[1];
|
|
14
|
+
useEffect(function () {
|
|
15
|
+
setDeepExpand(deepExpanded);
|
|
16
|
+
}, [deepExpanded, setDeepExpand]);
|
|
17
|
+
useEffect(function () {
|
|
18
|
+
setExpanded(deepExpand);
|
|
19
|
+
}, [deepExpand, setExpanded]);
|
|
20
|
+
if (!schema ||
|
|
21
|
+
(typeof schemaName === 'string' &&
|
|
22
|
+
((schemaName === null || schemaName === void 0 ? void 0 : schemaName.startsWith('x-parser-')) ||
|
|
23
|
+
(schemaName === null || schemaName === void 0 ? void 0 : schemaName.startsWith('x-schema-private-'))))) {
|
|
10
24
|
return null;
|
|
11
25
|
}
|
|
12
26
|
var dependentSchemas = SchemaHelpers.getDependentSchemas(schema);
|
|
13
27
|
var constraints = SchemaHelpers.humanizeConstraints(schema);
|
|
14
28
|
var externalDocs = schema.externalDocs();
|
|
15
|
-
var
|
|
16
|
-
var rawValue =
|
|
17
|
-
var
|
|
29
|
+
var rawValueExt = schema.extensions().get(SchemaHelpers.extRawValue);
|
|
30
|
+
var rawValue = (rawValueExt === null || rawValueExt === void 0 ? void 0 : rawValueExt.value()) === true;
|
|
31
|
+
var parameterLocationExt = schema
|
|
32
|
+
.extensions()
|
|
33
|
+
.get(SchemaHelpers.extParameterLocation);
|
|
34
|
+
var parameterLocation = (parameterLocationExt === null || parameterLocationExt === void 0 ? void 0 : parameterLocationExt.value()) === true;
|
|
35
|
+
var schemaType = SchemaHelpers.toSchemaType(schema);
|
|
18
36
|
var isExpandable = SchemaHelpers.isExpandable(schema) || dependentSchemas;
|
|
19
|
-
isCircular = isCircular || schema.
|
|
20
|
-
var uid = schema
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
typeof schema.items().uid === 'function') {
|
|
25
|
-
uid = schema.items().uid();
|
|
26
|
-
}
|
|
27
|
-
return (React.createElement(SchemaContext.Provider, { value: { reverse: !reverse } },
|
|
37
|
+
isCircular = isCircular || schema.isCircular() || false;
|
|
38
|
+
var uid = schema.$id();
|
|
39
|
+
var styledSchemaName = isProperty ? 'italic' : '';
|
|
40
|
+
var renderedSchemaName = typeof schemaName === 'string' ? (React.createElement("span", { className: "break-anywhere text-sm ".concat(styledSchemaName) }, schemaName)) : (schemaName);
|
|
41
|
+
return (React.createElement(SchemaContext.Provider, { value: { reverse: !reverse, deepExpanded: deepExpand } },
|
|
28
42
|
React.createElement("div", null,
|
|
29
43
|
React.createElement("div", { className: "flex py-2" },
|
|
30
|
-
React.createElement("div", { className: "
|
|
31
|
-
isExpandable && !isCircular ? (React.createElement(
|
|
32
|
-
|
|
33
|
-
} },
|
|
34
|
-
React.createElement("span", { className: "break-words text-sm " + (isProperty ? 'italic' : '') }, schemaName))) : (React.createElement("span", { className: "break-words text-sm " + (isProperty ? 'italic' : '') }, schemaName)),
|
|
44
|
+
React.createElement("div", { className: "".concat(onlyTitle ? '' : 'min-w-1/4', " mr-2") },
|
|
45
|
+
isExpandable && !isCircular ? (React.createElement(React.Fragment, null,
|
|
46
|
+
React.createElement(CollapseButton, { onClick: function () { return setExpanded(function (prev) { return !prev; }); }, expanded: expanded }, renderedSchemaName),
|
|
47
|
+
React.createElement("button", { type: "button", onClick: function () { return setDeepExpand(function (prev) { return !prev; }); }, className: "ml-1 text-sm text-gray-500" }, deepExpand ? 'Collapse all' : 'Expand all'))) : (React.createElement("span", { className: "break-anywhere text-sm ".concat(isProperty ? 'italic' : '') }, schemaName)),
|
|
35
48
|
isPatternProperty && (React.createElement("div", { className: "text-gray-500 text-xs italic" }, "(pattern property)")),
|
|
36
49
|
required && React.createElement("div", { className: "text-red-600 text-xs" }, "required"),
|
|
37
50
|
dependentRequired && (React.createElement(React.Fragment, null,
|
|
@@ -41,16 +54,14 @@ export var Schema = function (_a) {
|
|
|
41
54
|
schema.writeOnly() && (React.createElement("div", { className: "text-gray-500 text-xs" }, "write-only")),
|
|
42
55
|
schema.readOnly() && (React.createElement("div", { className: "text-gray-500 text-xs" }, "read-only"))),
|
|
43
56
|
rawValue ? (React.createElement("div", null,
|
|
44
|
-
React.createElement("div", { className: "text-sm" }, schema.const()))) : (React.createElement("div", null,
|
|
57
|
+
React.createElement("div", { className: "text-sm" }, SchemaHelpers.prettifyValue(schema.const(), false)))) : (React.createElement("div", null,
|
|
45
58
|
React.createElement("div", null,
|
|
46
|
-
|
|
47
|
-
? SchemaHelpers.toSchemaType(schema) + " [CIRCULAR]"
|
|
48
|
-
: SchemaHelpers.toSchemaType(schema))),
|
|
59
|
+
React.createElement("div", { className: "capitalize text-sm text-teal-500 font-bold inline-block mr-2" }, isCircular ? "".concat(schemaType, " [CIRCULAR]") : schemaType),
|
|
49
60
|
React.createElement("div", { className: "inline-block" },
|
|
50
61
|
schema.format() && (React.createElement("span", { className: "bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs" },
|
|
51
62
|
"format: ",
|
|
52
63
|
schema.format())),
|
|
53
|
-
schema.pattern() !== undefined && (React.createElement("span", { className: "bg-yellow-600 font-bold no-underline text-white rounded
|
|
64
|
+
schema.pattern() !== undefined && (React.createElement("span", { className: "bg-yellow-600 font-bold no-underline text-white rounded mr-2 p-1 text-xs" },
|
|
54
65
|
"must match: ",
|
|
55
66
|
schema.pattern())),
|
|
56
67
|
schema.contentMediaType() !== undefined && (React.createElement("span", { className: "bg-yellow-600 font-bold no-underline text-white rounded lowercase mr-2 p-1 text-xs" },
|
|
@@ -64,7 +75,7 @@ export var Schema = function (_a) {
|
|
|
64
75
|
uid && !uid.startsWith('<anonymous-') && (React.createElement("span", { className: "border text-orange-600 rounded mr-2 p-1 text-xs" },
|
|
65
76
|
"uid: ",
|
|
66
77
|
uid))),
|
|
67
|
-
schema.
|
|
78
|
+
schema.description() !== undefined && (React.createElement("div", null,
|
|
68
79
|
React.createElement(Markdown, null, schema.description()))),
|
|
69
80
|
schema.default() !== undefined && (React.createElement("div", { className: "text-xs" },
|
|
70
81
|
"Default value:",
|
|
@@ -74,8 +85,8 @@ export var Schema = function (_a) {
|
|
|
74
85
|
React.createElement("span", { className: "border inline-block text-orange-600 rounded ml-1 py-0 px-2" }, SchemaHelpers.prettifyValue(schema.const())))),
|
|
75
86
|
schema.enum() && (React.createElement("ul", { className: "text-xs" },
|
|
76
87
|
"Allowed values:",
|
|
77
|
-
' ',
|
|
78
|
-
|
|
88
|
+
' ', (_b = schema.enum()) === null || _b === void 0 ? void 0 :
|
|
89
|
+
_b.map(function (e, idx) { return (React.createElement("li", { key: idx, className: "border inline-block text-orange-600 rounded ml-1 py-0 px-2" },
|
|
79
90
|
React.createElement("span", null, SchemaHelpers.prettifyValue(e)))); }))),
|
|
80
91
|
parameterLocation && (React.createElement("div", { className: "text-xs" },
|
|
81
92
|
"Parameter location:",
|
|
@@ -85,24 +96,21 @@ export var Schema = function (_a) {
|
|
|
85
96
|
React.createElement(Href, { href: externalDocs.url(), title: externalDocs.description() || '' }, "Documentation"))),
|
|
86
97
|
schema.examples() && (React.createElement("ul", { className: "text-xs" },
|
|
87
98
|
"Examples values:",
|
|
88
|
-
' ',
|
|
89
|
-
|
|
99
|
+
' ', (_c = schema.examples()) === null || _c === void 0 ? void 0 :
|
|
100
|
+
_c.map(function (e, idx) { return (React.createElement("li", { key: idx, className: "border inline-block text-orange-600 rounded ml-1 py-0 px-2 break-all" },
|
|
90
101
|
React.createElement("span", null, SchemaHelpers.prettifyValue(e)))); }))))))),
|
|
91
|
-
isCircular || !isExpandable ? null : (React.createElement("div", { className: "rounded p-4 py-2
|
|
102
|
+
isCircular || !isExpandable ? null : (React.createElement("div", { className: "rounded p-4 py-2 border bg-gray-100 ".concat(reverse ? 'bg-gray-200' : '', " ").concat(expanded ? 'block' : 'hidden') },
|
|
92
103
|
React.createElement(SchemaProperties, { schema: schema }),
|
|
93
104
|
React.createElement(SchemaItems, { schema: schema }),
|
|
94
105
|
schema.oneOf() &&
|
|
95
|
-
schema
|
|
96
|
-
.oneOf()
|
|
97
|
-
.map(function (s, idx) { return (React.createElement(Schema, { key: idx, schema: s, schemaName: idx === 0 ? 'Adheres to:' : 'Or to:' })); }),
|
|
106
|
+
((_d = schema
|
|
107
|
+
.oneOf()) === null || _d === void 0 ? void 0 : _d.map(function (s, idx) { return (React.createElement(Schema, { key: idx, schema: s, schemaName: idx === 0 ? 'Adheres to:' : 'Or to:' })); })),
|
|
98
108
|
schema.anyOf() &&
|
|
99
|
-
schema
|
|
100
|
-
.anyOf()
|
|
101
|
-
.map(function (s, idx) { return (React.createElement(Schema, { key: idx, schema: s, schemaName: idx === 0 ? 'Can adhere to:' : 'Or to:' })); }),
|
|
109
|
+
((_e = schema
|
|
110
|
+
.anyOf()) === null || _e === void 0 ? void 0 : _e.map(function (s, idx) { return (React.createElement(Schema, { key: idx, schema: s, schemaName: idx === 0 ? 'Can adhere to:' : 'Or to:' })); })),
|
|
102
111
|
schema.allOf() &&
|
|
103
|
-
schema
|
|
104
|
-
.allOf()
|
|
105
|
-
.map(function (s, idx) { return (React.createElement(Schema, { key: idx, schema: s, schemaName: idx === 0 ? 'Consists of:' : 'And with:' })); }),
|
|
112
|
+
((_f = schema
|
|
113
|
+
.allOf()) === null || _f === void 0 ? void 0 : _f.map(function (s, idx) { return (React.createElement(Schema, { key: idx, schema: s, schemaName: idx === 0 ? 'Consists of:' : 'And with:' })); })),
|
|
106
114
|
schema.not() && (React.createElement(Schema, { schema: schema.not(), schemaName: "Cannot adhere to:" })),
|
|
107
115
|
schema.propertyNames() && (React.createElement(Schema, { schema: schema.propertyNames(), schemaName: "Property names must adhere to:" })),
|
|
108
116
|
schema.contains() && (React.createElement(Schema, { schema: schema.contains(), schemaName: "Array must contain at least one of:" })),
|
|
@@ -122,25 +130,26 @@ var SchemaProperties = function (_a) {
|
|
|
122
130
|
}
|
|
123
131
|
var required = schema.required() || [];
|
|
124
132
|
var patternProperties = schema.patternProperties();
|
|
125
|
-
var circularProps = schema.circularProps() || [];
|
|
126
133
|
return (React.createElement(React.Fragment, null,
|
|
127
134
|
Object.entries(properties).map(function (_a) {
|
|
128
135
|
var propertyName = _a[0], property = _a[1];
|
|
129
|
-
return (React.createElement(Schema, { schema: property, schemaName: propertyName, required: required.includes(propertyName), isCircular:
|
|
136
|
+
return (React.createElement(Schema, { schema: property, schemaName: propertyName, required: required.includes(propertyName), isProperty: true, isCircular: property.isCircular(), dependentRequired: SchemaHelpers.getDependentRequired(propertyName, schema), key: propertyName }));
|
|
130
137
|
}),
|
|
131
|
-
Object.entries(patternProperties).map(function (_a) {
|
|
138
|
+
Object.entries(patternProperties || {}).map(function (_a) {
|
|
132
139
|
var propertyName = _a[0], property = _a[1];
|
|
133
|
-
return (React.createElement(Schema, { schema: property, schemaName: propertyName,
|
|
140
|
+
return (React.createElement(Schema, { schema: property, schemaName: propertyName, isPatternProperty: true, isProperty: true, isCircular: property.isCircular(), key: propertyName }));
|
|
134
141
|
})));
|
|
135
142
|
};
|
|
136
143
|
var AdditionalProperties = function (_a) {
|
|
144
|
+
var _b;
|
|
137
145
|
var schema = _a.schema;
|
|
138
|
-
if (
|
|
146
|
+
if (((_b = schema
|
|
147
|
+
.extensions()
|
|
148
|
+
.get(SchemaHelpers.extRenderAdditionalInfo)) === null || _b === void 0 ? void 0 : _b.value()) === false) {
|
|
139
149
|
return null;
|
|
140
150
|
}
|
|
141
151
|
var type = schema.type();
|
|
142
|
-
|
|
143
|
-
if (!type.includes('object')) {
|
|
152
|
+
if (type === undefined || !type.includes('object')) {
|
|
144
153
|
return null;
|
|
145
154
|
}
|
|
146
155
|
var additionalProperties = schema.additionalProperties();
|
|
@@ -158,27 +167,30 @@ var AdditionalProperties = function (_a) {
|
|
|
158
167
|
var SchemaItems = function (_a) {
|
|
159
168
|
var schema = _a.schema;
|
|
160
169
|
var type = schema.type();
|
|
161
|
-
|
|
162
|
-
if (!type.includes('array')) {
|
|
170
|
+
if (type === undefined || !type.includes('array')) {
|
|
163
171
|
return null;
|
|
164
172
|
}
|
|
165
173
|
var items = schema.items();
|
|
166
|
-
if (items &&
|
|
174
|
+
if (items &&
|
|
175
|
+
!Array.isArray(items) &&
|
|
176
|
+
Object.keys(items.properties() || {}).length) {
|
|
167
177
|
return React.createElement(SchemaProperties, { schema: items });
|
|
168
178
|
}
|
|
169
179
|
else if (Array.isArray(items)) {
|
|
170
|
-
return (React.createElement(React.Fragment, null, items.map(function (item, idx) { return (React.createElement(Schema, { schema: item, schemaName: idx + 1
|
|
180
|
+
return (React.createElement(React.Fragment, null, items.map(function (item, idx) { return (React.createElement(Schema, { schema: item, schemaName: "".concat(idx + 1, " item:"), key: idx })); })));
|
|
171
181
|
}
|
|
172
182
|
return React.createElement(Schema, { schema: items, schemaName: "Items:" });
|
|
173
183
|
};
|
|
174
184
|
var AdditionalItems = function (_a) {
|
|
185
|
+
var _b;
|
|
175
186
|
var schema = _a.schema;
|
|
176
|
-
if (
|
|
187
|
+
if (((_b = schema
|
|
188
|
+
.extensions()
|
|
189
|
+
.get(SchemaHelpers.extRenderAdditionalInfo)) === null || _b === void 0 ? void 0 : _b.value()) === false) {
|
|
177
190
|
return null;
|
|
178
191
|
}
|
|
179
192
|
var type = schema.type();
|
|
180
|
-
|
|
181
|
-
if (!type.includes('array')) {
|
|
193
|
+
if (type === undefined || !type.includes('array')) {
|
|
182
194
|
return null;
|
|
183
195
|
}
|
|
184
196
|
if (!Array.isArray(schema.items())) {
|