@scalar/schemas 0.8.3 → 0.9.0
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 +16 -0
- package/dist/api-reference/api-reference-configuration.d.ts +2 -0
- package/dist/api-reference/api-reference-configuration.d.ts.map +1 -1
- package/dist/api-reference/api-reference-configuration.js +3 -0
- package/dist/api-reference/html-rendering-configuration.d.ts +15 -2
- package/dist/api-reference/html-rendering-configuration.d.ts.map +1 -1
- package/dist/api-reference/html-rendering-configuration.js +16 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @scalar/schemas
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#9981](https://github.com/scalar/scalar/pull/9981): Load the modern ESM build of the API Reference by default
|
|
8
|
+
|
|
9
|
+
The generated HTML now loads the code-split ESM build (`.../@scalar/api-reference/esm.js`, added in #9871) as a `<script type="module">` by default, instead of the monolithic UMD bundle. Because it is code-split, less JavaScript blocks the first render.
|
|
10
|
+
|
|
11
|
+
To keep the classic UMD bundle (loaded via `<script src>` and the `window.Scalar` global), set `cdn` to a UMD URL — for example to pin a version — or pass `bundle: false`. You can also pass `bundle: 'https://.../esm.js'` to load a specific ESM build.
|
|
12
|
+
|
|
13
|
+
When a `nonce` is set (a strict, nonce-based CSP) the UMD bundle is used automatically, because the ESM build's `import`-loaded chunks cannot be nonced. Pass `bundle: true` to force the ESM build if your CSP uses `'strict-dynamic'`.
|
|
14
|
+
|
|
15
|
+
- [#9937](https://github.com/scalar/scalar/pull/9937): Add a way to open the request body editor in the Form view by default. Set the `defaultRequestBodyView: 'form'` config option, or the `x-scalar-default-request-body-view` extension in your OpenAPI document (which also works per source). Defaults to `raw`, and falls back to `raw` when a body cannot be shown as a form.
|
|
16
|
+
|
|
17
|
+
## 0.8.4
|
|
18
|
+
|
|
3
19
|
## 0.8.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -109,6 +109,7 @@ export declare const apiReferenceConfigurationSchema: import("@scalar/validation
|
|
|
109
109
|
targetKey: LiteralSchema<TargetId>;
|
|
110
110
|
clientKey: LiteralSchema<ClientId<TargetId>>;
|
|
111
111
|
}>>;
|
|
112
|
+
defaultRequestBodyView: import("@scalar/validation").OptionalSchema<import("@scalar/validation").UnionSchema<readonly [LiteralSchema<"form">, LiteralSchema<"raw">]>>;
|
|
112
113
|
customCss: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
|
|
113
114
|
onServerChange: import("@scalar/validation").OptionalSchema<import("@scalar/validation").FunctionSchema<(input: string) => void>>;
|
|
114
115
|
onDocumentSelect: import("@scalar/validation").OptionalSchema<import("@scalar/validation").FunctionSchema<() => void>>;
|
|
@@ -291,6 +292,7 @@ export declare const apiReferenceConfigurationWithSourceSchema: (rawInput: unkno
|
|
|
291
292
|
targetKey: "c" | "r" | "go" | "rust" | "clojure" | "csharp" | "dart" | "fsharp" | "http" | "java" | "js" | "julia" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "ruby" | "shell" | "swift";
|
|
292
293
|
clientKey: "laravel" | "fetch" | "http" | "libcurl" | "httr2" | "native" | "reqwest" | "clj_http" | "httpclient" | "restsharp" | "http1.1" | "asynchttp" | "nethttp" | "okhttp" | "unirest" | "axios" | "jquery" | "ofetch" | "xhr" | "undici" | "nsurlsession" | "cohttp" | "curl" | "guzzle" | "restmethod" | "webrequest" | "python3" | "requests" | "aiohttp" | "httpx_sync" | "httpx_async" | "httpie" | "wget";
|
|
293
294
|
} | undefined;
|
|
295
|
+
defaultRequestBodyView?: "form" | "raw" | undefined;
|
|
294
296
|
customCss?: string | undefined;
|
|
295
297
|
onServerChange?: ((input: string) => void) | undefined;
|
|
296
298
|
onDocumentSelect?: (() => void) | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-reference-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/api-reference-configuration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjF,OAAO,EACL,KAAK,aAAa,EAanB,MAAM,oBAAoB,CAAA;AAO3B,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA2GF,aAAa,CAAC,QAAQ,CAAC;mBACvB,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"api-reference-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/api-reference-configuration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjF,OAAO,EACL,KAAK,aAAa,EAanB,MAAM,oBAAoB,CAAA;AAO3B,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA2GF,aAAa,CAAC,QAAQ,CAAC;mBACvB,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;;;;oHAYnC,MAAM,KAAK,IAAI;oHAGf,IAAI;6GAGX,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;qHAKhD;QACN,OAAO,EAAE,OAAO,CAAA;QAChB,cAAc,EAAE,OAAO,CAAA;QACvB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KACrC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;oHASlB;QACN,OAAO,EAAE,OAAO,CAAA;QAChB,cAAc,E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G,CAAA"}
|
|
@@ -101,6 +101,9 @@ export const apiReferenceConfigurationSchema = intersection([
|
|
|
101
101
|
}), {
|
|
102
102
|
typeComment: 'Determine the HTTP client that is selected by default',
|
|
103
103
|
}),
|
|
104
|
+
defaultRequestBodyView: optional(union([literal('form'), literal('raw')]), {
|
|
105
|
+
typeComment: 'Initial view for the request body editor with structured (JSON/YAML) bodies',
|
|
106
|
+
}),
|
|
104
107
|
customCss: optional(string(), {
|
|
105
108
|
typeComment: 'Custom CSS to be added to the page',
|
|
106
109
|
}),
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
export declare const htmlRenderingConfigurationSchema: import("@scalar/validation").ObjectSchema<{
|
|
2
2
|
/**
|
|
3
|
-
* The URL to the Scalar API Reference
|
|
3
|
+
* The URL to the Scalar API Reference UMD bundle (the classic build that registers `window.Scalar`
|
|
4
|
+
* and is loaded via `<script src>`).
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
+
* Setting it selects the UMD build instead of the default ESM build — use it to pin a specific
|
|
7
|
+
* version of the classic bundle.
|
|
6
8
|
*
|
|
7
9
|
* @default https://cdn.jsdelivr.net/npm/@scalar/api-reference
|
|
8
10
|
*
|
|
9
11
|
* @example https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.122
|
|
10
12
|
*/
|
|
11
13
|
cdn: import("@scalar/validation").StringSchema;
|
|
14
|
+
/**
|
|
15
|
+
* Which build to load. The modern, code-split ESM build is the default.
|
|
16
|
+
*
|
|
17
|
+
* Pass a URL string to load a specific ESM build, or `false` to fall back to the classic UMD bundle.
|
|
18
|
+
* When set, `bundle` takes precedence over both `cdn` and the `nonce` fallback.
|
|
19
|
+
*
|
|
20
|
+
* When a `nonce` is set (a strict, nonce-based CSP) the UMD bundle is used by default, because the
|
|
21
|
+
* ESM build's `import`-loaded chunks cannot be nonced. Pass `bundle: true` to force the ESM build if
|
|
22
|
+
* your CSP uses `'strict-dynamic'`.
|
|
23
|
+
*/
|
|
24
|
+
bundle: import("@scalar/validation").OptionalSchema<import("@scalar/validation").UnionSchema<readonly [import("@scalar/validation").StringSchema, import("@scalar/validation").BooleanSchema]>>;
|
|
12
25
|
pageTitle: import("@scalar/validation").StringSchema;
|
|
13
26
|
/**
|
|
14
27
|
* A Content Security Policy (CSP) nonce to apply to the generated inline `<script>` and `<style>`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-rendering-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/html-rendering-configuration.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gCAAgC;IAC3C
|
|
1
|
+
{"version":3,"file":"html-rendering-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/html-rendering-configuration.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gCAAgC;IAC3C;;;;;;;;;;OAUG;;IAIH;;;;;;;;;OASG;;;IAKH;;;;;OAKG;;EAEH,CAAA"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { object, optional, string } from '@scalar/validation';
|
|
1
|
+
import { boolean, object, optional, string, union } from '@scalar/validation';
|
|
2
2
|
export const htmlRenderingConfigurationSchema = object({
|
|
3
3
|
/**
|
|
4
|
-
* The URL to the Scalar API Reference
|
|
4
|
+
* The URL to the Scalar API Reference UMD bundle (the classic build that registers `window.Scalar`
|
|
5
|
+
* and is loaded via `<script src>`).
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
+
* Setting it selects the UMD build instead of the default ESM build — use it to pin a specific
|
|
8
|
+
* version of the classic bundle.
|
|
7
9
|
*
|
|
8
10
|
* @default https://cdn.jsdelivr.net/npm/@scalar/api-reference
|
|
9
11
|
*
|
|
@@ -12,6 +14,17 @@ export const htmlRenderingConfigurationSchema = object({
|
|
|
12
14
|
cdn: string({
|
|
13
15
|
default: 'https://cdn.jsdelivr.net/npm/@scalar/api-reference',
|
|
14
16
|
}),
|
|
17
|
+
/**
|
|
18
|
+
* Which build to load. The modern, code-split ESM build is the default.
|
|
19
|
+
*
|
|
20
|
+
* Pass a URL string to load a specific ESM build, or `false` to fall back to the classic UMD bundle.
|
|
21
|
+
* When set, `bundle` takes precedence over both `cdn` and the `nonce` fallback.
|
|
22
|
+
*
|
|
23
|
+
* When a `nonce` is set (a strict, nonce-based CSP) the UMD bundle is used by default, because the
|
|
24
|
+
* ESM build's `import`-loaded chunks cannot be nonced. Pass `bundle: true` to force the ESM build if
|
|
25
|
+
* your CSP uses `'strict-dynamic'`.
|
|
26
|
+
*/
|
|
27
|
+
bundle: optional(union([string(), boolean()])),
|
|
15
28
|
pageTitle: string({
|
|
16
29
|
default: 'Scalar API Reference',
|
|
17
30
|
}),
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"schemas",
|
|
15
15
|
"scalar"
|
|
16
16
|
],
|
|
17
|
-
"version": "0.
|
|
17
|
+
"version": "0.9.0",
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">=22"
|
|
20
20
|
},
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"CHANGELOG.md"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@scalar/helpers": "0.11.
|
|
44
|
+
"@scalar/helpers": "0.11.3",
|
|
45
45
|
"@scalar/validation": "0.6.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"vitest": "4.1.10",
|
|
49
|
-
"@scalar/types": "0.
|
|
49
|
+
"@scalar/types": "0.19.0"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|