@scalar/workspace-store 0.40.2 → 0.40.3
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 +7 -0
- package/dist/client.d.ts +7 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +820 -681
- package/dist/entities/auth/index.js +96 -101
- package/dist/entities/auth/schema.js +42 -116
- package/dist/entities/history/index.js +80 -60
- package/dist/entities/history/schema.js +94 -88
- package/dist/events/bus.js +146 -93
- package/dist/events/definitions/analytics.js +1 -1
- package/dist/events/definitions/auth.js +1 -1
- package/dist/events/definitions/common.js +1 -1
- package/dist/events/definitions/cookie.js +1 -1
- package/dist/events/definitions/document.js +1 -1
- package/dist/events/definitions/environment.js +1 -1
- package/dist/events/definitions/hooks.js +1 -1
- package/dist/events/definitions/index.js +1 -1
- package/dist/events/definitions/meta.js +1 -1
- package/dist/events/definitions/operation.js +1 -1
- package/dist/events/definitions/server.js +1 -1
- package/dist/events/definitions/tabs.js +1 -1
- package/dist/events/definitions/tag.js +1 -1
- package/dist/events/definitions/ui.js +1 -1
- package/dist/events/definitions/workspace.js +1 -1
- package/dist/events/index.js +3 -9
- package/dist/events/listeners.js +20 -22
- package/dist/events/old-definitions.js +15 -12
- package/dist/helpers/deep-clone.js +33 -17
- package/dist/helpers/detect-changes-proxy.js +95 -57
- package/dist/helpers/general.js +78 -23
- package/dist/helpers/generate-unique-value.js +77 -45
- package/dist/helpers/get-fetch.js +12 -10
- package/dist/helpers/get-resolved-ref.js +11 -10
- package/dist/helpers/is-non-optional-security-requirement.js +3 -6
- package/dist/helpers/merge-object.js +71 -30
- package/dist/helpers/overrides-proxy.js +98 -58
- package/dist/helpers/unpack-proxy.js +60 -58
- package/dist/mutators/auth.js +358 -230
- package/dist/mutators/cookie.js +59 -42
- package/dist/mutators/document.js +104 -66
- package/dist/mutators/environment.js +97 -72
- package/dist/mutators/helpers.js +9 -13
- package/dist/mutators/index.js +62 -49
- package/dist/mutators/operation/body.js +88 -57
- package/dist/mutators/operation/extensions.js +20 -12
- package/dist/mutators/operation/helpers/fetch-request-to-har.js +144 -107
- package/dist/mutators/operation/helpers/fetch-response-to-har.js +143 -95
- package/dist/mutators/operation/helpers/get-parameter-position.js +12 -12
- package/dist/mutators/operation/helpers/har-to-operation.js +169 -132
- package/dist/mutators/operation/helpers/sync-path-parameters.js +109 -60
- package/dist/mutators/operation/history.js +60 -64
- package/dist/mutators/operation/index.js +25 -49
- package/dist/mutators/operation/operation.js +349 -240
- package/dist/mutators/operation/parameters.js +157 -93
- package/dist/mutators/server.js +213 -152
- package/dist/mutators/tabs.js +173 -130
- package/dist/mutators/tag.js +131 -97
- package/dist/mutators/workspace.js +72 -42
- package/dist/navigation/get-navigation-options.js +97 -84
- package/dist/navigation/helpers/get-openapi-object.js +46 -29
- package/dist/navigation/helpers/get-operation-entries.js +72 -32
- package/dist/navigation/helpers/get-parent-entry.js +16 -12
- package/dist/navigation/helpers/get-tag-entries.js +56 -29
- package/dist/navigation/helpers/get-tag.js +22 -23
- package/dist/navigation/helpers/get-x-keys.js +13 -9
- package/dist/navigation/helpers/traverse-description.js +90 -72
- package/dist/navigation/helpers/traverse-document.js +111 -98
- package/dist/navigation/helpers/traverse-examples.js +35 -31
- package/dist/navigation/helpers/traverse-paths.js +118 -106
- package/dist/navigation/helpers/traverse-schemas.js +65 -64
- package/dist/navigation/helpers/traverse-tags.js +158 -129
- package/dist/navigation/helpers/traverse-webhooks.js +96 -90
- package/dist/navigation/helpers/update-order-ids.js +59 -51
- package/dist/navigation/helpers/utils.js +71 -21
- package/dist/navigation/index.js +5 -13
- package/dist/navigation/types.js +1 -1
- package/dist/persistence/index.js +283 -285
- package/dist/persistence/indexdb.js +263 -126
- package/dist/plugins/bundler/helpers.js +21 -12
- package/dist/plugins/bundler/index.d.ts +7 -0
- package/dist/plugins/bundler/index.d.ts.map +1 -1
- package/dist/plugins/bundler/index.js +305 -171
- package/dist/plugins/client/index.js +1 -5
- package/dist/plugins/client/persistence.js +95 -90
- package/dist/resolve.js +18 -25
- package/dist/schemas/compose.js +6 -7
- package/dist/schemas/extensions/document/x-internal.js +3 -7
- package/dist/schemas/extensions/document/x-scalar-environments.js +16 -22
- package/dist/schemas/extensions/document/x-scalar-icon.js +3 -7
- package/dist/schemas/extensions/document/x-scalar-ignore.js +3 -7
- package/dist/schemas/extensions/document/x-scalar-is-dirty.js +21 -8
- package/dist/schemas/extensions/document/x-scalar-original-document-hash.js +17 -8
- package/dist/schemas/extensions/document/x-scalar-registry-meta.js +15 -21
- package/dist/schemas/extensions/document/x-scalar-sdk-installation.js +5 -13
- package/dist/schemas/extensions/document/x-scalar-watch-mode.js +4 -8
- package/dist/schemas/extensions/document/x-tags.js +3 -7
- package/dist/schemas/extensions/example/x-disabled.js +17 -7
- package/dist/schemas/extensions/general/x-scalar-active-environment.js +4 -7
- package/dist/schemas/extensions/general/x-scalar-cookies.js +9 -14
- package/dist/schemas/extensions/general/x-scalar-order.js +8 -7
- package/dist/schemas/extensions/operation/index.js +4 -23
- package/dist/schemas/extensions/operation/x-badge.js +42 -50
- package/dist/schemas/extensions/operation/x-code-samples.js +8 -12
- package/dist/schemas/extensions/operation/x-draft-examples.js +3 -7
- package/dist/schemas/extensions/operation/x-post-response.js +18 -7
- package/dist/schemas/extensions/operation/x-scalar-disable-parameters.js +57 -13
- package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js +9 -7
- package/dist/schemas/extensions/operation/x-scalar-stability.js +15 -14
- package/dist/schemas/extensions/parameter/x-global.js +12 -7
- package/dist/schemas/extensions/schema/x-additional-properties-name.js +10 -7
- package/dist/schemas/extensions/schema/x-enum-descriptions.js +17 -12
- package/dist/schemas/extensions/schema/x-enum-varnames.js +21 -8
- package/dist/schemas/extensions/schema/x-examples.js +3 -7
- package/dist/schemas/extensions/schema/x-variable.js +3 -7
- package/dist/schemas/extensions/security/index.js +1 -1
- package/dist/schemas/extensions/security/x-default-scopes.js +16 -7
- package/dist/schemas/extensions/security/x-scalar-credentials-location.js +16 -7
- package/dist/schemas/extensions/security/x-scalar-security-body.js +14 -7
- package/dist/schemas/extensions/security/x-scalar-security-query.js +14 -7
- package/dist/schemas/extensions/security/x-scalar-security-secrets.js +66 -37
- package/dist/schemas/extensions/security/x-tokenName.js +11 -7
- package/dist/schemas/extensions/security/x-use-pkce.js +6 -10
- package/dist/schemas/extensions/server/x-scalar-selected-server.js +3 -7
- package/dist/schemas/extensions/tag/index.js +1 -1
- package/dist/schemas/extensions/tag/x-display-name.js +11 -7
- package/dist/schemas/extensions/tag/x-tag-groups.js +13 -15
- package/dist/schemas/extensions/workspace/index.js +2 -11
- package/dist/schemas/extensions/workspace/x-scalar-active-proxy.js +13 -7
- package/dist/schemas/extensions/workspace/x-scalar-tabs.js +15 -13
- package/dist/schemas/extensions.js +11 -15
- package/dist/schemas/inmemory-workspace.js +13 -21
- package/dist/schemas/navigation.js +48 -85
- package/dist/schemas/reference-config/appearance.js +15 -22
- package/dist/schemas/reference-config/features.js +14 -21
- package/dist/schemas/reference-config/index.js +42 -44
- package/dist/schemas/reference-config/meta.js +11 -18
- package/dist/schemas/reference-config/routing.js +7 -14
- package/dist/schemas/reference-config/settings.js +10 -17
- package/dist/schemas/typebox-coerce.js +23 -6
- package/dist/schemas/v3.1/strict/callback.js +6 -12
- package/dist/schemas/v3.1/strict/components.js +26 -48
- package/dist/schemas/v3.1/strict/contact.js +9 -12
- package/dist/schemas/v3.1/strict/discriminator.js +11 -10
- package/dist/schemas/v3.1/strict/encoding.js +15 -12
- package/dist/schemas/v3.1/strict/example.js +11 -13
- package/dist/schemas/v3.1/strict/external-documentation.js +7 -10
- package/dist/schemas/v3.1/strict/header.js +27 -28
- package/dist/schemas/v3.1/strict/info.js +10 -16
- package/dist/schemas/v3.1/strict/license.js +9 -12
- package/dist/schemas/v3.1/strict/link.js +22 -19
- package/dist/schemas/v3.1/strict/media-type.js +17 -16
- package/dist/schemas/v3.1/strict/oauth-flow.js +28 -62
- package/dist/schemas/v3.1/strict/oauthflows.js +14 -20
- package/dist/schemas/v3.1/strict/openapi-document.js +126 -210
- package/dist/schemas/v3.1/strict/operation.js +16 -43
- package/dist/schemas/v3.1/strict/parameter.js +27 -35
- package/dist/schemas/v3.1/strict/path-item.js +36 -40
- package/dist/schemas/v3.1/strict/paths.js +8 -11
- package/dist/schemas/v3.1/strict/ref-definitions.js +76 -100
- package/dist/schemas/v3.1/strict/reference.js +18 -21
- package/dist/schemas/v3.1/strict/request-body.js +8 -16
- package/dist/schemas/v3.1/strict/response.js +12 -16
- package/dist/schemas/v3.1/strict/responses.js +13 -11
- package/dist/schemas/v3.1/strict/schema.js +149 -157
- package/dist/schemas/v3.1/strict/security-requirement.js +13 -12
- package/dist/schemas/v3.1/strict/security-scheme.js +29 -41
- package/dist/schemas/v3.1/strict/server-variable.js +9 -12
- package/dist/schemas/v3.1/strict/server.js +10 -13
- package/dist/schemas/v3.1/strict/tag.js +11 -20
- package/dist/schemas/v3.1/strict/type-guards.js +20 -20
- package/dist/schemas/v3.1/strict/xml.js +17 -16
- package/dist/schemas/workspace-specification/index.js +11 -23
- package/dist/schemas/workspace-specification/info.js +4 -8
- package/dist/schemas/workspace.js +25 -51
- package/dist/schemas.js +2 -6
- package/dist/server.js +286 -176
- package/dist/workspace-plugin.js +1 -1
- package/package.json +13 -19
- package/dist/client.js.map +0 -7
- package/dist/entities/auth/index.js.map +0 -7
- package/dist/entities/auth/schema.js.map +0 -7
- package/dist/entities/history/index.js.map +0 -7
- package/dist/entities/history/schema.js.map +0 -7
- package/dist/events/bus.js.map +0 -7
- package/dist/events/definitions/analytics.js.map +0 -7
- package/dist/events/definitions/auth.js.map +0 -7
- package/dist/events/definitions/common.js.map +0 -7
- package/dist/events/definitions/cookie.js.map +0 -7
- package/dist/events/definitions/document.js.map +0 -7
- package/dist/events/definitions/environment.js.map +0 -7
- package/dist/events/definitions/hooks.js.map +0 -7
- package/dist/events/definitions/index.js.map +0 -7
- package/dist/events/definitions/meta.js.map +0 -7
- package/dist/events/definitions/operation.js.map +0 -7
- package/dist/events/definitions/server.js.map +0 -7
- package/dist/events/definitions/tabs.js.map +0 -7
- package/dist/events/definitions/tag.js.map +0 -7
- package/dist/events/definitions/ui.js.map +0 -7
- package/dist/events/definitions/workspace.js.map +0 -7
- package/dist/events/index.js.map +0 -7
- package/dist/events/listeners.js.map +0 -7
- package/dist/events/old-definitions.js.map +0 -7
- package/dist/helpers/apply-selective-updates.d.ts +0 -19
- package/dist/helpers/apply-selective-updates.d.ts.map +0 -1
- package/dist/helpers/apply-selective-updates.js +0 -37
- package/dist/helpers/apply-selective-updates.js.map +0 -7
- package/dist/helpers/deep-clone.js.map +0 -7
- package/dist/helpers/detect-changes-proxy.js.map +0 -7
- package/dist/helpers/general.js.map +0 -7
- package/dist/helpers/generate-unique-value.js.map +0 -7
- package/dist/helpers/get-fetch.js.map +0 -7
- package/dist/helpers/get-resolved-ref.js.map +0 -7
- package/dist/helpers/is-non-optional-security-requirement.js.map +0 -7
- package/dist/helpers/merge-object.js.map +0 -7
- package/dist/helpers/overrides-proxy.js.map +0 -7
- package/dist/helpers/unpack-proxy.js.map +0 -7
- package/dist/mutators/auth.js.map +0 -7
- package/dist/mutators/cookie.js.map +0 -7
- package/dist/mutators/document.js.map +0 -7
- package/dist/mutators/environment.js.map +0 -7
- package/dist/mutators/helpers.js.map +0 -7
- package/dist/mutators/index.js.map +0 -7
- package/dist/mutators/operation/body.js.map +0 -7
- package/dist/mutators/operation/extensions.js.map +0 -7
- package/dist/mutators/operation/helpers/fetch-request-to-har.js.map +0 -7
- package/dist/mutators/operation/helpers/fetch-response-to-har.js.map +0 -7
- package/dist/mutators/operation/helpers/get-parameter-position.js.map +0 -7
- package/dist/mutators/operation/helpers/har-to-operation.js.map +0 -7
- package/dist/mutators/operation/helpers/sync-path-parameters.js.map +0 -7
- package/dist/mutators/operation/history.js.map +0 -7
- package/dist/mutators/operation/index.js.map +0 -7
- package/dist/mutators/operation/operation.js.map +0 -7
- package/dist/mutators/operation/parameters.js.map +0 -7
- package/dist/mutators/server.js.map +0 -7
- package/dist/mutators/tabs.js.map +0 -7
- package/dist/mutators/tag.js.map +0 -7
- package/dist/mutators/workspace.js.map +0 -7
- package/dist/navigation/get-navigation-options.js.map +0 -7
- package/dist/navigation/helpers/get-openapi-object.js.map +0 -7
- package/dist/navigation/helpers/get-operation-entries.js.map +0 -7
- package/dist/navigation/helpers/get-parent-entry.js.map +0 -7
- package/dist/navigation/helpers/get-tag-entries.js.map +0 -7
- package/dist/navigation/helpers/get-tag.js.map +0 -7
- package/dist/navigation/helpers/get-x-keys.js.map +0 -7
- package/dist/navigation/helpers/traverse-description.js.map +0 -7
- package/dist/navigation/helpers/traverse-document.js.map +0 -7
- package/dist/navigation/helpers/traverse-examples.js.map +0 -7
- package/dist/navigation/helpers/traverse-paths.js.map +0 -7
- package/dist/navigation/helpers/traverse-schemas.js.map +0 -7
- package/dist/navigation/helpers/traverse-tags.js.map +0 -7
- package/dist/navigation/helpers/traverse-webhooks.js.map +0 -7
- package/dist/navigation/helpers/update-order-ids.js.map +0 -7
- package/dist/navigation/helpers/utils.js.map +0 -7
- package/dist/navigation/index.js.map +0 -7
- package/dist/navigation/types.js.map +0 -7
- package/dist/persistence/index.js.map +0 -7
- package/dist/persistence/indexdb.js.map +0 -7
- package/dist/plugins/bundler/helpers.js.map +0 -7
- package/dist/plugins/bundler/index.js.map +0 -7
- package/dist/plugins/client/index.js.map +0 -7
- package/dist/plugins/client/persistence.js.map +0 -7
- package/dist/resolve.js.map +0 -7
- package/dist/schemas/compose.js.map +0 -7
- package/dist/schemas/extensions/document/x-internal.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-environments.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-icon.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-ignore.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-is-dirty.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-original-document-hash.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-registry-meta.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-sdk-installation.js.map +0 -7
- package/dist/schemas/extensions/document/x-scalar-watch-mode.js.map +0 -7
- package/dist/schemas/extensions/document/x-tags.js.map +0 -7
- package/dist/schemas/extensions/example/x-disabled.js.map +0 -7
- package/dist/schemas/extensions/general/x-scalar-active-environment.js.map +0 -7
- package/dist/schemas/extensions/general/x-scalar-cookies.js.map +0 -7
- package/dist/schemas/extensions/general/x-scalar-order.js.map +0 -7
- package/dist/schemas/extensions/operation/index.js.map +0 -7
- package/dist/schemas/extensions/operation/x-badge.js.map +0 -7
- package/dist/schemas/extensions/operation/x-code-samples.js.map +0 -7
- package/dist/schemas/extensions/operation/x-draft-examples.js.map +0 -7
- package/dist/schemas/extensions/operation/x-post-response.js.map +0 -7
- package/dist/schemas/extensions/operation/x-scalar-disable-parameters.js.map +0 -7
- package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js.map +0 -7
- package/dist/schemas/extensions/operation/x-scalar-stability.js.map +0 -7
- package/dist/schemas/extensions/parameter/x-global.js.map +0 -7
- package/dist/schemas/extensions/schema/x-additional-properties-name.js.map +0 -7
- package/dist/schemas/extensions/schema/x-enum-descriptions.js.map +0 -7
- package/dist/schemas/extensions/schema/x-enum-varnames.js.map +0 -7
- package/dist/schemas/extensions/schema/x-examples.js.map +0 -7
- package/dist/schemas/extensions/schema/x-variable.js.map +0 -7
- package/dist/schemas/extensions/security/index.js.map +0 -7
- package/dist/schemas/extensions/security/x-default-scopes.js.map +0 -7
- package/dist/schemas/extensions/security/x-scalar-credentials-location.js.map +0 -7
- package/dist/schemas/extensions/security/x-scalar-security-body.js.map +0 -7
- package/dist/schemas/extensions/security/x-scalar-security-query.js.map +0 -7
- package/dist/schemas/extensions/security/x-scalar-security-secrets.js.map +0 -7
- package/dist/schemas/extensions/security/x-tokenName.js.map +0 -7
- package/dist/schemas/extensions/security/x-use-pkce.js.map +0 -7
- package/dist/schemas/extensions/server/x-scalar-selected-server.js.map +0 -7
- package/dist/schemas/extensions/tag/index.js.map +0 -7
- package/dist/schemas/extensions/tag/x-display-name.js.map +0 -7
- package/dist/schemas/extensions/tag/x-tag-groups.js.map +0 -7
- package/dist/schemas/extensions/workspace/index.js.map +0 -7
- package/dist/schemas/extensions/workspace/x-scalar-active-proxy.js.map +0 -7
- package/dist/schemas/extensions/workspace/x-scalar-tabs.js.map +0 -7
- package/dist/schemas/extensions.js.map +0 -7
- package/dist/schemas/inmemory-workspace.js.map +0 -7
- package/dist/schemas/navigation.js.map +0 -7
- package/dist/schemas/reference-config/appearance.js.map +0 -7
- package/dist/schemas/reference-config/features.js.map +0 -7
- package/dist/schemas/reference-config/index.js.map +0 -7
- package/dist/schemas/reference-config/meta.js.map +0 -7
- package/dist/schemas/reference-config/routing.js.map +0 -7
- package/dist/schemas/reference-config/settings.js.map +0 -7
- package/dist/schemas/typebox-coerce.js.map +0 -7
- package/dist/schemas/v3.1/strict/callback.js.map +0 -7
- package/dist/schemas/v3.1/strict/components.js.map +0 -7
- package/dist/schemas/v3.1/strict/contact.js.map +0 -7
- package/dist/schemas/v3.1/strict/discriminator.js.map +0 -7
- package/dist/schemas/v3.1/strict/encoding.js.map +0 -7
- package/dist/schemas/v3.1/strict/example.js.map +0 -7
- package/dist/schemas/v3.1/strict/external-documentation.js.map +0 -7
- package/dist/schemas/v3.1/strict/header.js.map +0 -7
- package/dist/schemas/v3.1/strict/info.js.map +0 -7
- package/dist/schemas/v3.1/strict/license.js.map +0 -7
- package/dist/schemas/v3.1/strict/link.js.map +0 -7
- package/dist/schemas/v3.1/strict/media-type.js.map +0 -7
- package/dist/schemas/v3.1/strict/oauth-flow.js.map +0 -7
- package/dist/schemas/v3.1/strict/oauthflows.js.map +0 -7
- package/dist/schemas/v3.1/strict/openapi-document.js.map +0 -7
- package/dist/schemas/v3.1/strict/operation.js.map +0 -7
- package/dist/schemas/v3.1/strict/parameter.js.map +0 -7
- package/dist/schemas/v3.1/strict/path-item.js.map +0 -7
- package/dist/schemas/v3.1/strict/paths.js.map +0 -7
- package/dist/schemas/v3.1/strict/ref-definitions.js.map +0 -7
- package/dist/schemas/v3.1/strict/reference.js.map +0 -7
- package/dist/schemas/v3.1/strict/request-body.js.map +0 -7
- package/dist/schemas/v3.1/strict/response.js.map +0 -7
- package/dist/schemas/v3.1/strict/responses.js.map +0 -7
- package/dist/schemas/v3.1/strict/schema.js.map +0 -7
- package/dist/schemas/v3.1/strict/security-requirement.js.map +0 -7
- package/dist/schemas/v3.1/strict/security-scheme.js.map +0 -7
- package/dist/schemas/v3.1/strict/server-variable.js.map +0 -7
- package/dist/schemas/v3.1/strict/server.js.map +0 -7
- package/dist/schemas/v3.1/strict/tag.js.map +0 -7
- package/dist/schemas/v3.1/strict/type-guards.js.map +0 -7
- package/dist/schemas/v3.1/strict/xml.js.map +0 -7
- package/dist/schemas/workspace-specification/index.js.map +0 -7
- package/dist/schemas/workspace-specification/info.js.map +0 -7
- package/dist/schemas/workspace.js.map +0 -7
- package/dist/schemas.js.map +0 -7
- package/dist/server.js.map +0 -7
- package/dist/workspace-plugin.js.map +0 -7
|
@@ -1,172 +1,164 @@
|
|
|
1
|
-
import { Type } from
|
|
2
|
-
import { compose } from
|
|
3
|
-
import { XInternalSchema } from
|
|
4
|
-
import { XScalarIgnoreSchema } from
|
|
5
|
-
import { XTags } from
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
} from
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
DiscriminatorObjectRef,
|
|
15
|
-
ExternalDocumentationObjectRef,
|
|
16
|
-
SchemaObjectRef,
|
|
17
|
-
XMLObjectRef
|
|
18
|
-
} from "./ref-definitions.js";
|
|
19
|
-
import { ReferenceObjectSchema } from "./reference.js";
|
|
1
|
+
import { Type } from '@scalar/typebox';
|
|
2
|
+
import { compose } from '../../../schemas/compose.js';
|
|
3
|
+
import { XInternalSchema } from '../../../schemas/extensions/document/x-internal.js';
|
|
4
|
+
import { XScalarIgnoreSchema } from '../../../schemas/extensions/document/x-scalar-ignore.js';
|
|
5
|
+
import { XTags } from '../../../schemas/extensions/document/x-tags.js';
|
|
6
|
+
import { XAdditionalPropertiesNameSchema, } from '../../../schemas/extensions/schema/x-additional-properties-name.js';
|
|
7
|
+
import { XEnumDescriptionsSchema } from '../../../schemas/extensions/schema/x-enum-descriptions.js';
|
|
8
|
+
import { XEnumVarNamesSchema } from '../../../schemas/extensions/schema/x-enum-varnames.js';
|
|
9
|
+
import { XExamplesSchema } from '../../../schemas/extensions/schema/x-examples.js';
|
|
10
|
+
import { XVariableSchema } from '../../../schemas/extensions/schema/x-variable.js';
|
|
11
|
+
import { DiscriminatorObjectRef, ExternalDocumentationObjectRef, SchemaObjectRef, XMLObjectRef, } from './ref-definitions.js';
|
|
12
|
+
import { ReferenceObjectSchema } from './reference.js';
|
|
20
13
|
const schemaOrReference = Type.Union([
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
SchemaObjectRef,
|
|
15
|
+
compose(ReferenceObjectSchema, Type.Object({ '$ref-value': Type.Unknown() })),
|
|
23
16
|
]);
|
|
17
|
+
/**
|
|
18
|
+
* Primitive types that don't have additional validation properties.
|
|
19
|
+
* These types (null, boolean, string, number, integer, object, array) can be used
|
|
20
|
+
* without additional validation constraints.
|
|
21
|
+
*
|
|
22
|
+
* TODO: Type array will actually validate against every union type but we can cross that bridge when we come to it
|
|
23
|
+
*/
|
|
24
24
|
const OtherTypes = Type.Object({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
)
|
|
39
|
-
])
|
|
25
|
+
type: Type.Union([
|
|
26
|
+
Type.Literal('null'),
|
|
27
|
+
Type.Literal('boolean'),
|
|
28
|
+
Type.Array(Type.Union([
|
|
29
|
+
Type.Literal('null'),
|
|
30
|
+
Type.Literal('boolean'),
|
|
31
|
+
Type.Literal('string'),
|
|
32
|
+
Type.Literal('number'),
|
|
33
|
+
Type.Literal('integer'),
|
|
34
|
+
Type.Literal('object'),
|
|
35
|
+
Type.Literal('array'),
|
|
36
|
+
])),
|
|
37
|
+
]),
|
|
40
38
|
});
|
|
41
|
-
const Extensions = compose(
|
|
42
|
-
XScalarIgnoreSchema,
|
|
43
|
-
XInternalSchema,
|
|
44
|
-
XVariableSchema,
|
|
45
|
-
XExamplesSchema,
|
|
46
|
-
XEnumDescriptionsSchema,
|
|
47
|
-
XEnumVarNamesSchema,
|
|
48
|
-
XAdditionalPropertiesNameSchema,
|
|
49
|
-
XTags
|
|
50
|
-
);
|
|
39
|
+
const Extensions = compose(XScalarIgnoreSchema, XInternalSchema, XVariableSchema, XExamplesSchema, XEnumDescriptionsSchema, XEnumVarNamesSchema, XAdditionalPropertiesNameSchema, XTags);
|
|
51
40
|
const CorePropertiesWithSchema = Type.Object({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
41
|
+
name: Type.Optional(Type.String()),
|
|
42
|
+
/** A title for the schema. */
|
|
43
|
+
title: Type.Optional(Type.String()),
|
|
44
|
+
/** A description of the schema. */
|
|
45
|
+
description: Type.Optional(Type.String()),
|
|
46
|
+
/** Default value for the schema. */
|
|
47
|
+
default: Type.Optional(Type.Unknown()),
|
|
48
|
+
/** Array of allowed values. */
|
|
49
|
+
enum: Type.Optional(Type.Array(Type.Unknown())),
|
|
50
|
+
/** Constant value that must match exactly. */
|
|
51
|
+
const: Type.Optional(Type.Unknown()),
|
|
52
|
+
/** Media type for content validation. */
|
|
53
|
+
contentMediaType: Type.Optional(Type.String()),
|
|
54
|
+
/** Content encoding. */
|
|
55
|
+
contentEncoding: Type.Optional(Type.String()),
|
|
56
|
+
/** Schema for content validation. */
|
|
57
|
+
contentSchema: Type.Optional(schemaOrReference),
|
|
58
|
+
/** Whether the schema is deprecated. */
|
|
59
|
+
deprecated: Type.Optional(Type.Boolean()),
|
|
60
|
+
/** Adds support for polymorphism. The discriminator is used to determine which of a set of schemas a payload is expected to satisfy. See Composition and Inheritance for more details. */
|
|
61
|
+
discriminator: Type.Optional(DiscriminatorObjectRef),
|
|
62
|
+
/** Whether the schema is read-only. */
|
|
63
|
+
readOnly: Type.Optional(Type.Boolean()),
|
|
64
|
+
/** Whether the schema is write-only. */
|
|
65
|
+
writeOnly: Type.Optional(Type.Boolean()),
|
|
66
|
+
/** This MAY be used only on property schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property. */
|
|
67
|
+
xml: Type.Optional(XMLObjectRef),
|
|
68
|
+
/** Additional external documentation for this schema. */
|
|
69
|
+
externalDocs: Type.Optional(ExternalDocumentationObjectRef),
|
|
70
|
+
/**
|
|
71
|
+
* A free-form field to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary.
|
|
72
|
+
*
|
|
73
|
+
* @deprecated The example field has been deprecated in favor of the JSON Schema examples keyword. Use of example is discouraged, and later versions of this specification may remove it.
|
|
74
|
+
*/
|
|
75
|
+
example: Type.Optional(Type.Unknown()),
|
|
76
|
+
/**
|
|
77
|
+
* An array of examples of valid instances for this schema. This keyword follows the JSON Schema Draft 2020-12 specification.
|
|
78
|
+
* Each example should be a valid instance of the schema.
|
|
79
|
+
*/
|
|
80
|
+
examples: Type.Optional(Type.Array(Type.Unknown())),
|
|
81
|
+
/** All schemas must be valid. */
|
|
82
|
+
allOf: Type.Optional(Type.Array(schemaOrReference)),
|
|
83
|
+
/** Exactly one schema must be valid. */
|
|
84
|
+
oneOf: Type.Optional(Type.Array(schemaOrReference)),
|
|
85
|
+
/** At least one schema must be valid. */
|
|
86
|
+
anyOf: Type.Optional(Type.Array(schemaOrReference)),
|
|
87
|
+
/** Schema must not be valid. */
|
|
88
|
+
not: Type.Optional(schemaOrReference),
|
|
100
89
|
});
|
|
90
|
+
/**
|
|
91
|
+
* Numeric validation properties for number and integer types.
|
|
92
|
+
*/
|
|
101
93
|
const NumericProperties = Type.Object({
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
94
|
+
type: Type.Union([Type.Literal('number'), Type.Literal('integer')]),
|
|
95
|
+
/** Different subtypes */
|
|
96
|
+
format: Type.Optional(Type.String()),
|
|
97
|
+
/** Number must be a multiple of this value. */
|
|
98
|
+
multipleOf: Type.Optional(Type.Number()),
|
|
99
|
+
/** Maximum value (inclusive). */
|
|
100
|
+
maximum: Type.Optional(Type.Number()),
|
|
101
|
+
/** Maximum value (exclusive). */
|
|
102
|
+
exclusiveMaximum: Type.Optional(Type.Number({ minimum: 0 })),
|
|
103
|
+
/** Minimum value (inclusive). */
|
|
104
|
+
minimum: Type.Optional(Type.Number()),
|
|
105
|
+
/** Minimum value (exclusive). */
|
|
106
|
+
exclusiveMinimum: Type.Optional(Type.Number({ minimum: 0 })),
|
|
115
107
|
});
|
|
108
|
+
/**
|
|
109
|
+
* String validation properties for string types.
|
|
110
|
+
*/
|
|
116
111
|
const StringValidationProperties = Type.Object({
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
112
|
+
type: Type.Literal('string'),
|
|
113
|
+
/** Different subtypes - allow any arbitrary string, this negates the purpose of having a union of formats so we type it in typescript instead */
|
|
114
|
+
format: Type.Optional(Type.String()),
|
|
115
|
+
/** Maximum string length. */
|
|
116
|
+
maxLength: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
117
|
+
/** Minimum string length. */
|
|
118
|
+
minLength: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
119
|
+
/** Regular expression pattern. */
|
|
120
|
+
pattern: Type.Optional(Type.String()),
|
|
126
121
|
});
|
|
127
122
|
const ArrayValidationPropertiesWithSchema = Type.Object({
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
123
|
+
type: Type.Literal('array'),
|
|
124
|
+
/** Maximum number of items in array. */
|
|
125
|
+
maxItems: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
126
|
+
/** Minimum number of items in array. */
|
|
127
|
+
minItems: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
128
|
+
/** Whether array items must be unique. */
|
|
129
|
+
uniqueItems: Type.Optional(Type.Boolean()),
|
|
130
|
+
/** Schema for array items. */
|
|
131
|
+
items: Type.Optional(schemaOrReference),
|
|
132
|
+
/** Schema for tuple validation. */
|
|
133
|
+
prefixItems: Type.Optional(Type.Array(schemaOrReference)),
|
|
139
134
|
});
|
|
140
135
|
const ObjectValidationPropertiesWithSchema = Type.Object({
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
136
|
+
type: Type.Literal('object'),
|
|
137
|
+
/** Maximum number of properties. */
|
|
138
|
+
maxProperties: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
139
|
+
/** Minimum number of properties. */
|
|
140
|
+
minProperties: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
141
|
+
/** Array of required property names. */
|
|
142
|
+
required: Type.Optional(Type.Array(Type.String())),
|
|
143
|
+
/** Object property definitions. */
|
|
144
|
+
properties: Type.Optional(Type.Record(Type.String(), schemaOrReference)),
|
|
145
|
+
/** Schema for additional properties. */
|
|
146
|
+
additionalProperties: Type.Optional(Type.Union([Type.Boolean(), schemaOrReference])),
|
|
147
|
+
/** Properties matching regex patterns. */
|
|
148
|
+
patternProperties: Type.Optional(Type.Record(Type.String(), schemaOrReference)),
|
|
149
|
+
/** Constraints on property names (JSON Schema propertyNames keyword). */
|
|
150
|
+
propertyNames: Type.Optional(schemaOrReference),
|
|
156
151
|
});
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
152
|
+
/** Builds the recursive schema schema */
|
|
153
|
+
export const SchemaObjectSchemaDefinition = Type.Union([
|
|
154
|
+
// Keep compositions first so they get priority when union is evaluated
|
|
155
|
+
// Make sure there is always a required field so not all properties are optional
|
|
156
|
+
// When all properties are optional (1) typescript will not throw any warnings/error and accepts anything
|
|
157
|
+
// even a non resolved ref and (2) it will match any schema so it will not validate the refs correctly
|
|
158
|
+
compose(Type.Object({ __scalar_: Type.String() }), CorePropertiesWithSchema, Extensions),
|
|
159
|
+
compose(OtherTypes, CorePropertiesWithSchema, Extensions),
|
|
160
|
+
compose(NumericProperties, CorePropertiesWithSchema, Extensions),
|
|
161
|
+
compose(StringValidationProperties, CorePropertiesWithSchema, Extensions),
|
|
162
|
+
compose(ObjectValidationPropertiesWithSchema, CorePropertiesWithSchema, Extensions),
|
|
163
|
+
compose(ArrayValidationPropertiesWithSchema, CorePropertiesWithSchema, Extensions),
|
|
168
164
|
]);
|
|
169
|
-
export {
|
|
170
|
-
SchemaObjectSchemaDefinition
|
|
171
|
-
};
|
|
172
|
-
//# sourceMappingURL=schema.js.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { Type } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { Type } from '@scalar/typebox';
|
|
2
|
+
/**
|
|
3
|
+
* Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.
|
|
4
|
+
*
|
|
5
|
+
* A Security Requirement Object MAY refer to multiple security schemes in which case all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.
|
|
6
|
+
*
|
|
7
|
+
* When the security field is defined on the OpenAPI Object or Operation Object and contains multiple Security Requirement Objects, only one of the entries in the list needs to be satisfied to authorize the request. This enables support for scenarios where the API allows multiple, independent security schemes.
|
|
8
|
+
*
|
|
9
|
+
* An empty Security Requirement Object ({}) indicates anonymous access is supported.
|
|
10
|
+
*/
|
|
11
|
+
export const SecurityRequirementObjectSchemaDefinition = Type.Partial(Type.Record(
|
|
12
|
+
/** Each name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object. If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution, and the list MAY be empty if authorization does not require a specified scope. For other security scheme types, the array MAY contain a list of role names which are required for the execution, but are not otherwise defined or exchanged in-band. */
|
|
13
|
+
Type.String(), Type.Array(Type.String())));
|
|
@@ -1,54 +1,42 @@
|
|
|
1
|
-
import { Type } from
|
|
2
|
-
import { compose } from
|
|
3
|
-
import { XDefaultScopesSchema } from
|
|
4
|
-
import { OAuthFlowsObjectRef } from
|
|
1
|
+
import { Type } from '@scalar/typebox';
|
|
2
|
+
import { compose } from '../../../schemas/compose.js';
|
|
3
|
+
import { XDefaultScopesSchema } from '../../../schemas/extensions/security/x-default-scopes.js';
|
|
4
|
+
import { OAuthFlowsObjectRef } from '../../../schemas/v3.1/strict/ref-definitions.js';
|
|
5
5
|
const DescriptionSchema = Type.Object({
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
/** A description for security scheme. CommonMark syntax MAY be used for rich text representation. */
|
|
7
|
+
description: Type.Optional(Type.String()),
|
|
8
8
|
});
|
|
9
|
-
const ApiKeySchema = compose(
|
|
10
|
-
DescriptionSchema,
|
|
11
|
-
Type.Object({
|
|
9
|
+
const ApiKeySchema = compose(DescriptionSchema, Type.Object({
|
|
12
10
|
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
13
|
-
type: Type.Literal(
|
|
11
|
+
type: Type.Literal('apiKey'),
|
|
14
12
|
/** REQUIRED. The name of the header, query or cookie parameter to be used. */
|
|
15
13
|
name: Type.String(),
|
|
16
14
|
/** REQUIRED. The location of the API key. Valid values are "query", "header", or "cookie". */
|
|
17
|
-
in: Type.Union([Type.Literal(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const HttpSchema = compose(
|
|
21
|
-
DescriptionSchema,
|
|
22
|
-
Type.Object({
|
|
15
|
+
in: Type.Union([Type.Literal('query'), Type.Literal('header'), Type.Literal('cookie')]),
|
|
16
|
+
}));
|
|
17
|
+
const HttpSchema = compose(DescriptionSchema, Type.Object({
|
|
23
18
|
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
24
|
-
type: Type.Literal(
|
|
19
|
+
type: Type.Literal('http'),
|
|
25
20
|
/** REQUIRED. The name of the HTTP Authentication scheme to be used in the Authorization header as defined in RFC7235. The values used SHOULD be registered in the IANA Authentication Scheme registry. The value is case-insensitive, as defined in RFC7235. */
|
|
26
|
-
scheme: Type.Union([Type.Literal(
|
|
21
|
+
scheme: Type.Union([Type.Literal('basic'), Type.Literal('bearer')]),
|
|
27
22
|
/** A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. */
|
|
28
|
-
bearerFormat: Type.Optional(Type.String())
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const OAuth2 = compose(
|
|
32
|
-
DescriptionSchema,
|
|
33
|
-
Type.Object({
|
|
23
|
+
bearerFormat: Type.Optional(Type.String()),
|
|
24
|
+
}));
|
|
25
|
+
const OAuth2 = compose(DescriptionSchema, Type.Object({
|
|
34
26
|
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
35
|
-
type: Type.Literal(
|
|
27
|
+
type: Type.Literal('oauth2'),
|
|
36
28
|
/** REQUIRED. An object containing configuration information for the flow types supported. */
|
|
37
|
-
flows: OAuthFlowsObjectRef
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
);
|
|
41
|
-
const OpenIdConnect = compose(
|
|
42
|
-
DescriptionSchema,
|
|
43
|
-
Type.Object({
|
|
29
|
+
flows: OAuthFlowsObjectRef,
|
|
30
|
+
}), XDefaultScopesSchema);
|
|
31
|
+
const OpenIdConnect = compose(DescriptionSchema, Type.Object({
|
|
44
32
|
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
45
|
-
type: Type.Literal(
|
|
33
|
+
type: Type.Literal('openIdConnect'),
|
|
46
34
|
/** REQUIRED. Well-known URL to discover the [[OpenID-Connect-Discovery]] provider metadata. */
|
|
47
|
-
openIdConnectUrl: Type.String()
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
35
|
+
openIdConnectUrl: Type.String(),
|
|
36
|
+
}));
|
|
37
|
+
/**
|
|
38
|
+
* Defines a security scheme that can be used by the operations.
|
|
39
|
+
*
|
|
40
|
+
* Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, client credentials and authorization code) as defined in RFC6749, and [[OpenID-Connect-Core]]. Please note that as of 2020, the implicit flow is about to be deprecated by OAuth 2.0 Security Best Current Practice. Recommended for most use cases is Authorization Code Grant flow with PKCE.
|
|
41
|
+
*/
|
|
42
|
+
export const SecuritySchemeObjectSchemaDefinition = Type.Union([ApiKeySchema, HttpSchema, OAuth2, OpenIdConnect]);
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { Type } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { Type } from '@scalar/typebox';
|
|
2
|
+
/** An object representing a Server Variable for server URL template substitution. */
|
|
3
|
+
export const ServerVariableObjectSchemaDefinition = Type.Object({
|
|
4
|
+
/** An enumeration of string values to be used if the substitution options are from a limited set. The array MUST NOT be empty. */
|
|
5
|
+
enum: Type.Optional(Type.Array(Type.String())),
|
|
6
|
+
/** REQUIRED. The default value to use for substitution, which SHALL be sent if an alternate value is not supplied. If the enum is defined, the value MUST exist in the enum's values. Note that this behavior is different from the Schema Object's default keyword, which documents the receiver's behavior rather than inserting the value into the data. */
|
|
7
|
+
default: Type.Optional(Type.String()),
|
|
8
|
+
/** An optional description for the server variable. CommonMark syntax MAY be used for rich text representation. */
|
|
9
|
+
description: Type.Optional(Type.String()),
|
|
9
10
|
});
|
|
10
|
-
export {
|
|
11
|
-
ServerVariableObjectSchemaDefinition
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=server-variable.js.map
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { Type } from
|
|
2
|
-
import { ServerVariableObjectRef } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { Type } from '@scalar/typebox';
|
|
2
|
+
import { ServerVariableObjectRef } from './ref-definitions.js';
|
|
3
|
+
/** An object representing a Server. */
|
|
4
|
+
export const ServerObjectSchemaDefinition = Type.Object({
|
|
5
|
+
/** REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the document containing the Server Object is being served. Variable substitutions will be made when a variable is named in {braces}. */
|
|
6
|
+
url: Type.String(),
|
|
7
|
+
/** An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation. */
|
|
8
|
+
description: Type.Optional(Type.String()),
|
|
9
|
+
/** A map between a variable name and its value. The value is used for substitution in the server's URL template. */
|
|
10
|
+
variables: Type.Optional(Type.Record(Type.String(), ServerVariableObjectRef)),
|
|
10
11
|
});
|
|
11
|
-
export {
|
|
12
|
-
ServerObjectSchemaDefinition
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
import { Type } from
|
|
2
|
-
import { compose } from
|
|
3
|
-
import { XInternalSchema } from
|
|
4
|
-
import { XScalarIgnoreSchema } from
|
|
5
|
-
import { XScalarOrderSchema } from
|
|
6
|
-
import { XDisplayNameSchema } from
|
|
7
|
-
import { ExternalDocumentationObjectRef } from
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { Type } from '@scalar/typebox';
|
|
2
|
+
import { compose } from '../../../schemas/compose.js';
|
|
3
|
+
import { XInternalSchema } from '../../../schemas/extensions/document/x-internal.js';
|
|
4
|
+
import { XScalarIgnoreSchema } from '../../../schemas/extensions/document/x-scalar-ignore.js';
|
|
5
|
+
import { XScalarOrderSchema } from '../../../schemas/extensions/general/x-scalar-order.js';
|
|
6
|
+
import { XDisplayNameSchema } from '../../../schemas/extensions/tag/x-display-name.js';
|
|
7
|
+
import { ExternalDocumentationObjectRef } from './ref-definitions.js';
|
|
8
|
+
/** Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances. */
|
|
9
|
+
export const TagObjectSchemaDefinition = compose(Type.Object({
|
|
10
10
|
/** REQUIRED. The name of the tag. */
|
|
11
11
|
name: Type.String(),
|
|
12
12
|
/** A description for the tag. CommonMark syntax MAY be used for rich text representation. */
|
|
13
13
|
description: Type.Optional(Type.String()),
|
|
14
14
|
/** Additional external documentation for this tag. */
|
|
15
|
-
externalDocs: Type.Optional(ExternalDocumentationObjectRef)
|
|
16
|
-
|
|
17
|
-
XDisplayNameSchema,
|
|
18
|
-
XInternalSchema,
|
|
19
|
-
XScalarIgnoreSchema,
|
|
20
|
-
XScalarOrderSchema
|
|
21
|
-
);
|
|
22
|
-
export {
|
|
23
|
-
TagObjectSchemaDefinition
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=tag.js.map
|
|
15
|
+
externalDocs: Type.Optional(ExternalDocumentationObjectRef),
|
|
16
|
+
}), XDisplayNameSchema, XInternalSchema, XScalarIgnoreSchema, XScalarOrderSchema);
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const isObjectSchema = (schema) => {
|
|
2
|
-
|
|
1
|
+
export const isObjectSchema = (schema) => {
|
|
2
|
+
return ('type' in schema && (schema.type === 'object' || (Array.isArray(schema.type) && schema.type.includes('object'))));
|
|
3
3
|
};
|
|
4
|
-
const isArraySchema = (schema) => {
|
|
5
|
-
|
|
4
|
+
export const isArraySchema = (schema) => {
|
|
5
|
+
return 'type' in schema && (schema.type === 'array' || (Array.isArray(schema.type) && schema.type.includes('array')));
|
|
6
6
|
};
|
|
7
|
-
const isStringSchema = (schema) => {
|
|
8
|
-
|
|
7
|
+
export const isStringSchema = (schema) => {
|
|
8
|
+
return ('type' in schema && (schema.type === 'string' || (Array.isArray(schema.type) && schema.type.includes('string'))));
|
|
9
9
|
};
|
|
10
|
-
const isNumberSchema = (schema) => {
|
|
11
|
-
|
|
10
|
+
export const isNumberSchema = (schema) => {
|
|
11
|
+
return ('type' in schema &&
|
|
12
|
+
(schema.type === 'number' ||
|
|
13
|
+
schema.type === 'integer' ||
|
|
14
|
+
(Array.isArray(schema.type) && schema.type.includes('number')) ||
|
|
15
|
+
(Array.isArray(schema.type) && schema.type.includes('integer'))));
|
|
12
16
|
};
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
17
|
+
/** Special type guard to remove our internal type */
|
|
18
|
+
export const isSchema = (schema) => schema !== undefined && 'type' in schema;
|
|
19
|
+
/**
|
|
20
|
+
* Type guard to check if the given parameter is a ParameterWithContentObject,
|
|
21
|
+
* i.e., it has a 'content' property defined.
|
|
22
|
+
*/
|
|
23
|
+
export const isContentTypeParameterObject = (parameter) => {
|
|
24
|
+
return 'content' in parameter && parameter.content !== undefined;
|
|
16
25
|
};
|
|
17
|
-
export {
|
|
18
|
-
isArraySchema,
|
|
19
|
-
isContentTypeParameterObject,
|
|
20
|
-
isNumberSchema,
|
|
21
|
-
isObjectSchema,
|
|
22
|
-
isSchema,
|
|
23
|
-
isStringSchema
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=type-guards.js.map
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { Type } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { Type } from '@scalar/typebox';
|
|
2
|
+
/**
|
|
3
|
+
* A metadata object that allows for more fine-tuned XML model definitions.
|
|
4
|
+
*
|
|
5
|
+
* When using arrays, XML element names are not inferred (for singular/plural forms) and the name field SHOULD be used to add that information. See examples for expected behavior.
|
|
6
|
+
*/
|
|
7
|
+
export const XMLObjectSchemaDefinition = Type.Object({
|
|
8
|
+
/** Replaces the name of the element/attribute used for the described schema property. When defined within items, it will affect the name of the individual XML elements within the list. When defined alongside type being "array" (outside the items), it will affect the wrapping element if and only if wrapped is true. If wrapped is false, it will be ignored. */
|
|
9
|
+
name: Type.Optional(Type.String()),
|
|
10
|
+
/** The URI of the namespace definition. Value MUST be in the form of a non-relative URI. */
|
|
11
|
+
namespace: Type.Optional(Type.String()),
|
|
12
|
+
/** The prefix to be used for the name. */
|
|
13
|
+
prefix: Type.Optional(Type.String()),
|
|
14
|
+
/** Declares whether the property definition translates to an attribute instead of an element. Default value is false. */
|
|
15
|
+
attribute: Type.Optional(Type.Boolean()),
|
|
16
|
+
/** MAY be used only for an array definition. Signifies whether the array is wrapped (for example, <books><book/><book/></books>) or unwrapped (<book/><book/>). Default value is false. The definition takes effect only when defined alongside type being "array" (outside the items). */
|
|
17
|
+
wrapped: Type.Optional(Type.Boolean()),
|
|
13
18
|
});
|
|
14
|
-
export {
|
|
15
|
-
XMLObjectSchemaDefinition
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=xml.js.map
|