@scalar/api-reference 1.35.4 → 1.35.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/dist/browser/standalone.js +18154 -18461
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/Anchor/WithBreadcrumb.vue2.js +8 -11
- package/dist/components/ApiReference.vue.js +1 -1
- package/dist/components/ApiReferenceLayout.vue.js +4 -4
- package/dist/components/ApiReferenceLayout.vue2.js +247 -268
- package/dist/components/Badge/Badge.vue.js +1 -1
- package/dist/components/ClassicHeader.vue.js +1 -1
- package/dist/components/Content/Content.vue.js +145 -169
- package/dist/components/Content/Content.vue3.js +1 -1
- package/dist/components/Content/Models/ClassicLayout.vue.js +1 -1
- package/dist/components/Content/Models/ClassicLayout.vue2.js +32 -35
- package/dist/components/Content/Models/Models.vue.js +27 -31
- package/dist/components/Content/Models/ModernLayout.vue.js +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.js +32 -35
- package/dist/components/Content/Operations/TraversedEntryContainer.vue.js +26 -27
- package/dist/components/Content/Operations/get-current-index.js +1 -1
- package/dist/components/Content/Schema/Schema.vue.js +1 -1
- package/dist/components/Content/Schema/Schema.vue2.js +68 -74
- package/dist/components/Content/Schema/SchemaComposition.vue.js +42 -45
- package/dist/components/Content/Schema/SchemaEnumPropertyItem.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaEnumValues.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaEnumValues.vue2.js +45 -50
- package/dist/components/Content/Schema/SchemaHeading.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.js +30 -34
- package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue2.js +142 -157
- package/dist/components/Content/Schema/SchemaPropertyDetail.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyExamples.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +160 -164
- package/dist/components/Content/Schema/helpers/get-schema-type.js +15 -17
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js +74 -77
- package/dist/components/Content/Schema/helpers/optimize-value-for-display.js +10 -11
- package/dist/components/Content/Tags/ClassicLayout.vue.js +1 -1
- package/dist/components/Content/Tags/ClassicLayout.vue2.js +36 -39
- package/dist/components/Content/Tags/ModernLayout.vue.js +1 -1
- package/dist/components/Content/Tags/ModernLayout.vue2.js +31 -35
- package/dist/components/Content/Tags/TagSection.vue.js +86 -92
- package/dist/components/GettingStarted.vue.js +1 -1
- package/dist/components/LinkList/LinkList.vue.js +1 -1
- package/dist/components/LoadingSkeleton.vue.js +1 -1
- package/dist/components/MobileHeader.vue.d.ts.map +1 -1
- package/dist/components/MobileHeader.vue.js +3 -3
- package/dist/components/MobileHeader.vue2.js +13 -12
- package/dist/components/OperationPath.vue.js +1 -1
- package/dist/components/OperationsList/OperationsList.vue.js +1 -1
- package/dist/components/OperationsList/OperationsList.vue2.js +45 -51
- package/dist/components/OperationsList/OperationsListItem.vue.js +1 -1
- package/dist/components/ScreenReader.vue.js +1 -1
- package/dist/components/Section/CompactSection.vue.js +1 -1
- package/dist/components/Section/Section.vue.js +1 -1
- package/dist/components/Section/Section.vue2.js +13 -14
- package/dist/components/Section/SectionAccordion.vue.js +1 -1
- package/dist/components/Section/SectionAccordion.vue2.js +29 -30
- package/dist/components/Section/SectionColumn.vue.js +1 -1
- package/dist/components/Section/SectionColumns.vue.js +1 -1
- package/dist/components/Section/SectionContainer.vue.js +1 -1
- package/dist/components/Section/SectionContainerAccordion.vue.js +1 -1
- package/dist/components/Section/SectionContent.vue.js +1 -1
- package/dist/components/Section/SectionHeader.vue.js +1 -1
- package/dist/components/Section/SectionHeaderTag.vue.js +1 -1
- package/dist/components/SectionFlare/SectionFlare.vue.js +1 -1
- package/dist/components/ShowMoreButton.vue.js +1 -1
- package/dist/components/ShowMoreButton.vue2.js +12 -13
- package/dist/features/Operation/Operation.vue.js +31 -36
- package/dist/features/Operation/components/Headers.vue.js +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.js +8 -11
- package/dist/features/Operation/components/ParameterList.vue.js +21 -24
- package/dist/features/Operation/components/ParameterListItem.vue.js +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue2.js +36 -37
- package/dist/features/Operation/components/RequestBody.vue.js +1 -1
- package/dist/features/Operation/components/RequestBody.vue2.js +45 -52
- package/dist/features/Operation/components/callbacks/Callback.vue.js +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue2.js +32 -35
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js +4 -4
- package/dist/features/Operation/layouts/ClassicLayout.vue2.js +114 -119
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js +3 -3
- package/dist/features/Operation/layouts/ModernLayout.vue2.js +87 -89
- package/dist/features/Search/components/SearchButton.vue.js +23 -25
- package/dist/features/Search/components/SearchModal.vue.js +1 -1
- package/dist/features/Search/components/SearchModal.vue2.js +53 -54
- package/dist/features/api-client-modal/ApiClientModal.vue.js +31 -38
- package/dist/features/document-source/hooks/useDocumentFetcher.js +17 -18
- package/dist/features/document-source/hooks/useDocumentSource.js +16 -16
- package/dist/features/example-responses/ExampleResponse.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponse.vue2.js +23 -26
- package/dist/features/example-responses/ExampleResponseTab.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponseTabList.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponses.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponses.vue2.js +128 -153
- package/dist/features/info-object/Contact.vue.js +24 -27
- package/dist/features/info-object/License.vue.js +26 -29
- package/dist/features/multiple-documents/DocumentSelector.vue.js +22 -31
- package/dist/features/multiple-documents/useMultipleDocuments.js +52 -56
- package/dist/features/sidebar/components/Sidebar.vue.d.ts.map +1 -1
- package/dist/features/sidebar/components/Sidebar.vue.js +3 -3
- package/dist/features/sidebar/components/Sidebar.vue2.js +74 -79
- package/dist/features/sidebar/components/SidebarElement.vue.js +1 -1
- package/dist/features/sidebar/components/SidebarElement.vue2.js +52 -53
- package/dist/features/sidebar/components/SidebarGroup.vue.js +1 -1
- package/dist/features/sidebar/components/SidebarHttpBadge.vue.js +1 -1
- package/dist/features/specification-extension/SpecificationExtension.vue2.js +28 -31
- package/dist/features/test-request-button/TestRequestButton.vue.js +1 -1
- package/dist/features/test-request-button/TestRequestButton.vue2.js +1 -2
- package/dist/features/traverse-schema/helpers/traverse-description.js +13 -14
- package/dist/features/traverse-schema/helpers/traverse-document.js +14 -15
- package/dist/features/traverse-schema/helpers/traverse-paths.js +20 -23
- package/dist/features/traverse-schema/helpers/traverse-schemas.js +13 -15
- package/dist/features/traverse-schema/helpers/traverse-webhooks.js +8 -10
- package/dist/hooks/useFreezing.js +14 -14
- package/dist/hooks/useNavState.js +37 -39
- package/dist/index.js +2 -2
- package/dist/libs/openapi.js +28 -31
- package/dist/style.css +1 -1
- package/dist/v2/ApiReferenceWorkspace.vue.js +68 -75
- package/dist/v2/ApiReferenceWorkspace.vue3.js +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue2.js +116 -135
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.js +40 -47
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +45 -46
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js +109 -125
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +84 -84
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/update-scheme.js +12 -13
- package/dist/v2/blocks/scalar-client-selector-block/components/ClientDropdown.vue.js +1 -1
- package/dist/v2/blocks/scalar-client-selector-block/components/ClientDropdown.vue2.js +1 -4
- package/dist/v2/blocks/scalar-client-selector-block/components/ClientSelector.vue.js +1 -1
- package/dist/v2/blocks/scalar-client-selector-block/components/ClientSelector.vue2.js +77 -82
- package/dist/v2/blocks/scalar-info-block/components/DownloadLink.vue.js +1 -1
- package/dist/v2/blocks/scalar-info-block/components/DownloadLink.vue2.js +46 -49
- package/dist/v2/blocks/scalar-info-block/components/InfoDescription.vue.js +1 -1
- package/dist/v2/blocks/scalar-info-block/components/IntroductionCard.vue.js +1 -1
- package/dist/v2/blocks/scalar-info-block/components/IntroductionCardItem.vue.js +1 -1
- package/dist/v2/blocks/scalar-info-block/components/IntroductionLayout.vue.js +1 -1
- package/dist/v2/blocks/scalar-info-block/components/IntroductionLayout.vue2.js +74 -89
- package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue2.js +24 -27
- package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.js +1 -1
- package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue2.js +106 -119
- package/dist/v2/blocks/scalar-request-example-block/helpers/find-client.js +11 -12
- package/dist/v2/blocks/scalar-request-example-block/helpers/get-secrets.js +3 -3
- package/dist/v2/blocks/scalar-server-selector-block/components/Selector.vue.js +11 -14
- package/dist/v2/blocks/scalar-server-selector-block/components/ServerSelector.vue.js +45 -48
- package/dist/v2/helpers/get-document-name.js +10 -10
- package/dist/v2/helpers/map-configuration.js +48 -51
- package/dist/v2/hooks/use-legacy-store-events.js +44 -48
- package/dist/v2/hooks/use-workspace-store-events.js +23 -26
- package/package.json +19 -19
- package/dist/components/ApiReferenceLayout.vue3.js +0 -4
- package/dist/components/ApiReferenceLayout.vue4.js +0 -4
- package/dist/components/ApiReferenceLayout.vue5.js +0 -4
- package/dist/components/ApiReferenceLayout.vue6.js +0 -4
- package/dist/components/Badge/Badge.vue3.js +0 -4
- package/dist/components/ClassicHeader.vue2.js +0 -4
- package/dist/components/Content/Content.vue2.js +0 -4
- package/dist/components/Content/Models/ClassicLayout.vue3.js +0 -4
- package/dist/components/Content/Models/ModernLayout.vue3.js +0 -4
- package/dist/components/Content/Schema/Schema.vue3.js +0 -4
- package/dist/components/Content/Schema/SchemaEnumPropertyItem.vue3.js +0 -4
- package/dist/components/Content/Schema/SchemaEnumValues.vue3.js +0 -4
- package/dist/components/Content/Schema/SchemaHeading.vue3.js +0 -4
- package/dist/components/Content/Schema/SchemaProperty.vue3.js +0 -4
- package/dist/components/Content/Schema/SchemaPropertyDetail.vue3.js +0 -4
- package/dist/components/Content/Schema/SchemaPropertyExamples.vue3.js +0 -4
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue3.js +0 -4
- package/dist/components/Content/Tags/ClassicLayout.vue3.js +0 -4
- package/dist/components/Content/Tags/ModernLayout.vue3.js +0 -4
- package/dist/components/GettingStarted.vue3.js +0 -4
- package/dist/components/LinkList/LinkList.vue3.js +0 -4
- package/dist/components/LoadingSkeleton.vue3.js +0 -4
- package/dist/components/MobileHeader.vue3.js +0 -4
- package/dist/components/OperationPath.vue3.js +0 -4
- package/dist/components/OperationsList/OperationsList.vue3.js +0 -4
- package/dist/components/OperationsList/OperationsListItem.vue3.js +0 -4
- package/dist/components/ScreenReader.vue3.js +0 -4
- package/dist/components/Section/CompactSection.vue3.js +0 -4
- package/dist/components/Section/Section.vue3.js +0 -4
- package/dist/components/Section/SectionAccordion.vue3.js +0 -4
- package/dist/components/Section/SectionColumn.vue2.js +0 -4
- package/dist/components/Section/SectionColumns.vue2.js +0 -4
- package/dist/components/Section/SectionContainer.vue3.js +0 -4
- package/dist/components/Section/SectionContainerAccordion.vue3.js +0 -4
- package/dist/components/Section/SectionContent.vue3.js +0 -4
- package/dist/components/Section/SectionHeader.vue3.js +0 -4
- package/dist/components/Section/SectionHeaderTag.vue3.js +0 -4
- package/dist/components/SectionFlare/SectionFlare.vue2.js +0 -4
- package/dist/components/ShowMoreButton.vue3.js +0 -4
- package/dist/features/Operation/components/Headers.vue3.js +0 -4
- package/dist/features/Operation/components/ParameterListItem.vue3.js +0 -4
- package/dist/features/Operation/components/RequestBody.vue3.js +0 -4
- package/dist/features/Operation/components/callbacks/Callback.vue3.js +0 -4
- package/dist/features/Operation/layouts/ClassicLayout.vue3.js +0 -4
- package/dist/features/Operation/layouts/ModernLayout.vue3.js +0 -4
- package/dist/features/Search/components/SearchModal.vue3.js +0 -4
- package/dist/features/example-responses/ExampleResponse.vue3.js +0 -4
- package/dist/features/example-responses/ExampleResponseTab.vue3.js +0 -4
- package/dist/features/example-responses/ExampleResponseTabList.vue3.js +0 -4
- package/dist/features/example-responses/ExampleResponses.vue3.js +0 -4
- package/dist/features/sidebar/components/Sidebar.vue3.js +0 -4
- package/dist/features/sidebar/components/SidebarElement.vue3.js +0 -4
- package/dist/features/sidebar/components/SidebarGroup.vue3.js +0 -4
- package/dist/features/sidebar/components/SidebarHttpBadge.vue3.js +0 -4
- package/dist/features/test-request-button/TestRequestButton.vue3.js +0 -4
- package/dist/v2/ApiReferenceWorkspace.vue2.js +0 -4
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue3.js +0 -4
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue3.js +0 -4
- package/dist/v2/blocks/scalar-client-selector-block/components/ClientDropdown.vue3.js +0 -4
- package/dist/v2/blocks/scalar-client-selector-block/components/ClientSelector.vue3.js +0 -4
- package/dist/v2/blocks/scalar-info-block/components/DownloadLink.vue3.js +0 -4
- package/dist/v2/blocks/scalar-info-block/components/InfoDescription.vue3.js +0 -4
- package/dist/v2/blocks/scalar-info-block/components/IntroductionCard.vue3.js +0 -4
- package/dist/v2/blocks/scalar-info-block/components/IntroductionCardItem.vue2.js +0 -4
- package/dist/v2/blocks/scalar-info-block/components/IntroductionLayout.vue3.js +0 -4
- package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue3.js +0 -4
|
@@ -1,47 +1,43 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useActiveEntities as
|
|
3
|
-
import { mutateSecuritySchemeDiff as
|
|
4
|
-
import { getServersFromDocument as
|
|
5
|
-
import { emitCustomEvent as
|
|
1
|
+
import { defineComponent as h, ref as S, onMounted as g, watch as E, onBeforeUnmount as b, createElementBlock as B, openBlock as R } from "vue";
|
|
2
|
+
import { useActiveEntities as k, useWorkspace as q } from "@scalar/api-client/store";
|
|
3
|
+
import { mutateSecuritySchemeDiff as x } from "@scalar/api-client/views/Request/libs";
|
|
4
|
+
import { getServersFromDocument as D } from "@scalar/oas-utils/helpers";
|
|
5
|
+
import { emitCustomEvent as U } from "@scalar/workspace-store/events";
|
|
6
6
|
import { watchDebounced as f } from "@vueuse/core";
|
|
7
|
-
import
|
|
8
|
-
import { useNavState as
|
|
9
|
-
import { useApiClient as
|
|
10
|
-
import { useExampleStore as
|
|
11
|
-
const z = /* @__PURE__ */
|
|
7
|
+
import m from "microdiff";
|
|
8
|
+
import { useNavState as C } from "../../hooks/useNavState.js";
|
|
9
|
+
import { useApiClient as y } from "./useApiClient.js";
|
|
10
|
+
import { useExampleStore as A } from "../../legacy/stores/useExampleStore.js";
|
|
11
|
+
const z = /* @__PURE__ */ h({
|
|
12
12
|
__name: "ApiClientModal",
|
|
13
13
|
props: {
|
|
14
14
|
configuration: {},
|
|
15
15
|
dereferencedDocument: {}
|
|
16
16
|
},
|
|
17
17
|
setup(r) {
|
|
18
|
-
const
|
|
18
|
+
const n = S(null), { client: u, init: v } = y(), { selectedExampleKey: d, operationId: s } = A(), i = k(), a = q(), { isIntersectionEnabled: l } = C(), p = () => ({
|
|
19
19
|
name: "on-before-request",
|
|
20
20
|
hooks: {
|
|
21
21
|
onBeforeRequest: r.configuration.onBeforeRequest
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
el:
|
|
24
|
+
return g(() => {
|
|
25
|
+
n.value && v({
|
|
26
|
+
el: n.value,
|
|
27
27
|
configuration: {
|
|
28
28
|
...r.configuration,
|
|
29
29
|
// If the onBeforeRequest hook is configured, we add the plugin to the API client.
|
|
30
|
-
plugins: r.configuration.onBeforeRequest ? [
|
|
30
|
+
plugins: r.configuration.onBeforeRequest ? [p] : []
|
|
31
31
|
},
|
|
32
|
-
store:
|
|
32
|
+
store: a
|
|
33
33
|
});
|
|
34
34
|
}), f(
|
|
35
35
|
() => r.dereferencedDocument,
|
|
36
36
|
(e, o) => {
|
|
37
|
-
|
|
38
|
-
if (!e)
|
|
39
|
-
return;
|
|
40
|
-
const n = v(e, o || {});
|
|
41
|
-
n != null && n.length && (a.activeCollection.value && ((s = i.value) == null || s.resetStore()), c.importSpecFile(void 0, "default", {
|
|
37
|
+
!e || !m(e, o || {})?.length || (i.activeCollection.value && u.value?.resetStore(), a.importSpecFile(void 0, "default", {
|
|
42
38
|
dereferencedDocument: e,
|
|
43
39
|
shouldLoad: !1,
|
|
44
|
-
documentUrl:
|
|
40
|
+
documentUrl: r.configuration?.url,
|
|
45
41
|
useCollectionSecurity: !0,
|
|
46
42
|
...r.configuration
|
|
47
43
|
}));
|
|
@@ -49,22 +45,22 @@ const z = /* @__PURE__ */ S({
|
|
|
49
45
|
), f(
|
|
50
46
|
() => r.configuration,
|
|
51
47
|
(e, o) => {
|
|
52
|
-
if (!o || !
|
|
48
|
+
if (!o || !i.activeCollection.value)
|
|
53
49
|
return;
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
50
|
+
const c = m(o, e);
|
|
51
|
+
if (!c.some(
|
|
56
52
|
(t) => t.path[0] === "url" || t.path[0] === "content" || t.path[1] === "url" || t.path[1] === "content"
|
|
57
53
|
)) {
|
|
58
|
-
if (
|
|
59
|
-
t.path[0] === "authentication" &&
|
|
54
|
+
if (c.forEach((t) => {
|
|
55
|
+
t.path[0] === "authentication" && x(t, i, a);
|
|
60
56
|
}), e.servers || o.servers) {
|
|
61
|
-
const t =
|
|
57
|
+
const t = D(
|
|
62
58
|
e.servers ?? r.dereferencedDocument.servers,
|
|
63
59
|
{
|
|
64
60
|
baseServerURL: e.baseServerURL
|
|
65
61
|
}
|
|
66
62
|
);
|
|
67
|
-
|
|
63
|
+
U(n.value, "scalar-replace-servers", {
|
|
68
64
|
servers: t,
|
|
69
65
|
options: {
|
|
70
66
|
disableOldStoreUpdate: !0
|
|
@@ -72,19 +68,16 @@ const z = /* @__PURE__ */ S({
|
|
|
72
68
|
});
|
|
73
69
|
}
|
|
74
70
|
}
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
l.value = !1, setTimeout(() => {
|
|
72
|
+
l.value = !0;
|
|
77
73
|
}, 1e3);
|
|
78
74
|
},
|
|
79
75
|
{ deep: !0, debounce: 300 }
|
|
80
|
-
),
|
|
81
|
-
|
|
82
|
-
}),
|
|
83
|
-
var e;
|
|
84
|
-
return (e = i.value) == null ? void 0 : e.app.unmount();
|
|
85
|
-
}), (e, o) => (k(), R("div", {
|
|
76
|
+
), E(d, (e) => {
|
|
77
|
+
u.value && e && s.value && u.value.updateExample(e, s.value);
|
|
78
|
+
}), b(() => u.value?.app.unmount()), (e, o) => (R(), B("div", {
|
|
86
79
|
ref_key: "el",
|
|
87
|
-
ref:
|
|
80
|
+
ref: n
|
|
88
81
|
}, null, 512));
|
|
89
82
|
}
|
|
90
83
|
});
|
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
import { fetchDocument as i, prettyPrintJson as f } from "@scalar/oas-utils/helpers";
|
|
2
|
-
import { ref as s, watch as m, toValue as
|
|
2
|
+
import { ref as s, watch as m, toValue as c } from "vue";
|
|
3
3
|
function l({
|
|
4
|
-
configuration:
|
|
4
|
+
configuration: e
|
|
5
5
|
}) {
|
|
6
6
|
const t = s("");
|
|
7
7
|
return m(
|
|
8
|
-
() =>
|
|
9
|
-
async (
|
|
10
|
-
|
|
11
|
-
if (!n)
|
|
8
|
+
() => c(e),
|
|
9
|
+
async (r) => {
|
|
10
|
+
if (!r)
|
|
12
11
|
return;
|
|
13
|
-
const
|
|
14
|
-
typeof
|
|
12
|
+
const o = await a(r, c(e)?.proxyUrl, c(e)?.fetch);
|
|
13
|
+
typeof o == "string" && (t.value = o.trim());
|
|
15
14
|
},
|
|
16
15
|
{ immediate: !0, deep: !0 }
|
|
17
16
|
), {
|
|
18
17
|
originalDocument: t
|
|
19
18
|
};
|
|
20
19
|
}
|
|
21
|
-
const a = async ({ url:
|
|
22
|
-
if (
|
|
20
|
+
const a = async ({ url: e, content: t }, r, o) => {
|
|
21
|
+
if (e && !t)
|
|
23
22
|
try {
|
|
24
|
-
return await i(
|
|
25
|
-
} catch (
|
|
26
|
-
console.error("Failed to fetch OpenAPI document from URL:",
|
|
23
|
+
return await i(e, r, o);
|
|
24
|
+
} catch (u) {
|
|
25
|
+
console.error("Failed to fetch OpenAPI document from URL:", u);
|
|
27
26
|
}
|
|
28
|
-
const
|
|
29
|
-
if (typeof
|
|
30
|
-
return
|
|
31
|
-
if (typeof
|
|
32
|
-
return f(
|
|
27
|
+
const n = typeof t == "function" ? t() : t;
|
|
28
|
+
if (typeof n == "string")
|
|
29
|
+
return n;
|
|
30
|
+
if (typeof n == "object")
|
|
31
|
+
return f(n);
|
|
33
32
|
};
|
|
34
33
|
export {
|
|
35
34
|
l as useDocumentFetcher
|
|
@@ -2,16 +2,16 @@ import { createWorkspaceStore as v, createActiveEntitiesStore as y } from "@scal
|
|
|
2
2
|
import { measureAsync as P } from "@scalar/helpers/testing/measure";
|
|
3
3
|
import { normalize as w, upgrade as O, dereference as V } from "@scalar/openapi-parser";
|
|
4
4
|
import { apiReferenceConfigurationSchema as D } from "@scalar/types/api-reference";
|
|
5
|
-
import { computed as f, toValue as
|
|
5
|
+
import { computed as f, toValue as r, ref as l, watch as F } from "vue";
|
|
6
6
|
import { useDocumentFetcher as I } from "./useDocumentFetcher.js";
|
|
7
7
|
function C({
|
|
8
8
|
originalDocument: c,
|
|
9
|
-
dereferencedDocument:
|
|
9
|
+
dereferencedDocument: t,
|
|
10
10
|
configuration: i
|
|
11
11
|
}) {
|
|
12
12
|
const { originalDocument: d } = I({
|
|
13
13
|
configuration: i
|
|
14
|
-
}), s = f(() => c ?
|
|
14
|
+
}), s = f(() => c ? r(c) : r(d)), o = l(""), h = f(() => t ? r(t) : r(u)), u = l({
|
|
15
15
|
openapi: "3.1.0",
|
|
16
16
|
info: {
|
|
17
17
|
title: "",
|
|
@@ -20,32 +20,32 @@ function C({
|
|
|
20
20
|
paths: {}
|
|
21
21
|
});
|
|
22
22
|
F(
|
|
23
|
-
() =>
|
|
24
|
-
async (
|
|
25
|
-
if (!
|
|
23
|
+
() => r(s),
|
|
24
|
+
async (n) => {
|
|
25
|
+
if (!n)
|
|
26
26
|
return;
|
|
27
|
-
const e = w(
|
|
27
|
+
const e = w(n);
|
|
28
28
|
if (e === void 0) {
|
|
29
|
-
console.error("Failed to parse the OpenAPI document:",
|
|
29
|
+
console.error("Failed to parse the OpenAPI document:", n);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
if (
|
|
32
|
+
if (o.value = typeof e == "object" && (e.openapi || e.swagger) || "", t)
|
|
33
33
|
return;
|
|
34
|
-
const S = !
|
|
34
|
+
const S = !o.value.startsWith("3.1") ? (
|
|
35
35
|
// Upgrade needed
|
|
36
36
|
O(e).specification
|
|
37
37
|
) : (
|
|
38
38
|
// Skip the upgrade
|
|
39
39
|
e
|
|
40
40
|
), A = await P("dereference", async () => {
|
|
41
|
-
const { schema: p, errors:
|
|
42
|
-
return
|
|
41
|
+
const { schema: p, errors: a } = await V(S);
|
|
42
|
+
return a?.length && console.warn(
|
|
43
43
|
`Please open an issue on https://github.com/scalar/scalar
|
|
44
44
|
`,
|
|
45
45
|
`Scalar OpenAPI Parser Warning:
|
|
46
46
|
`,
|
|
47
|
-
|
|
48
|
-
), p === void 0 && console.error("Failed to dereference the OpenAPI document",
|
|
47
|
+
a
|
|
48
|
+
), p === void 0 && console.error("Failed to dereference the OpenAPI document", a), p;
|
|
49
49
|
});
|
|
50
50
|
u.value = A;
|
|
51
51
|
},
|
|
@@ -53,11 +53,11 @@ function C({
|
|
|
53
53
|
);
|
|
54
54
|
const m = v({
|
|
55
55
|
useLocalStorage: !1,
|
|
56
|
-
...
|
|
56
|
+
...r(i) ?? D.parse({})
|
|
57
57
|
}), g = y(m);
|
|
58
58
|
return {
|
|
59
59
|
originalDocument: s,
|
|
60
|
-
originalOpenApiVersion:
|
|
60
|
+
originalOpenApiVersion: o,
|
|
61
61
|
dereferencedDocument: h,
|
|
62
62
|
workspaceStore: m,
|
|
63
63
|
activeEntitiesStore: g
|
|
@@ -1,37 +1,34 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarCodeBlock as
|
|
3
|
-
import { getExampleFromSchema as
|
|
4
|
-
import { getResolvedRef as
|
|
5
|
-
import { getResolvedRefDeep as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as r, createBlock as n, createElementBlock as l, openBlock as t, unref as e } from "vue";
|
|
2
|
+
import { ScalarCodeBlock as s } from "@scalar/components";
|
|
3
|
+
import { getExampleFromSchema as m } from "@scalar/oas-utils/spec-getters";
|
|
4
|
+
import { getResolvedRef as a } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
5
|
+
import { getResolvedRefDeep as p } from "./helpers/get-resolved-ref-deep.js";
|
|
6
|
+
const c = {
|
|
7
7
|
key: 2,
|
|
8
8
|
class: "empty-state"
|
|
9
|
-
},
|
|
9
|
+
}, _ = /* @__PURE__ */ r({
|
|
10
10
|
__name: "ExampleResponse",
|
|
11
11
|
props: {
|
|
12
12
|
response: {},
|
|
13
13
|
example: {}
|
|
14
14
|
},
|
|
15
|
-
setup(
|
|
16
|
-
return (o,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
lang: "json"
|
|
31
|
-
}, null, 8, ["content"])) : (t(), a("div", i, " No Body "));
|
|
32
|
-
};
|
|
15
|
+
setup(f) {
|
|
16
|
+
return (o, i) => o.example !== void 0 ? (t(), n(e(s), {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "bg-b-2 -outline-offset-2",
|
|
19
|
+
content: e(p)(o.example)?.value,
|
|
20
|
+
lang: "json"
|
|
21
|
+
}, null, 8, ["content"])) : o.response?.schema ? (t(), n(e(s), {
|
|
22
|
+
key: 1,
|
|
23
|
+
class: "bg-b-2 -outline-offset-2",
|
|
24
|
+
content: e(m)(e(a)(o.response.schema), {
|
|
25
|
+
emptyString: "string",
|
|
26
|
+
mode: "read"
|
|
27
|
+
}),
|
|
28
|
+
lang: "json"
|
|
29
|
+
}, null, 8, ["content"])) : (t(), l("div", c, " No Body "));
|
|
33
30
|
}
|
|
34
31
|
});
|
|
35
32
|
export {
|
|
36
|
-
|
|
33
|
+
_ as default
|
|
37
34
|
};
|