@stoplight/elements-core 9.0.5 → 9.0.7
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/components/Docs/Docs.d.ts +1 -4
- package/components/Docs/HttpOperation/Body.d.ts +1 -7
- package/components/Docs/HttpOperation/HttpOperation.d.ts +2 -6
- package/components/Docs/HttpOperation/Request.d.ts +0 -6
- package/components/Docs/HttpOperation/Responses.d.ts +1 -11
- package/index.d.ts +2 -2
- package/index.esm.js +22 -416
- package/index.js +22 -416
- package/index.mjs +22 -416
- package/package.json +1 -1
- package/components/Docs/HttpOperation/LazySchemaTreePreviewer.d.ts +0 -25
package/index.esm.js
CHANGED
|
@@ -114,8 +114,6 @@ const isResolvedObjectProxy = (someObject) => {
|
|
|
114
114
|
return !!someObject[originalObjectSymbol];
|
|
115
115
|
};
|
|
116
116
|
const getOriginalObject = (resolvedObject) => {
|
|
117
|
-
if (!resolvedObject)
|
|
118
|
-
return resolvedObject;
|
|
119
117
|
const originalObject = resolvedObject[originalObjectSymbol] || resolvedObject;
|
|
120
118
|
if (!originalObject) {
|
|
121
119
|
return resolvedObject;
|
|
@@ -2736,349 +2734,13 @@ const PanelContent = ({ schemes }) => {
|
|
|
2736
2734
|
})));
|
|
2737
2735
|
};
|
|
2738
2736
|
|
|
2739
|
-
const TYPES = ['string', 'integer', 'boolean', 'any', 'number'];
|
|
2740
|
-
function resolvePointer(obj, pointer) {
|
|
2741
|
-
const parts = pointer.replace(/^#\//, '').split('/');
|
|
2742
|
-
return parts.reduce((acc, key) => acc && acc[key], obj);
|
|
2743
|
-
}
|
|
2744
|
-
function detectCircularPath(path) {
|
|
2745
|
-
const ignored = ['properties', 'items'];
|
|
2746
|
-
const parts = path.split('/').filter(part => !ignored.includes(part));
|
|
2747
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
2748
|
-
const current = parts[i];
|
|
2749
|
-
const rest = parts.slice(i + 1);
|
|
2750
|
-
if (rest.includes(current)) {
|
|
2751
|
-
return true;
|
|
2752
|
-
}
|
|
2753
|
-
}
|
|
2754
|
-
return false;
|
|
2755
|
-
}
|
|
2756
|
-
function dereference(node, root, visited = new WeakSet(), depth = 0, maxDepth = 10) {
|
|
2757
|
-
if (!node || typeof node !== 'object')
|
|
2758
|
-
return node;
|
|
2759
|
-
if (depth > maxDepth)
|
|
2760
|
-
return node;
|
|
2761
|
-
if (node.$ref || node['x-iata-$ref']) {
|
|
2762
|
-
let refPath = node.$ref || node['x-iata-$ref'];
|
|
2763
|
-
if (refPath.includes('#/%24defs')) {
|
|
2764
|
-
refPath = refPath.replace('#/%24defs', '$defs');
|
|
2765
|
-
}
|
|
2766
|
-
else {
|
|
2767
|
-
refPath = refPath.replace('__bundled__', 'definitions');
|
|
2768
|
-
}
|
|
2769
|
-
if (visited.has(node))
|
|
2770
|
-
return { circular: true, $ref: refPath, title: node.title, type: 'any', description: node.description };
|
|
2771
|
-
visited.add(node);
|
|
2772
|
-
const target = resolvePointer(root, refPath);
|
|
2773
|
-
if (!target)
|
|
2774
|
-
return node;
|
|
2775
|
-
const result = Object.assign({}, target);
|
|
2776
|
-
if ('description' in node)
|
|
2777
|
-
result.description = node.description;
|
|
2778
|
-
if ('title' in node)
|
|
2779
|
-
result.title = node.title;
|
|
2780
|
-
return dereference(result, root, visited, depth + 1, maxDepth);
|
|
2781
|
-
}
|
|
2782
|
-
if (Array.isArray(node)) {
|
|
2783
|
-
return node.map(item => dereference(item, root, visited, depth + 1, maxDepth));
|
|
2784
|
-
}
|
|
2785
|
-
const result = {};
|
|
2786
|
-
for (const key in node) {
|
|
2787
|
-
result[key] = dereference(node[key], root, visited, depth + 1, maxDepth);
|
|
2788
|
-
}
|
|
2789
|
-
return result;
|
|
2790
|
-
}
|
|
2791
|
-
const trimSlashes = (str) => {
|
|
2792
|
-
return str.replace(/^\/|\/$/g, '');
|
|
2793
|
-
};
|
|
2794
|
-
function isPropertiesAllHidden(path, hideData) {
|
|
2795
|
-
const current = trimSlashes(path);
|
|
2796
|
-
const parts = current.split('/');
|
|
2797
|
-
for (let i = parts.length; i >= 2; i--) {
|
|
2798
|
-
if (parts[i - 1] === 'properties') {
|
|
2799
|
-
const ancestorPropPath = parts.slice(0, i).join('/');
|
|
2800
|
-
const block = hideData.find(h => trimSlashes(h.path) === ancestorPropPath && ancestorPropPath.endsWith('/properties'));
|
|
2801
|
-
if (block && block.required === undefined) {
|
|
2802
|
-
return true;
|
|
2803
|
-
}
|
|
2804
|
-
}
|
|
2805
|
-
}
|
|
2806
|
-
return false;
|
|
2807
|
-
}
|
|
2808
|
-
function isRequiredOverride(path, hideData) {
|
|
2809
|
-
const entry = hideData.find(h => trimSlashes(h.path) === trimSlashes(path));
|
|
2810
|
-
return entry && typeof entry.required === 'boolean' ? entry.required : undefined;
|
|
2811
|
-
}
|
|
2812
|
-
function isPathHidden(path, hideData) {
|
|
2813
|
-
const normalizedPath = trimSlashes(path);
|
|
2814
|
-
const direct = hideData.find(h => trimSlashes(h.path) === normalizedPath);
|
|
2815
|
-
if (direct && direct.required === undefined)
|
|
2816
|
-
return true;
|
|
2817
|
-
if (isPropertiesAllHidden(path, hideData))
|
|
2818
|
-
return true;
|
|
2819
|
-
for (const h of hideData) {
|
|
2820
|
-
const hPath = trimSlashes(h.path);
|
|
2821
|
-
if (h.required !== undefined)
|
|
2822
|
-
continue;
|
|
2823
|
-
if (normalizedPath.length > hPath.length &&
|
|
2824
|
-
normalizedPath.startsWith(hPath) &&
|
|
2825
|
-
(hPath.endsWith('/items') || (hPath.match(/\/items\/[^\/]+$/) && normalizedPath.startsWith(hPath + '/')))) {
|
|
2826
|
-
return true;
|
|
2827
|
-
}
|
|
2828
|
-
}
|
|
2829
|
-
return false;
|
|
2830
|
-
}
|
|
2831
|
-
const LazySchemaTreePreviewer = ({ schema, root = schema, title, level = 1, path = '', hideData = [], parentRequired, propertyKey, _subType, }) => {
|
|
2832
|
-
var _a, _b, _c, _d;
|
|
2833
|
-
const [expanded, setExpanded] = useState(false);
|
|
2834
|
-
const [selectedSchemaIndex, setSelectedSchemaIndex] = useState(0);
|
|
2835
|
-
const [showSchemaDropdown, setShowSchemaDropdown] = useState(false);
|
|
2836
|
-
const [isHoveringSelector, setIsHoveringSelector] = useState(false);
|
|
2837
|
-
const isRoot = level === 1 && (title === undefined || path === '');
|
|
2838
|
-
useState(() => {
|
|
2839
|
-
const disabledPaths = hideData || [];
|
|
2840
|
-
const initialState = {};
|
|
2841
|
-
if (disabledPaths) {
|
|
2842
|
-
for (const p of disabledPaths) {
|
|
2843
|
-
const { path } = p;
|
|
2844
|
-
initialState[path] = { checked: false, required: 0 };
|
|
2845
|
-
}
|
|
2846
|
-
}
|
|
2847
|
-
return initialState;
|
|
2848
|
-
});
|
|
2849
|
-
useEffect(() => {
|
|
2850
|
-
setSelectedSchemaIndex(0);
|
|
2851
|
-
}, [schema === null || schema === void 0 ? void 0 : schema.anyOf, schema === null || schema === void 0 ? void 0 : schema.oneOf]);
|
|
2852
|
-
const thisNodeRequiredOverride = isRequiredOverride(path, hideData);
|
|
2853
|
-
const shouldHideAllChildren = (isRoot && hideData.some(h => trimSlashes(h.path) === 'properties' && h.required === undefined)) ||
|
|
2854
|
-
(!isRoot && isPropertiesAllHidden(path, hideData));
|
|
2855
|
-
const shouldHideNode = useMemo(() => {
|
|
2856
|
-
if (isRoot)
|
|
2857
|
-
return false;
|
|
2858
|
-
if (isPathHidden(path, hideData) && thisNodeRequiredOverride === undefined)
|
|
2859
|
-
return true;
|
|
2860
|
-
return false;
|
|
2861
|
-
}, [path, hideData, isRoot, thisNodeRequiredOverride]);
|
|
2862
|
-
if (!schema || shouldHideNode) {
|
|
2863
|
-
return null;
|
|
2864
|
-
}
|
|
2865
|
-
const displayTitle = level === 1 && (title === undefined || path === '') ? '' : (_a = title !== null && title !== void 0 ? title : schema === null || schema === void 0 ? void 0 : schema.title) !== null && _a !== void 0 ? _a : 'Node';
|
|
2866
|
-
const handleToggle = () => {
|
|
2867
|
-
const circular = detectCircularPath(path);
|
|
2868
|
-
if (!circular) {
|
|
2869
|
-
setExpanded(prev => !prev);
|
|
2870
|
-
}
|
|
2871
|
-
};
|
|
2872
|
-
const renderChildren = () => {
|
|
2873
|
-
var _a, _b, _c, _d;
|
|
2874
|
-
if (shouldHideAllChildren)
|
|
2875
|
-
return null;
|
|
2876
|
-
if (!expanded && !isRoot)
|
|
2877
|
-
return null;
|
|
2878
|
-
const children = [];
|
|
2879
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'object' && ((schema === null || schema === void 0 ? void 0 : schema.properties) || (schema === null || schema === void 0 ? void 0 : schema.allOf) || (schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf))) {
|
|
2880
|
-
let props = schema === null || schema === void 0 ? void 0 : schema.properties;
|
|
2881
|
-
if (schema === null || schema === void 0 ? void 0 : schema.allOf) {
|
|
2882
|
-
schema === null || schema === void 0 ? void 0 : schema.allOf.forEach((item) => {
|
|
2883
|
-
props = Object.assign(Object.assign({}, props), item.properties);
|
|
2884
|
-
});
|
|
2885
|
-
}
|
|
2886
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) && (schema === null || schema === void 0 ? void 0 : schema.anyOf.length) > 0) {
|
|
2887
|
-
const selectedSchema = (schema === null || schema === void 0 ? void 0 : schema.anyOf[selectedSchemaIndex]) || (schema === null || schema === void 0 ? void 0 : schema.anyOf[0]);
|
|
2888
|
-
props = Object.assign(Object.assign({}, props), selectedSchema.properties);
|
|
2889
|
-
}
|
|
2890
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.oneOf) && (schema === null || schema === void 0 ? void 0 : schema.oneOf.length) > 0) {
|
|
2891
|
-
const selectedSchema = (schema === null || schema === void 0 ? void 0 : schema.oneOf[selectedSchemaIndex]) || (schema === null || schema === void 0 ? void 0 : schema.oneOf[0]);
|
|
2892
|
-
props = Object.assign(Object.assign({}, props), selectedSchema.properties);
|
|
2893
|
-
}
|
|
2894
|
-
for (const [key, child] of Object.entries(props || {})) {
|
|
2895
|
-
const childPath = `${path}/properties/${key}`;
|
|
2896
|
-
const childRequiredOverride = isRequiredOverride(childPath, hideData);
|
|
2897
|
-
const shouldHideChild = isPathHidden(childPath, hideData) && childRequiredOverride === undefined;
|
|
2898
|
-
const resolved = dereference(child, root);
|
|
2899
|
-
if (!shouldHideChild) {
|
|
2900
|
-
children.push(React__default.createElement("li", { key: key },
|
|
2901
|
-
React__default.createElement(LazySchemaTreePreviewer, { schema: resolved, root: root, title: key, level: level + 1, path: childPath, hideData: hideData, parentRequired: schema === null || schema === void 0 ? void 0 : schema.required, propertyKey: key, _subType: (_a = resolved === null || resolved === void 0 ? void 0 : resolved.items) === null || _a === void 0 ? void 0 : _a.type })));
|
|
2902
|
-
}
|
|
2903
|
-
}
|
|
2904
|
-
}
|
|
2905
|
-
else if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'array' &&
|
|
2906
|
-
(schema === null || schema === void 0 ? void 0 : schema.items) &&
|
|
2907
|
-
Object.keys(schema === null || schema === void 0 ? void 0 : schema.items).length > 0 &&
|
|
2908
|
-
!((_b = schema === null || schema === void 0 ? void 0 : schema.items) === null || _b === void 0 ? void 0 : _b.circular)) {
|
|
2909
|
-
const resolvedItems = dereference(schema === null || schema === void 0 ? void 0 : schema.items, root);
|
|
2910
|
-
const itemsPath = `${path}/items`;
|
|
2911
|
-
if (resolvedItems && resolvedItems.type === 'object' && resolvedItems.properties) {
|
|
2912
|
-
for (const [key, child] of Object.entries(resolvedItems.properties)) {
|
|
2913
|
-
const childPath = `${itemsPath}/${key}`;
|
|
2914
|
-
const childRequiredOverride = isRequiredOverride(childPath, hideData);
|
|
2915
|
-
const shouldHideChild = isPathHidden(childPath, hideData) && childRequiredOverride === undefined;
|
|
2916
|
-
if (!shouldHideChild) {
|
|
2917
|
-
children.push(React__default.createElement("li", { key: key },
|
|
2918
|
-
React__default.createElement(LazySchemaTreePreviewer, { schema: dereference(child, root), root: root, title: key, level: level + 2, path: childPath, hideData: hideData, parentRequired: resolvedItems.required, propertyKey: key, _subType: (_c = resolvedItems === null || resolvedItems === void 0 ? void 0 : resolvedItems.items) === null || _c === void 0 ? void 0 : _c.type })));
|
|
2919
|
-
}
|
|
2920
|
-
}
|
|
2921
|
-
}
|
|
2922
|
-
else if (resolvedItems && resolvedItems.type === 'array' && resolvedItems.items.length > 0) {
|
|
2923
|
-
const childPath = `${path}/items`;
|
|
2924
|
-
const childRequiredOverride = isRequiredOverride(childPath, hideData);
|
|
2925
|
-
const shouldHideChild = isPathHidden(childPath, hideData) && childRequiredOverride === undefined;
|
|
2926
|
-
if (!shouldHideChild) {
|
|
2927
|
-
children.push(React__default.createElement("li", { key: "items" },
|
|
2928
|
-
React__default.createElement(LazySchemaTreePreviewer, { schema: resolvedItems, root: root, title: "items", level: level + 1, path: childPath, hideData: hideData, parentRequired: schema === null || schema === void 0 ? void 0 : schema.required, propertyKey: "items", _subType: (_d = resolvedItems === null || resolvedItems === void 0 ? void 0 : resolvedItems.items) === null || _d === void 0 ? void 0 : _d.type })));
|
|
2929
|
-
}
|
|
2930
|
-
}
|
|
2931
|
-
}
|
|
2932
|
-
return children.length > 0 ? React__default.createElement("ul", { className: "ml-6 border-l border-gray-200 pl-2" }, children) : null;
|
|
2933
|
-
};
|
|
2934
|
-
const combinedSchemaSelector = () => {
|
|
2935
|
-
var _a;
|
|
2936
|
-
return (React__default.createElement(React__default.Fragment, null,
|
|
2937
|
-
React__default.createElement(Box, { pos: "fixed", top: 0, left: 0, right: 0, bottom: 0, bg: "transparent", style: { zIndex: 999 }, onClick: () => setShowSchemaDropdown(false) }),
|
|
2938
|
-
React__default.createElement(Box, { pos: "absolute", bg: "canvas", rounded: true, boxShadow: "md", style: {
|
|
2939
|
-
zIndex: 1000,
|
|
2940
|
-
top: '100%',
|
|
2941
|
-
left: 0,
|
|
2942
|
-
minWidth: '150px',
|
|
2943
|
-
maxWidth: '200px',
|
|
2944
|
-
marginTop: '2px',
|
|
2945
|
-
border: '1px solid rgba(0, 0, 0, 0.1)',
|
|
2946
|
-
}, fontSize: "sm", onClick: (e) => e.stopPropagation() }, (_a = ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf))) === null || _a === void 0 ? void 0 : _a.map((schemaOption, index) => (React__default.createElement(Box, { key: index, px: 3, py: 2, cursor: "pointer", bg: selectedSchemaIndex === index ? 'primary-tint' : 'canvas', fontSize: "xs", display: "flex", alignItems: "center", style: {
|
|
2947
|
-
borderBottom: index < ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)).length - 1 ? '1px solid rgba(0, 0, 0, 0.1)' : 'none',
|
|
2948
|
-
gap: '8px',
|
|
2949
|
-
}, onMouseEnter: (e) => {
|
|
2950
|
-
if (selectedSchemaIndex !== index) {
|
|
2951
|
-
e.currentTarget.style.backgroundColor = 'var(--sl-color-canvas-tint)';
|
|
2952
|
-
}
|
|
2953
|
-
}, onMouseLeave: (e) => {
|
|
2954
|
-
if (selectedSchemaIndex !== index) {
|
|
2955
|
-
e.currentTarget.style.backgroundColor = 'var(--sl-color-canvas)';
|
|
2956
|
-
}
|
|
2957
|
-
}, onClick: () => {
|
|
2958
|
-
setSelectedSchemaIndex(index);
|
|
2959
|
-
setShowSchemaDropdown(false);
|
|
2960
|
-
} },
|
|
2961
|
-
React__default.createElement(Box, { flex: 1, color: "body" }, schemaOption.type || 'object'),
|
|
2962
|
-
selectedSchemaIndex === index && (React__default.createElement(Box, { color: "primary", fontSize: "xs" }, "\u2713"))))))));
|
|
2963
|
-
};
|
|
2964
|
-
const renderMinEnums = (schema) => {
|
|
2965
|
-
if (!schema || typeof schema !== 'object')
|
|
2966
|
-
return null;
|
|
2967
|
-
const boxStyle = {
|
|
2968
|
-
background: 'rgba(245, 247, 250, 0.5)',
|
|
2969
|
-
border: '1px solid #a0aec0',
|
|
2970
|
-
borderRadius: '4px',
|
|
2971
|
-
padding: '0px 2px',
|
|
2972
|
-
display: 'inline-block',
|
|
2973
|
-
overflowWrap: 'break-word',
|
|
2974
|
-
textAlign: 'left',
|
|
2975
|
-
maxWidth: 'fit-content',
|
|
2976
|
-
maxHeight: 'fit-content',
|
|
2977
|
-
};
|
|
2978
|
-
if ('minItems' in schema) {
|
|
2979
|
-
const schemaWithMinItems = schema;
|
|
2980
|
-
if (typeof schemaWithMinItems.minItems === 'number') {
|
|
2981
|
-
return (React__default.createElement(Box, { className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: boxStyle }, `>=${schemaWithMinItems.minItems} items`));
|
|
2982
|
-
}
|
|
2983
|
-
}
|
|
2984
|
-
if ('enum' in schema && Array.isArray(schema.enum)) {
|
|
2985
|
-
return (React__default.createElement("div", null,
|
|
2986
|
-
"Allowed values:",
|
|
2987
|
-
' ',
|
|
2988
|
-
schema.enum.map((val, idx) => (React__default.createElement(Box, { key: idx, className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: boxStyle }, val)))));
|
|
2989
|
-
}
|
|
2990
|
-
return null;
|
|
2991
|
-
};
|
|
2992
|
-
const isRequired = parentRequired && propertyKey && parentRequired.includes(propertyKey);
|
|
2993
|
-
let showRequiredLabel = false;
|
|
2994
|
-
const hideDataEntry = hideData.find(hideEntry => trimSlashes(hideEntry.path) === trimSlashes(path));
|
|
2995
|
-
if ((hideDataEntry === null || hideDataEntry === void 0 ? void 0 : hideDataEntry.required) === true || ((hideDataEntry === null || hideDataEntry === void 0 ? void 0 : hideDataEntry.required) === undefined && isRequired)) {
|
|
2996
|
-
showRequiredLabel = true;
|
|
2997
|
-
}
|
|
2998
|
-
if (schema === null || schema === void 0 ? void 0 : schema.$ref) {
|
|
2999
|
-
schema = dereference(schema, root);
|
|
3000
|
-
}
|
|
3001
|
-
return (React__default.createElement("div", { className: "mb-1" },
|
|
3002
|
-
React__default.createElement(Flex, { maxW: "full", pl: 3, py: 2, "data-test": "schema-row", pos: "relative" },
|
|
3003
|
-
React__default.createElement(VStack, { spacing: 1, maxW: "full", className: "w-full" },
|
|
3004
|
-
React__default.createElement(Flex, { onClick: !isRoot ? handleToggle : undefined, className: `w-full ${isRoot ? '' : 'cursor-pointer'}` },
|
|
3005
|
-
!isRoot ? (React__default.createElement(Box, { mr: 2, className: "sl-font-mono sl-font-semibold sl-mr-2" },
|
|
3006
|
-
!TYPES.includes(schema === null || schema === void 0 ? void 0 : schema.type) &&
|
|
3007
|
-
!detectCircularPath(path) &&
|
|
3008
|
-
!((_b = schema === null || schema === void 0 ? void 0 : schema.items) === null || _b === void 0 ? void 0 : _b.circular) &&
|
|
3009
|
-
!(schema === null || schema === void 0 ? void 0 : schema.circular) ? (React__default.createElement("i", { role: "img", "aria-hidden": "true", className: `sl-icon fal ${expanded ? 'fa-chevron-down' : 'fa-chevron-right'} fa-fw fa-sm` })) : (React__default.createElement("span", { className: "sl-icon fal fa-fw fa-sm", "aria-hidden": "true" })),
|
|
3010
|
-
' ' + displayTitle)) : null,
|
|
3011
|
-
!isRoot ? (React__default.createElement(Box, { mr: 2, pos: "relative" },
|
|
3012
|
-
React__default.createElement(Box, { display: "inline-flex", alignItems: "center", onMouseEnter: () => {
|
|
3013
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) {
|
|
3014
|
-
setIsHoveringSelector(true);
|
|
3015
|
-
}
|
|
3016
|
-
}, onMouseLeave: () => {
|
|
3017
|
-
if (!showSchemaDropdown) {
|
|
3018
|
-
setIsHoveringSelector(false);
|
|
3019
|
-
}
|
|
3020
|
-
}, onClick: (e) => {
|
|
3021
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) {
|
|
3022
|
-
e.stopPropagation();
|
|
3023
|
-
setShowSchemaDropdown(prev => !prev);
|
|
3024
|
-
}
|
|
3025
|
-
}, style: {
|
|
3026
|
-
cursor: (schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf) ? 'pointer' : 'default',
|
|
3027
|
-
} },
|
|
3028
|
-
React__default.createElement("span", { className: "sl-truncate sl-text-muted" },
|
|
3029
|
-
(() => {
|
|
3030
|
-
let typeDisplay = (schema === null || schema === void 0 ? void 0 : schema.type) === 'object' && (schema === null || schema === void 0 ? void 0 : schema.title) ? schema === null || schema === void 0 ? void 0 : schema.title : (schema === null || schema === void 0 ? void 0 : schema.type) || (root === null || root === void 0 ? void 0 : root.title);
|
|
3031
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) && (schema === null || schema === void 0 ? void 0 : schema.anyOf.length) > 0) {
|
|
3032
|
-
return `any of ${typeDisplay}`;
|
|
3033
|
-
}
|
|
3034
|
-
else if ((schema === null || schema === void 0 ? void 0 : schema.oneOf) && (schema === null || schema === void 0 ? void 0 : schema.oneOf.length) > 0) {
|
|
3035
|
-
return `one of ${typeDisplay}`;
|
|
3036
|
-
}
|
|
3037
|
-
return typeDisplay;
|
|
3038
|
-
})(),
|
|
3039
|
-
(schema === null || schema === void 0 ? void 0 : schema.items) && ((_c = schema === null || schema === void 0 ? void 0 : schema.items) === null || _c === void 0 ? void 0 : _c.title) !== undefined ? ` [${(_d = schema === null || schema === void 0 ? void 0 : schema.items) === null || _d === void 0 ? void 0 : _d.title}] ` : null),
|
|
3040
|
-
((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) && (React__default.createElement(Box, { display: "inline-flex", alignItems: "center", ml: 1, style: {
|
|
3041
|
-
opacity: isHoveringSelector ? 1 : 0.6,
|
|
3042
|
-
transition: 'opacity 0.2s',
|
|
3043
|
-
} },
|
|
3044
|
-
React__default.createElement("i", { className: "sl-icon fas fa-chevron-down", style: {
|
|
3045
|
-
fontSize: '10px',
|
|
3046
|
-
opacity: 0.6,
|
|
3047
|
-
} })))),
|
|
3048
|
-
React__default.createElement("span", { className: "text-gray-500" }, (schema === null || schema === void 0 ? void 0 : schema.format) !== undefined ? `<${schema === null || schema === void 0 ? void 0 : schema.format}>` : null),
|
|
3049
|
-
((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) && showSchemaDropdown && combinedSchemaSelector())) : null),
|
|
3050
|
-
React__default.createElement(Flex, { pl: 1, w: "full", align: "start", direction: "col", style: { overflow: 'visible', paddingLeft: '20px' } },
|
|
3051
|
-
(schema === null || schema === void 0 ? void 0 : schema.description) && (React__default.createElement(Box, { fontFamily: "ui", fontWeight: "light" },
|
|
3052
|
-
React__default.createElement("span", { className: "sl-prose sl-markdown-viewer", style: { fontSize: '12px' } }, schema === null || schema === void 0 ? void 0 : schema.description))),
|
|
3053
|
-
!isRoot && (schema === null || schema === void 0 ? void 0 : schema.examples) !== undefined && (React__default.createElement(Flex, { align: "center", mb: 1, style: { flexWrap: 'wrap' } },
|
|
3054
|
-
React__default.createElement("span", { className: "text-gray-500", style: { marginRight: 8, flexShrink: 0 } }, "Example"),
|
|
3055
|
-
React__default.createElement(Box, { className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: {
|
|
3056
|
-
background: 'rgba(245, 247, 250, 0.5)',
|
|
3057
|
-
border: '1px solid #a0aec0',
|
|
3058
|
-
borderRadius: '4px',
|
|
3059
|
-
padding: '4px 8px',
|
|
3060
|
-
display: 'inline-block',
|
|
3061
|
-
overflowWrap: 'break-word',
|
|
3062
|
-
textAlign: 'left',
|
|
3063
|
-
maxWidth: '530px',
|
|
3064
|
-
} }, JSON.stringify(schema === null || schema === void 0 ? void 0 : schema.examples))))),
|
|
3065
|
-
React__default.createElement(Flex, { pl: 1, w: "full", align: "start", direction: "col", style: { overflow: 'visible', paddingLeft: '20px' } }, schema &&
|
|
3066
|
-
typeof schema === 'object' &&
|
|
3067
|
-
('minItems' in schema || 'enum' in schema) &&
|
|
3068
|
-
renderMinEnums(schema))),
|
|
3069
|
-
!isRoot && (React__default.createElement("label", { className: "inline-flex items-top ml-2" },
|
|
3070
|
-
React__default.createElement(Box, { mr: 2, fontFamily: "ui", fontWeight: "normal" }, showRequiredLabel && (React__default.createElement("div", { className: "sl-ml-2 sl-text-warning" },
|
|
3071
|
-
React__default.createElement("span", { style: { marginLeft: '10px' } }, "required"))))))),
|
|
3072
|
-
renderChildren()));
|
|
3073
|
-
};
|
|
3074
|
-
|
|
3075
2737
|
const isBodyEmpty = (body) => {
|
|
3076
2738
|
if (!body)
|
|
3077
2739
|
return true;
|
|
3078
2740
|
const { contents = [], description } = body;
|
|
3079
2741
|
return contents.length === 0 && !(description === null || description === void 0 ? void 0 : description.trim());
|
|
3080
2742
|
};
|
|
3081
|
-
const Body = ({ body, onChange, isHttpWebhookOperation = false
|
|
2743
|
+
const Body = ({ body, onChange, isHttpWebhookOperation = false }) => {
|
|
3082
2744
|
var _a;
|
|
3083
2745
|
const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
|
|
3084
2746
|
const [chosenContent, setChosenContent] = React.useState(0);
|
|
@@ -3091,29 +2753,13 @@ const Body = ({ body, onChange, isHttpWebhookOperation = false, disableProps })
|
|
|
3091
2753
|
const { contents = [], description } = body;
|
|
3092
2754
|
const schema = (_a = contents[chosenContent]) === null || _a === void 0 ? void 0 : _a.schema;
|
|
3093
2755
|
const descriptionChanged = nodeHasChanged === null || nodeHasChanged === void 0 ? void 0 : nodeHasChanged({ nodeId: body.id, attr: 'description' });
|
|
3094
|
-
const getMaskProperties = () => {
|
|
3095
|
-
const disablePropsConfig = disableProps || [];
|
|
3096
|
-
const absolutePathsToHide = [];
|
|
3097
|
-
disablePropsConfig.forEach(configEntry => {
|
|
3098
|
-
const { location, paths } = configEntry;
|
|
3099
|
-
paths.forEach((item) => {
|
|
3100
|
-
const fullPath = location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}`;
|
|
3101
|
-
let object = { path: fullPath };
|
|
3102
|
-
if (item.hasOwnProperty('required')) {
|
|
3103
|
-
object = Object.assign(Object.assign({}, object), { required: item === null || item === void 0 ? void 0 : item.required });
|
|
3104
|
-
}
|
|
3105
|
-
absolutePathsToHide.push(object);
|
|
3106
|
-
});
|
|
3107
|
-
});
|
|
3108
|
-
return absolutePathsToHide;
|
|
3109
|
-
};
|
|
3110
2756
|
return (React.createElement(VStack, { spacing: 6 },
|
|
3111
2757
|
React.createElement(SectionSubtitle, { title: "Body", id: "request-body" }, contents.length > 0 && (React.createElement(Flex, { flex: 1, justify: "end" },
|
|
3112
2758
|
React.createElement(Select, { "aria-label": "Request Body Content Type", value: String(chosenContent), onChange: value => setChosenContent(parseInt(String(value), 10)), options: contents.map((content, index) => ({ label: content.mediaType, value: index })), size: "sm" })))),
|
|
3113
2759
|
description && (React.createElement(Box, { pos: "relative" },
|
|
3114
2760
|
React.createElement(MarkdownViewer, { markdown: description }),
|
|
3115
2761
|
React.createElement(NodeAnnotation, { change: descriptionChanged }))),
|
|
3116
|
-
|
|
2762
|
+
isJSONSchema(schema) && (React.createElement(JsonSchemaViewer, { resolveRef: refResolver, maxRefDepth: maxRefDepth, schema: getOriginalObject(schema), viewMode: isHttpWebhookOperation ? 'standalone' : 'write', renderRootTreeLines: true, nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }))));
|
|
3117
2763
|
};
|
|
3118
2764
|
Body.displayName = 'HttpOperation.Body';
|
|
3119
2765
|
|
|
@@ -3180,7 +2826,7 @@ const httpOperationParamsToSchema = ({ parameters, parameterType }) => {
|
|
|
3180
2826
|
return schema;
|
|
3181
2827
|
};
|
|
3182
2828
|
|
|
3183
|
-
const Request = ({ operation: { request, request: { path: pathParams = [], headers: headerParams = [], cookie: cookieParams = [], body, query: queryParams = [], } = {}, security, }, hideSecurityInfo, onChange, isHttpWebhookOperation = false,
|
|
2829
|
+
const Request = ({ operation: { request, request: { path: pathParams = [], headers: headerParams = [], cookie: cookieParams = [], body, query: queryParams = [], } = {}, security, }, hideSecurityInfo, onChange, isHttpWebhookOperation = false, }) => {
|
|
3184
2830
|
if (!request || typeof request !== 'object')
|
|
3185
2831
|
return null;
|
|
3186
2832
|
const bodyIsEmpty = isBodyEmpty(body);
|
|
@@ -3208,7 +2854,7 @@ const Request = ({ operation: { request, request: { path: pathParams = [], heade
|
|
|
3208
2854
|
cookieParams.length > 0 && (React.createElement(VStack, { spacing: 5 },
|
|
3209
2855
|
React.createElement(SectionSubtitle, { title: "Cookies", id: "request-cookies" }),
|
|
3210
2856
|
React.createElement(Parameters, { parameterType: "cookie", parameters: cookieParams }))),
|
|
3211
|
-
body &&
|
|
2857
|
+
body && React.createElement(Body, { onChange: onChange, body: body, isHttpWebhookOperation: isHttpWebhookOperation })));
|
|
3212
2858
|
};
|
|
3213
2859
|
Request.displayName = 'HttpOperation.Request';
|
|
3214
2860
|
const schemeExpandedState = atomWithStorage('HttpOperation_security_expanded', {});
|
|
@@ -3239,7 +2885,7 @@ const OptionalMessage$1 = () => {
|
|
|
3239
2885
|
return React.createElement(Callout, { appearance: "outline" }, OptionalSecurityMessage);
|
|
3240
2886
|
};
|
|
3241
2887
|
|
|
3242
|
-
const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTypeChange, isCompact,
|
|
2888
|
+
const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTypeChange, isCompact, }) => {
|
|
3243
2889
|
var _a, _b;
|
|
3244
2890
|
const responses = sortBy(uniqBy(unsortedResponses, r => r.code), r => r.code);
|
|
3245
2891
|
const [activeResponseId, setActiveResponseId] = React.useState((_b = (_a = responses[0]) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : '');
|
|
@@ -3272,11 +2918,11 @@ const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTy
|
|
|
3272
2918
|
const tabResponses = (React.createElement(TabList, { density: "compact" }, responses.map(({ code }) => (React.createElement(Tab, { key: code, id: code, intent: codeToIntentVal(code) }, code)))));
|
|
3273
2919
|
return (React.createElement(VStack, { spacing: 8, as: Tabs, selectedId: activeResponseId, onChange: setActiveResponseId, appearance: "pill" },
|
|
3274
2920
|
React.createElement(SectionTitle, { title: "Responses", isCompact: isCompact }, isCompact ? compactResponses : tabResponses),
|
|
3275
|
-
isCompact ? (React.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange
|
|
3276
|
-
React.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange
|
|
2921
|
+
isCompact ? (React.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange })) : (React.createElement(TabPanels, { p: 0 }, responses.map(response => (React.createElement(TabPanel, { key: response.code, id: response.code },
|
|
2922
|
+
React.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange }))))))));
|
|
3277
2923
|
};
|
|
3278
2924
|
Responses.displayName = 'HttpOperation.Responses';
|
|
3279
|
-
const Response = ({ response, onMediaTypeChange
|
|
2925
|
+
const Response = ({ response, onMediaTypeChange }) => {
|
|
3280
2926
|
const { contents = [], headers = [], description } = response;
|
|
3281
2927
|
const [chosenContent, setChosenContent] = React.useState(0);
|
|
3282
2928
|
const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
|
|
@@ -3287,24 +2933,6 @@ const Response = ({ response, onMediaTypeChange, disableProps, statusCode }) =>
|
|
|
3287
2933
|
responseContent && (onMediaTypeChange === null || onMediaTypeChange === void 0 ? void 0 : onMediaTypeChange(responseContent.mediaType));
|
|
3288
2934
|
}, [responseContent]);
|
|
3289
2935
|
const descriptionChanged = nodeHasChanged === null || nodeHasChanged === void 0 ? void 0 : nodeHasChanged({ nodeId: response.id, attr: 'description' });
|
|
3290
|
-
const getMaskProperties = () => {
|
|
3291
|
-
if (!disableProps || !statusCode)
|
|
3292
|
-
return [];
|
|
3293
|
-
const configEntries = disableProps[statusCode] || [];
|
|
3294
|
-
const absolutePathsToHide = [];
|
|
3295
|
-
configEntries.forEach(({ location, paths }) => {
|
|
3296
|
-
paths.forEach((item) => {
|
|
3297
|
-
const fullPath = location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}`;
|
|
3298
|
-
let object = { path: fullPath };
|
|
3299
|
-
if (item.hasOwnProperty('required')) {
|
|
3300
|
-
object = Object.assign(Object.assign({}, object), { required: item === null || item === void 0 ? void 0 : item.required });
|
|
3301
|
-
}
|
|
3302
|
-
absolutePathsToHide.push(object);
|
|
3303
|
-
console.log('object::', object, item);
|
|
3304
|
-
});
|
|
3305
|
-
});
|
|
3306
|
-
return absolutePathsToHide;
|
|
3307
|
-
};
|
|
3308
2936
|
return (React.createElement(VStack, { spacing: 8, pt: 8 },
|
|
3309
2937
|
description && (React.createElement(Box, { pos: "relative" },
|
|
3310
2938
|
React.createElement(MarkdownViewer, { markdown: description }),
|
|
@@ -3316,7 +2944,7 @@ const Response = ({ response, onMediaTypeChange, disableProps, statusCode }) =>
|
|
|
3316
2944
|
React.createElement(SectionSubtitle, { title: "Body", id: "response-body" },
|
|
3317
2945
|
React.createElement(Flex, { flex: 1, justify: "end" },
|
|
3318
2946
|
React.createElement(Select, { "aria-label": "Response Body Content Type", value: String(chosenContent), onChange: value => setChosenContent(parseInt(String(value), 10)), options: contents.map((content, index) => ({ label: content.mediaType, value: index })), size: "sm" }))),
|
|
3319
|
-
schema &&
|
|
2947
|
+
schema && (React.createElement(JsonSchemaViewer, { schema: getOriginalObject(schema), resolveRef: refResolver, maxRefDepth: maxRefDepth, viewMode: "read", parentCrumbs: ['responses', response.code], renderRootTreeLines: true, nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }))))));
|
|
3320
2948
|
};
|
|
3321
2949
|
Response.displayName = 'HttpOperation.Response';
|
|
3322
2950
|
const codeToIntentVal = (code) => {
|
|
@@ -3362,7 +2990,7 @@ const Callback = ({ data, isCompact }) => {
|
|
|
3362
2990
|
};
|
|
3363
2991
|
Callbacks.displayName = 'HttpOperation.Callback';
|
|
3364
2992
|
|
|
3365
|
-
const HttpOperationComponent = React.memo(({ className, data: unresolvedData, layoutOptions, tryItCredentialsPolicy, tryItCorsProxy
|
|
2993
|
+
const HttpOperationComponent = React.memo(({ className, data: unresolvedData, layoutOptions, tryItCredentialsPolicy, tryItCorsProxy }) => {
|
|
3366
2994
|
var _a;
|
|
3367
2995
|
const { nodeHasChanged } = useOptionsCtx();
|
|
3368
2996
|
const data = useResolvedObject(unresolvedData);
|
|
@@ -3393,8 +3021,8 @@ const HttpOperationComponent = React.memo(({ className, data: unresolvedData, la
|
|
|
3393
3021
|
React.createElement(MarkdownViewer, { className: "HttpOperation__Description", markdown: data.description }),
|
|
3394
3022
|
React.createElement(NodeAnnotation, { change: descriptionChanged }))),
|
|
3395
3023
|
React.createElement(NodeVendorExtensions, { data: data }),
|
|
3396
|
-
React.createElement(Request, { onChange: setTextRequestBodyIndex, operation: data, hideSecurityInfo: layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideSecurityInfo, isHttpWebhookOperation: isHttpWebhookOperation(data)
|
|
3397
|
-
data.responses && (React.createElement(Responses, { responses: data.responses, onMediaTypeChange: setResponseMediaType, onStatusCodeChange: setResponseStatusCode, isCompact: isCompact
|
|
3024
|
+
React.createElement(Request, { onChange: setTextRequestBodyIndex, operation: data, hideSecurityInfo: layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideSecurityInfo, isHttpWebhookOperation: isHttpWebhookOperation(data) }),
|
|
3025
|
+
data.responses && (React.createElement(Responses, { responses: data.responses, onMediaTypeChange: setResponseMediaType, onStatusCodeChange: setResponseStatusCode, isCompact: isCompact })),
|
|
3398
3026
|
((_a = data.callbacks) === null || _a === void 0 ? void 0 : _a.length) ? React.createElement(Callbacks, { callbacks: data.callbacks, isCompact: isCompact }) : null,
|
|
3399
3027
|
isCompact && tryItPanel));
|
|
3400
3028
|
return (React.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('HttpOperation', className), header: header, left: description, right: !isCompact && tryItPanel }));
|
|
@@ -3632,9 +3260,7 @@ const HttpServiceComponent = React.memo(({ data: unresolvedData, location = {},
|
|
|
3632
3260
|
React.createElement(Box, { pos: "relative" },
|
|
3633
3261
|
React.createElement(Heading, { size: 1, mb: 4, fontWeight: "semibold" }, data.name),
|
|
3634
3262
|
React.createElement(NodeAnnotation, { change: nameChanged })),
|
|
3635
|
-
|
|
3636
|
-
? null
|
|
3637
|
-
: exportProps && !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideExport) && !isCompact && React.createElement(ExportButton, Object.assign({}, exportProps)))),
|
|
3263
|
+
exportProps && !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideExport) && !isCompact && React.createElement(ExportButton, Object.assign({}, exportProps)))),
|
|
3638
3264
|
data.version && (React.createElement(Box, { mb: 5, pos: "relative" },
|
|
3639
3265
|
React.createElement(VersionBadge, { value: data.version }),
|
|
3640
3266
|
React.createElement(NodeAnnotation, { change: versionChanged }))),
|
|
@@ -3650,7 +3276,7 @@ const HttpServiceComponent = React.memo(({ data: unresolvedData, location = {},
|
|
|
3650
3276
|
HttpServiceComponent.displayName = 'HttpService.Component';
|
|
3651
3277
|
const HttpService = withErrorBoundary(HttpServiceComponent, { recoverableProps: ['data'] });
|
|
3652
3278
|
|
|
3653
|
-
const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOptions, exportProps,
|
|
3279
|
+
const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOptions, exportProps, }) => {
|
|
3654
3280
|
var _a, _b;
|
|
3655
3281
|
const [resolveRef, maxRefDepth] = useSchemaInlineRefResolver();
|
|
3656
3282
|
const data = useResolvedObject(unresolvedData);
|
|
@@ -3670,36 +3296,16 @@ const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOpti
|
|
|
3670
3296
|
isDeprecated && React.createElement(DeprecatedBadge, null),
|
|
3671
3297
|
isInternal && React.createElement(InternalBadge, null))),
|
|
3672
3298
|
React.createElement(NodeAnnotation, { change: titleChanged })),
|
|
3673
|
-
|
|
3674
|
-
? null
|
|
3675
|
-
: exportProps && !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideExport) && !isCompact && React.createElement(ExportButton, Object.assign({}, exportProps))));
|
|
3299
|
+
exportProps && !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideExport) && !isCompact && React.createElement(ExportButton, Object.assign({}, exportProps))));
|
|
3676
3300
|
const modelExamples = !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideModelExamples) && React.createElement(ModelExamples, { data: data, isCollapsible: isCompact });
|
|
3677
3301
|
const descriptionChanged = nodeHasChanged === null || nodeHasChanged === void 0 ? void 0 : nodeHasChanged({ nodeId, attr: 'description' });
|
|
3678
|
-
const getMaskProperties = () => {
|
|
3679
|
-
const disablePropsConfig = disableProps === null || disableProps === void 0 ? void 0 : disableProps.models;
|
|
3680
|
-
const absolutePathsToHide = [];
|
|
3681
|
-
if (disableProps === null || disableProps === void 0 ? void 0 : disableProps.models) {
|
|
3682
|
-
disablePropsConfig.forEach((configEntry) => {
|
|
3683
|
-
const { location, paths } = configEntry;
|
|
3684
|
-
paths.forEach((item) => {
|
|
3685
|
-
const fullPath = location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}`;
|
|
3686
|
-
let object = { path: fullPath };
|
|
3687
|
-
if (item.hasOwnProperty('required')) {
|
|
3688
|
-
object = Object.assign(Object.assign({}, object), { required: item === null || item === void 0 ? void 0 : item.required });
|
|
3689
|
-
}
|
|
3690
|
-
absolutePathsToHide.push(object);
|
|
3691
|
-
});
|
|
3692
|
-
});
|
|
3693
|
-
}
|
|
3694
|
-
return absolutePathsToHide;
|
|
3695
|
-
};
|
|
3696
3302
|
const description = (React.createElement(VStack, { spacing: 10 },
|
|
3697
3303
|
data.description && data.type === 'object' && (React.createElement(Box, { pos: "relative" },
|
|
3698
3304
|
React.createElement(MarkdownViewer, { role: "textbox", markdown: data.description }),
|
|
3699
3305
|
React.createElement(NodeAnnotation, { change: descriptionChanged }))),
|
|
3700
3306
|
React.createElement(NodeVendorExtensions, { data: data }),
|
|
3701
|
-
|
|
3702
|
-
|
|
3307
|
+
isCompact && modelExamples,
|
|
3308
|
+
React.createElement(JsonSchemaViewer, { resolveRef: resolveRef, maxRefDepth: maxRefDepth, schema: getOriginalObject(data), nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon, skipTopLevelDescription: true })));
|
|
3703
3309
|
return (React.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('Model', className), header: header, left: description, right: !isCompact && modelExamples }));
|
|
3704
3310
|
};
|
|
3705
3311
|
const ModelExamples = React.memo(({ data, isCollapsible = false }) => {
|
|
@@ -3722,30 +3328,30 @@ const Model = withErrorBoundary(ModelComponent, { recoverableProps: ['data'] });
|
|
|
3722
3328
|
|
|
3723
3329
|
const Docs = React.memo((_a) => {
|
|
3724
3330
|
var _b;
|
|
3725
|
-
var { nodeType, nodeData,
|
|
3331
|
+
var { nodeType, nodeData, useNodeForRefResolving = false, refResolver, maxRefDepth, nodeHasChanged, renderExtensionAddon } = _a, commonProps = __rest(_a, ["nodeType", "nodeData", "useNodeForRefResolving", "refResolver", "maxRefDepth", "nodeHasChanged", "renderExtensionAddon"]);
|
|
3726
3332
|
const parsedNode = useParsedData(nodeType, nodeData);
|
|
3727
3333
|
if (!parsedNode) {
|
|
3728
3334
|
(_b = commonProps.nodeUnsupported) === null || _b === void 0 ? void 0 : _b.call(commonProps, 'dataEmpty');
|
|
3729
3335
|
return null;
|
|
3730
3336
|
}
|
|
3731
|
-
let elem = React.createElement(ParsedDocs, Object.assign({ node: parsedNode
|
|
3337
|
+
let elem = React.createElement(ParsedDocs, Object.assign({ node: parsedNode }, commonProps));
|
|
3732
3338
|
if (useNodeForRefResolving) {
|
|
3733
3339
|
elem = (React.createElement(InlineRefResolverProvider, { document: parsedNode.data, resolver: refResolver, maxRefDepth: maxRefDepth }, elem));
|
|
3734
3340
|
}
|
|
3735
3341
|
return (React.createElement(ElementsOptionsProvider, { nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }, elem));
|
|
3736
3342
|
});
|
|
3737
3343
|
const ParsedDocs = (_a) => {
|
|
3738
|
-
var { node, nodeUnsupported
|
|
3344
|
+
var { node, nodeUnsupported } = _a, commonProps = __rest(_a, ["node", "nodeUnsupported"]);
|
|
3739
3345
|
switch (node.type) {
|
|
3740
3346
|
case 'article':
|
|
3741
3347
|
return React.createElement(Article, Object.assign({ data: node.data }, commonProps));
|
|
3742
3348
|
case 'http_operation':
|
|
3743
3349
|
case 'http_webhook':
|
|
3744
|
-
return React.createElement(HttpOperation, Object.assign({ data: node.data
|
|
3350
|
+
return React.createElement(HttpOperation, Object.assign({ data: node.data }, commonProps));
|
|
3745
3351
|
case 'http_service':
|
|
3746
3352
|
return React.createElement(HttpService, Object.assign({ data: node.data }, commonProps));
|
|
3747
3353
|
case 'model':
|
|
3748
|
-
return React.createElement(Model, Object.assign({ data: node.data
|
|
3354
|
+
return React.createElement(Model, Object.assign({ data: node.data }, commonProps));
|
|
3749
3355
|
default:
|
|
3750
3356
|
nodeUnsupported === null || nodeUnsupported === void 0 ? void 0 : nodeUnsupported('invalidType');
|
|
3751
3357
|
return null;
|