@stoplight/elements-core 7.7.12 → 7.7.13
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/HttpOperation/Body.d.ts +1 -1
- package/components/Docs/story-helper.d.ts +1 -1
- package/components/RequestSamples/convertRequestToSample.d.ts +1 -1
- package/components/TryIt/Body/request-body-utils.d.ts +1 -1
- package/hooks/useRouter.d.ts +1 -1
- package/index.esm.js +42 -15
- package/index.js +42 -16
- package/index.mjs +42 -15
- package/package.json +2 -2
- package/utils/exampleGeneration/exampleGeneration.d.ts +2 -2
- package/utils/http-spec/IServer.d.ts +1 -1
|
@@ -3,7 +3,7 @@ export interface BodyProps {
|
|
|
3
3
|
body: IHttpOperationRequestBody;
|
|
4
4
|
onChange: (requestBodyIndex: number) => void;
|
|
5
5
|
}
|
|
6
|
-
export declare const isBodyEmpty: (body?:
|
|
6
|
+
export declare const isBodyEmpty: (body?: BodyProps['body']) => boolean;
|
|
7
7
|
export declare const Body: {
|
|
8
8
|
({ body, onChange }: BodyProps): JSX.Element | null;
|
|
9
9
|
displayName: string;
|
|
@@ -9,5 +9,5 @@ interface HelperReturn<P extends Partial<DocsProps>> {
|
|
|
9
9
|
createStory(name: string, input: Partial<P>): Story<P>;
|
|
10
10
|
createHoistedStory(input: Partial<P>): Story<P>;
|
|
11
11
|
}
|
|
12
|
-
export declare const createStoriesForDocsComponent: <P extends Partial<DocsProps> = DocsProps>(Component: React.ComponentType<P>, title?: string
|
|
12
|
+
export declare const createStoriesForDocsComponent: <P extends Partial<DocsProps> = DocsProps>(Component: React.ComponentType<P>, title?: string) => HelperReturn<P>;
|
|
13
13
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Request as HarFormatRequest } from 'har-format';
|
|
2
|
-
export declare const convertRequestToSample: (language: string, library: string | undefined, request: HarFormatRequest) => string | null
|
|
2
|
+
export declare const convertRequestToSample: (language: string, library: string | undefined, request: HarFormatRequest) => Promise<string | null>;
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
export declare type BodyParameterValues = Record<string, string | File>;
|
|
4
4
|
export declare type ParameterOptional = Record<string, boolean>;
|
|
5
5
|
export declare const isFormDataContent: (content: IMediaTypeContent) => boolean;
|
|
6
|
-
export declare function createRequestBody(mediaTypeContent: IMediaTypeContent | undefined, bodyParameterValues: BodyParameterValues | undefined): Promise<string | Blob | ArrayBuffer |
|
|
6
|
+
export declare function createRequestBody(mediaTypeContent: IMediaTypeContent | undefined, bodyParameterValues: BodyParameterValues | undefined): Promise<string | Blob | ArrayBuffer | ReadableStream<any> | ArrayBufferView | FormData | undefined>;
|
|
7
7
|
export declare const useBodyParameterState: (mediaTypeContent: IMediaTypeContent | undefined) => readonly [BodyParameterValues, React.Dispatch<React.SetStateAction<BodyParameterValues>>, ParameterOptional, React.Dispatch<React.SetStateAction<ParameterOptional>>, {
|
|
8
8
|
readonly isFormDataBody: true;
|
|
9
9
|
readonly bodySpecification: IMediaTypeContent<false>;
|
package/hooks/useRouter.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ interface RouterProps {
|
|
|
4
4
|
basename?: string;
|
|
5
5
|
location?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare const useRouter: (router: RouterType, basePath: string, staticRouterPath?: string
|
|
7
|
+
export declare const useRouter: (router: RouterType, basePath: string, staticRouterPath?: string) => {
|
|
8
8
|
Router: React.ComponentType<{}>;
|
|
9
9
|
routerProps: RouterProps;
|
|
10
10
|
};
|
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __awaiter, __rest } from 'tslib';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { useContext, useMemo } from 'react';
|
|
4
4
|
import { convertToJsonSchema } from '@stoplight/http-spec/oas';
|
|
@@ -18,7 +18,7 @@ import { atomWithStorage, useAtomValue } from 'jotai/utils';
|
|
|
18
18
|
import { atom, useAtom, Provider } from 'jotai';
|
|
19
19
|
import URI from 'urijs';
|
|
20
20
|
import { CodeViewer } from '@stoplight/mosaic-code-viewer';
|
|
21
|
-
import HTTPSnippet from 'httpsnippet';
|
|
21
|
+
import { isValidTargetId, HTTPSnippet } from 'httpsnippet-lite';
|
|
22
22
|
import flatten from 'lodash/flatten.js';
|
|
23
23
|
import capitalize from 'lodash/capitalize.js';
|
|
24
24
|
import filter from 'lodash/filter.js';
|
|
@@ -85,7 +85,7 @@ const recursivelyCreateResolvedObject = (currentObject, rootCurrentObject, prope
|
|
|
85
85
|
resolvedValue = mergedOptions.resolver({ pointer: value.$ref, source: null }, newPropertyPath, rootCurrentObject);
|
|
86
86
|
}
|
|
87
87
|
catch (e) {
|
|
88
|
-
resolvedValue = Object.assign(Object.assign({}, value), { $error: e.message });
|
|
88
|
+
resolvedValue = Object.assign(Object.assign({}, value), { $error: e instanceof Error ? e.message : String(e) });
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
@@ -537,16 +537,22 @@ const persistAtom = (key, atomInstance) => {
|
|
|
537
537
|
});
|
|
538
538
|
};
|
|
539
539
|
|
|
540
|
-
const convertRequestToSample = (language, library, request) => {
|
|
540
|
+
const convertRequestToSample = (language, library, request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
541
|
+
if (!isValidTargetId(language))
|
|
542
|
+
return null;
|
|
541
543
|
try {
|
|
542
544
|
const snippet = new HTTPSnippet(request);
|
|
543
|
-
|
|
545
|
+
const converted = yield snippet.convert(language, library);
|
|
546
|
+
if (Array.isArray(converted)) {
|
|
547
|
+
return converted[0];
|
|
548
|
+
}
|
|
549
|
+
return converted || null;
|
|
544
550
|
}
|
|
545
551
|
catch (err) {
|
|
546
552
|
console.error(err);
|
|
547
553
|
return null;
|
|
548
554
|
}
|
|
549
|
-
};
|
|
555
|
+
});
|
|
550
556
|
|
|
551
557
|
const requestSampleConfigs = {
|
|
552
558
|
Shell: {
|
|
@@ -572,7 +578,7 @@ const requestSampleConfigs = {
|
|
|
572
578
|
httpSnippetLibrary: 'fetch',
|
|
573
579
|
},
|
|
574
580
|
XMLHttpRequest: {
|
|
575
|
-
httpSnippetLibrary: '
|
|
581
|
+
httpSnippetLibrary: 'xhr',
|
|
576
582
|
},
|
|
577
583
|
jQuery: {
|
|
578
584
|
httpSnippetLibrary: 'jquery',
|
|
@@ -664,6 +670,11 @@ const requestSampleConfigs = {
|
|
|
664
670
|
Http: {
|
|
665
671
|
mosaicCodeViewerLanguage: 'http',
|
|
666
672
|
httpSnippetLanguage: 'http',
|
|
673
|
+
libraries: {
|
|
674
|
+
'Http1.1': {
|
|
675
|
+
httpSnippetLibrary: 'http1.1',
|
|
676
|
+
},
|
|
677
|
+
},
|
|
667
678
|
},
|
|
668
679
|
Clojure: {
|
|
669
680
|
mosaicCodeViewerLanguage: 'clojure',
|
|
@@ -724,7 +735,24 @@ const RequestSamples = React__default.memo(({ request, embeddedInMd = false }) =
|
|
|
724
735
|
const [selectedLanguage, setSelectedLanguage] = useAtom(selectedLanguageAtom);
|
|
725
736
|
const [selectedLibrary, setSelectedLibrary] = useAtom(selectedLibraryAtom);
|
|
726
737
|
const { httpSnippetLanguage, httpSnippetLibrary, mosaicCodeViewerLanguage } = getConfigFor(selectedLanguage, selectedLibrary);
|
|
727
|
-
const requestSample =
|
|
738
|
+
const [requestSample, setRequestSample] = React__default.useState(null);
|
|
739
|
+
React__default.useEffect(() => {
|
|
740
|
+
let isStale = false;
|
|
741
|
+
convertRequestToSample(httpSnippetLanguage, httpSnippetLibrary, request)
|
|
742
|
+
.then(example => {
|
|
743
|
+
if (!isStale) {
|
|
744
|
+
setRequestSample(example);
|
|
745
|
+
}
|
|
746
|
+
})
|
|
747
|
+
.catch(() => {
|
|
748
|
+
if (!isStale) {
|
|
749
|
+
setRequestSample(fallbackText);
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
return () => {
|
|
753
|
+
isStale = true;
|
|
754
|
+
};
|
|
755
|
+
}, [request, httpSnippetLanguage, httpSnippetLibrary]);
|
|
728
756
|
const menuItems = useMemo(() => {
|
|
729
757
|
const items = Object.entries(requestSampleConfigs).map(([language, config]) => {
|
|
730
758
|
const hasLibraries = config.libraries && Object.keys(config.libraries).length > 0;
|
|
@@ -761,13 +789,12 @@ const RequestSamples = React__default.memo(({ request, embeddedInMd = false }) =
|
|
|
761
789
|
selectedLanguage,
|
|
762
790
|
" ",
|
|
763
791
|
selectedLibrary ? ` / ${selectedLibrary}` : '')) }))),
|
|
764
|
-
React__default.createElement(Panel.Content, { p: 0 },
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
} }))));
|
|
792
|
+
React__default.createElement(Panel.Content, { p: 0 }, requestSample !== null && (React__default.createElement(CodeViewer, { "aria-label": requestSample, noCopyButton: true, maxHeight: "400px", language: mosaicCodeViewerLanguage, value: requestSample, style: embeddedInMd
|
|
793
|
+
? undefined
|
|
794
|
+
:
|
|
795
|
+
{
|
|
796
|
+
'--fs-code': 12,
|
|
797
|
+
} })))));
|
|
771
798
|
});
|
|
772
799
|
|
|
773
800
|
function getReadableSecurityName(securityScheme, includeKey = false) {
|
package/index.js
CHANGED
|
@@ -20,7 +20,7 @@ var utils = require('jotai/utils');
|
|
|
20
20
|
var jotai = require('jotai');
|
|
21
21
|
var URI = require('urijs');
|
|
22
22
|
var mosaicCodeViewer = require('@stoplight/mosaic-code-viewer');
|
|
23
|
-
var
|
|
23
|
+
var httpsnippetLite = require('httpsnippet-lite');
|
|
24
24
|
var flatten = require('lodash/flatten.js');
|
|
25
25
|
var capitalize = require('lodash/capitalize.js');
|
|
26
26
|
var filter = require('lodash/filter.js');
|
|
@@ -77,7 +77,6 @@ var isPlainObject__default = /*#__PURE__*/_interopDefaultLegacy(isPlainObject);
|
|
|
77
77
|
var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);
|
|
78
78
|
var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
|
|
79
79
|
var URI__default = /*#__PURE__*/_interopDefaultLegacy(URI);
|
|
80
|
-
var HTTPSnippet__default = /*#__PURE__*/_interopDefaultLegacy(HTTPSnippet);
|
|
81
80
|
var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten);
|
|
82
81
|
var capitalize__default = /*#__PURE__*/_interopDefaultLegacy(capitalize);
|
|
83
82
|
var filter__default = /*#__PURE__*/_interopDefaultLegacy(filter);
|
|
@@ -139,7 +138,7 @@ const recursivelyCreateResolvedObject = (currentObject, rootCurrentObject, prope
|
|
|
139
138
|
resolvedValue = mergedOptions.resolver({ pointer: value.$ref, source: null }, newPropertyPath, rootCurrentObject);
|
|
140
139
|
}
|
|
141
140
|
catch (e) {
|
|
142
|
-
resolvedValue = Object.assign(Object.assign({}, value), { $error: e.message });
|
|
141
|
+
resolvedValue = Object.assign(Object.assign({}, value), { $error: e instanceof Error ? e.message : String(e) });
|
|
143
142
|
}
|
|
144
143
|
}
|
|
145
144
|
else {
|
|
@@ -591,16 +590,22 @@ const persistAtom = (key, atomInstance) => {
|
|
|
591
590
|
});
|
|
592
591
|
};
|
|
593
592
|
|
|
594
|
-
const convertRequestToSample = (language, library, request) => {
|
|
593
|
+
const convertRequestToSample = (language, library, request) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
594
|
+
if (!httpsnippetLite.isValidTargetId(language))
|
|
595
|
+
return null;
|
|
595
596
|
try {
|
|
596
|
-
const snippet = new
|
|
597
|
-
|
|
597
|
+
const snippet = new httpsnippetLite.HTTPSnippet(request);
|
|
598
|
+
const converted = yield snippet.convert(language, library);
|
|
599
|
+
if (Array.isArray(converted)) {
|
|
600
|
+
return converted[0];
|
|
601
|
+
}
|
|
602
|
+
return converted || null;
|
|
598
603
|
}
|
|
599
604
|
catch (err) {
|
|
600
605
|
console.error(err);
|
|
601
606
|
return null;
|
|
602
607
|
}
|
|
603
|
-
};
|
|
608
|
+
});
|
|
604
609
|
|
|
605
610
|
const requestSampleConfigs = {
|
|
606
611
|
Shell: {
|
|
@@ -626,7 +631,7 @@ const requestSampleConfigs = {
|
|
|
626
631
|
httpSnippetLibrary: 'fetch',
|
|
627
632
|
},
|
|
628
633
|
XMLHttpRequest: {
|
|
629
|
-
httpSnippetLibrary: '
|
|
634
|
+
httpSnippetLibrary: 'xhr',
|
|
630
635
|
},
|
|
631
636
|
jQuery: {
|
|
632
637
|
httpSnippetLibrary: 'jquery',
|
|
@@ -718,6 +723,11 @@ const requestSampleConfigs = {
|
|
|
718
723
|
Http: {
|
|
719
724
|
mosaicCodeViewerLanguage: 'http',
|
|
720
725
|
httpSnippetLanguage: 'http',
|
|
726
|
+
libraries: {
|
|
727
|
+
'Http1.1': {
|
|
728
|
+
httpSnippetLibrary: 'http1.1',
|
|
729
|
+
},
|
|
730
|
+
},
|
|
721
731
|
},
|
|
722
732
|
Clojure: {
|
|
723
733
|
mosaicCodeViewerLanguage: 'clojure',
|
|
@@ -778,7 +788,24 @@ const RequestSamples = React__default["default"].memo(({ request, embeddedInMd =
|
|
|
778
788
|
const [selectedLanguage, setSelectedLanguage] = jotai.useAtom(selectedLanguageAtom);
|
|
779
789
|
const [selectedLibrary, setSelectedLibrary] = jotai.useAtom(selectedLibraryAtom);
|
|
780
790
|
const { httpSnippetLanguage, httpSnippetLibrary, mosaicCodeViewerLanguage } = getConfigFor(selectedLanguage, selectedLibrary);
|
|
781
|
-
const requestSample =
|
|
791
|
+
const [requestSample, setRequestSample] = React__default["default"].useState(null);
|
|
792
|
+
React__default["default"].useEffect(() => {
|
|
793
|
+
let isStale = false;
|
|
794
|
+
convertRequestToSample(httpSnippetLanguage, httpSnippetLibrary, request)
|
|
795
|
+
.then(example => {
|
|
796
|
+
if (!isStale) {
|
|
797
|
+
setRequestSample(example);
|
|
798
|
+
}
|
|
799
|
+
})
|
|
800
|
+
.catch(() => {
|
|
801
|
+
if (!isStale) {
|
|
802
|
+
setRequestSample(fallbackText);
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
return () => {
|
|
806
|
+
isStale = true;
|
|
807
|
+
};
|
|
808
|
+
}, [request, httpSnippetLanguage, httpSnippetLibrary]);
|
|
782
809
|
const menuItems = React.useMemo(() => {
|
|
783
810
|
const items = Object.entries(requestSampleConfigs).map(([language, config]) => {
|
|
784
811
|
const hasLibraries = config.libraries && Object.keys(config.libraries).length > 0;
|
|
@@ -815,13 +842,12 @@ const RequestSamples = React__default["default"].memo(({ request, embeddedInMd =
|
|
|
815
842
|
selectedLanguage,
|
|
816
843
|
" ",
|
|
817
844
|
selectedLibrary ? ` / ${selectedLibrary}` : '')) }))),
|
|
818
|
-
React__default["default"].createElement(mosaic.Panel.Content, { p: 0 },
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
} }))));
|
|
845
|
+
React__default["default"].createElement(mosaic.Panel.Content, { p: 0 }, requestSample !== null && (React__default["default"].createElement(mosaicCodeViewer.CodeViewer, { "aria-label": requestSample, noCopyButton: true, maxHeight: "400px", language: mosaicCodeViewerLanguage, value: requestSample, style: embeddedInMd
|
|
846
|
+
? undefined
|
|
847
|
+
:
|
|
848
|
+
{
|
|
849
|
+
'--fs-code': 12,
|
|
850
|
+
} })))));
|
|
825
851
|
});
|
|
826
852
|
|
|
827
853
|
function getReadableSecurityName(securityScheme, includeKey = false) {
|
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __awaiter, __rest } from 'tslib';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { useContext, useMemo } from 'react';
|
|
4
4
|
import { convertToJsonSchema } from '@stoplight/http-spec/oas';
|
|
@@ -18,7 +18,7 @@ import { atomWithStorage, useAtomValue } from 'jotai/utils';
|
|
|
18
18
|
import { atom, useAtom, Provider } from 'jotai';
|
|
19
19
|
import URI from 'urijs';
|
|
20
20
|
import { CodeViewer } from '@stoplight/mosaic-code-viewer';
|
|
21
|
-
import HTTPSnippet from 'httpsnippet';
|
|
21
|
+
import { isValidTargetId, HTTPSnippet } from 'httpsnippet-lite';
|
|
22
22
|
import flatten from 'lodash/flatten.js';
|
|
23
23
|
import capitalize from 'lodash/capitalize.js';
|
|
24
24
|
import filter from 'lodash/filter.js';
|
|
@@ -85,7 +85,7 @@ const recursivelyCreateResolvedObject = (currentObject, rootCurrentObject, prope
|
|
|
85
85
|
resolvedValue = mergedOptions.resolver({ pointer: value.$ref, source: null }, newPropertyPath, rootCurrentObject);
|
|
86
86
|
}
|
|
87
87
|
catch (e) {
|
|
88
|
-
resolvedValue = Object.assign(Object.assign({}, value), { $error: e.message });
|
|
88
|
+
resolvedValue = Object.assign(Object.assign({}, value), { $error: e instanceof Error ? e.message : String(e) });
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
@@ -537,16 +537,22 @@ const persistAtom = (key, atomInstance) => {
|
|
|
537
537
|
});
|
|
538
538
|
};
|
|
539
539
|
|
|
540
|
-
const convertRequestToSample = (language, library, request) => {
|
|
540
|
+
const convertRequestToSample = (language, library, request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
541
|
+
if (!isValidTargetId(language))
|
|
542
|
+
return null;
|
|
541
543
|
try {
|
|
542
544
|
const snippet = new HTTPSnippet(request);
|
|
543
|
-
|
|
545
|
+
const converted = yield snippet.convert(language, library);
|
|
546
|
+
if (Array.isArray(converted)) {
|
|
547
|
+
return converted[0];
|
|
548
|
+
}
|
|
549
|
+
return converted || null;
|
|
544
550
|
}
|
|
545
551
|
catch (err) {
|
|
546
552
|
console.error(err);
|
|
547
553
|
return null;
|
|
548
554
|
}
|
|
549
|
-
};
|
|
555
|
+
});
|
|
550
556
|
|
|
551
557
|
const requestSampleConfigs = {
|
|
552
558
|
Shell: {
|
|
@@ -572,7 +578,7 @@ const requestSampleConfigs = {
|
|
|
572
578
|
httpSnippetLibrary: 'fetch',
|
|
573
579
|
},
|
|
574
580
|
XMLHttpRequest: {
|
|
575
|
-
httpSnippetLibrary: '
|
|
581
|
+
httpSnippetLibrary: 'xhr',
|
|
576
582
|
},
|
|
577
583
|
jQuery: {
|
|
578
584
|
httpSnippetLibrary: 'jquery',
|
|
@@ -664,6 +670,11 @@ const requestSampleConfigs = {
|
|
|
664
670
|
Http: {
|
|
665
671
|
mosaicCodeViewerLanguage: 'http',
|
|
666
672
|
httpSnippetLanguage: 'http',
|
|
673
|
+
libraries: {
|
|
674
|
+
'Http1.1': {
|
|
675
|
+
httpSnippetLibrary: 'http1.1',
|
|
676
|
+
},
|
|
677
|
+
},
|
|
667
678
|
},
|
|
668
679
|
Clojure: {
|
|
669
680
|
mosaicCodeViewerLanguage: 'clojure',
|
|
@@ -724,7 +735,24 @@ const RequestSamples = React__default.memo(({ request, embeddedInMd = false }) =
|
|
|
724
735
|
const [selectedLanguage, setSelectedLanguage] = useAtom(selectedLanguageAtom);
|
|
725
736
|
const [selectedLibrary, setSelectedLibrary] = useAtom(selectedLibraryAtom);
|
|
726
737
|
const { httpSnippetLanguage, httpSnippetLibrary, mosaicCodeViewerLanguage } = getConfigFor(selectedLanguage, selectedLibrary);
|
|
727
|
-
const requestSample =
|
|
738
|
+
const [requestSample, setRequestSample] = React__default.useState(null);
|
|
739
|
+
React__default.useEffect(() => {
|
|
740
|
+
let isStale = false;
|
|
741
|
+
convertRequestToSample(httpSnippetLanguage, httpSnippetLibrary, request)
|
|
742
|
+
.then(example => {
|
|
743
|
+
if (!isStale) {
|
|
744
|
+
setRequestSample(example);
|
|
745
|
+
}
|
|
746
|
+
})
|
|
747
|
+
.catch(() => {
|
|
748
|
+
if (!isStale) {
|
|
749
|
+
setRequestSample(fallbackText);
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
return () => {
|
|
753
|
+
isStale = true;
|
|
754
|
+
};
|
|
755
|
+
}, [request, httpSnippetLanguage, httpSnippetLibrary]);
|
|
728
756
|
const menuItems = useMemo(() => {
|
|
729
757
|
const items = Object.entries(requestSampleConfigs).map(([language, config]) => {
|
|
730
758
|
const hasLibraries = config.libraries && Object.keys(config.libraries).length > 0;
|
|
@@ -761,13 +789,12 @@ const RequestSamples = React__default.memo(({ request, embeddedInMd = false }) =
|
|
|
761
789
|
selectedLanguage,
|
|
762
790
|
" ",
|
|
763
791
|
selectedLibrary ? ` / ${selectedLibrary}` : '')) }))),
|
|
764
|
-
React__default.createElement(Panel.Content, { p: 0 },
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
} }))));
|
|
792
|
+
React__default.createElement(Panel.Content, { p: 0 }, requestSample !== null && (React__default.createElement(CodeViewer, { "aria-label": requestSample, noCopyButton: true, maxHeight: "400px", language: mosaicCodeViewerLanguage, value: requestSample, style: embeddedInMd
|
|
793
|
+
? undefined
|
|
794
|
+
:
|
|
795
|
+
{
|
|
796
|
+
'--fs-code': 12,
|
|
797
|
+
} })))));
|
|
771
798
|
});
|
|
772
799
|
|
|
773
800
|
function getReadableSecurityName(securityScheme, includeKey = false) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoplight/elements-core",
|
|
3
|
-
"version": "7.7.
|
|
3
|
+
"version": "7.7.13",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"web-components.min.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@stoplight/types": "^13.7.0",
|
|
39
39
|
"@stoplight/yaml": "^4.2.3",
|
|
40
40
|
"classnames": "^2.2.6",
|
|
41
|
-
"httpsnippet": "^
|
|
41
|
+
"httpsnippet-lite": "^3.0.1",
|
|
42
42
|
"jotai": "1.3.9",
|
|
43
43
|
"json-schema": "^0.4.0",
|
|
44
44
|
"lodash": "^4.17.19",
|
|
@@ -6,8 +6,8 @@ declare type Example = {
|
|
|
6
6
|
data: string;
|
|
7
7
|
};
|
|
8
8
|
export declare type GenerateExampleFromMediaTypeContentOptions = Sampler.Options;
|
|
9
|
-
export declare const useGenerateExampleFromMediaTypeContent: (mediaTypeContent: IMediaTypeContent | undefined, chosenExampleIndex?: number
|
|
10
|
-
export declare const generateExampleFromMediaTypeContent: (mediaTypeContent: IMediaTypeContent | undefined, document: any, chosenExampleIndex?: number, options?:
|
|
9
|
+
export declare const useGenerateExampleFromMediaTypeContent: (mediaTypeContent: IMediaTypeContent | undefined, chosenExampleIndex?: number, { skipReadOnly, skipWriteOnly, skipNonRequired, ticks }?: GenerateExampleFromMediaTypeContentOptions) => string;
|
|
10
|
+
export declare const generateExampleFromMediaTypeContent: (mediaTypeContent: IMediaTypeContent | undefined, document: any, chosenExampleIndex?: number, options?: GenerateExampleFromMediaTypeContentOptions) => string;
|
|
11
11
|
export declare const generateExamplesFromJsonSchema: (schema: JSONSchema7) => Example[];
|
|
12
12
|
export declare const exceedsSize: (example: string, size?: number) => boolean;
|
|
13
13
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { IServer } from '@stoplight/types';
|
|
2
|
-
export declare const getServersToDisplay: (originalServers: IServer[], mockUrl?: string
|
|
2
|
+
export declare const getServersToDisplay: (originalServers: IServer[], mockUrl?: string) => IServer[];
|
|
3
3
|
export declare const getServerUrlWithDefaultValues: (server: IServer) => string | null;
|