@scalar/schemas 0.6.0 → 0.7.1

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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # @scalar/schemas
2
2
 
3
+ ## 0.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#9626](https://github.com/scalar/scalar/pull/9626): Fix AsyncAPI security scheme types being lost on ingestion. When a server referenced a scheme via `$ref`, coercion synthesized a default `$ref-value` (the first `type` literal, `userPassword`) that leaked back over the real definition through the resolved-document proxy, so every scheme rendered as `userPassword`. Reference `$ref-value` is now optional, so unresolved references pass through untouched.
8
+
9
+ ## 0.7.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#9597](https://github.com/scalar/scalar/pull/9597): Add API Reference UI localization configuration with built-in English, Russian, Spanish, French, German, Simplified Chinese and Arabic translations, including automatic RTL direction for Arabic locales.
14
+
15
+ Update the shared theme reset so text inputs align to the logical start by default for RTL documents.
16
+
17
+ Add a `mergeObjects` deep-merge helper to `@scalar/helpers`, used by the localization layer to merge translation overrides onto the built-in locale.
18
+
19
+ - [#9543](https://github.com/scalar/scalar/pull/9543): Add the `x-scalar-links` OpenAPI extension to render extra named links (like a privacy policy or imprint) next to the contact, license and terms of service links in the introduction.
20
+
21
+ ### Patch Changes
22
+
23
+ - [#9577](https://github.com/scalar/scalar/pull/9577): Stop marking the per-source `title` and `slug` as deprecated. They are the supported way to name a document and its URL when using multiple `sources`, so the deprecation note (and editor strike-through) was misleading.
24
+
3
25
  ## 0.6.0
4
26
 
5
27
  ### Minor Changes
@@ -84,6 +84,11 @@ export declare const apiReferenceConfigurationSchema: import("@scalar/validation
84
84
  isEditable: import("@scalar/validation").BooleanSchema;
85
85
  hideModels: import("@scalar/validation").BooleanSchema;
86
86
  modelsSectionLabel: import("@scalar/validation").OptionalSchema<import("@scalar/validation").UnionSchema<readonly [import("@scalar/validation").LiteralSchema<"Models">, import("@scalar/validation").LiteralSchema<"Schemas">, import("@scalar/validation").StringSchema]>>;
87
+ localization: import("@scalar/validation").OptionalSchema<import("@scalar/validation").ObjectSchema<{
88
+ locale: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
89
+ direction: import("@scalar/validation").OptionalSchema<import("@scalar/validation").UnionSchema<readonly [import("@scalar/validation").LiteralSchema<"auto">, import("@scalar/validation").LiteralSchema<"ltr">, import("@scalar/validation").LiteralSchema<"rtl">]>>;
90
+ translations: import("@scalar/validation").OptionalSchema<import("@scalar/validation").RecordSchema<import("@scalar/validation").StringSchema, import("@scalar/validation").AnySchema>>;
91
+ }>>;
87
92
  documentDownloadType: import("@scalar/validation").UnionSchema<readonly [import("@scalar/validation").LiteralSchema<"both">, import("@scalar/validation").LiteralSchema<"yaml">, import("@scalar/validation").LiteralSchema<"json">, import("@scalar/validation").LiteralSchema<"direct">, import("@scalar/validation").LiteralSchema<"none">]>;
88
93
  hideDownloadButton: import("@scalar/validation").OptionalSchema<import("@scalar/validation").BooleanSchema>;
89
94
  hideTestRequestButton: import("@scalar/validation").BooleanSchema;
@@ -263,6 +268,11 @@ export declare const apiReferenceConfigurationWithSourceSchema: (rawInput: unkno
263
268
  apiClientPlugins: any[];
264
269
  })[] | undefined;
265
270
  modelsSectionLabel?: string | undefined;
271
+ localization?: {
272
+ locale?: string | undefined;
273
+ direction?: "auto" | "ltr" | "rtl" | undefined;
274
+ translations?: Record<string, any> | undefined;
275
+ } | undefined;
266
276
  hideDownloadButton?: boolean | undefined;
267
277
  darkMode?: boolean | undefined;
268
278
  forceDarkModeState?: "dark" | "light" | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"api-reference-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/api-reference-configuration.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAC,CAAA;KACrC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;0BAOE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;6BAG5B,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;;;;;;;;;mCA4BzB;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM;iCAG9B;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM;+BAG9B;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM;qCAIpD;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM;mCAKvD;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM;4BAGnD;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,KAAK,MAAM;wBAG3E,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS;gCA+Bb,GAAG,KAAK,GAAG,KAAK,MAAM;iDAGG,GAAG,KAAK,GAAG,KAAK,MAAM;CAuFvG,CAAA"}
@@ -33,6 +33,15 @@ export const apiReferenceConfigurationSchema = intersection([
33
33
  modelsSectionLabel: optional(union([literal('Models'), literal('Schemas'), string()]), {
34
34
  typeComment: 'Label for the components.schemas section in the sidebar, content, and search. Use `Schemas` for OpenAPI terminology.',
35
35
  }),
36
+ localization: optional(object({
37
+ locale: optional(string()),
38
+ // `auto` is listed first so that coerce falls back to it for invalid input,
39
+ // matching the `.catch('auto')` behavior of the Zod schema in @scalar/types.
40
+ direction: optional(union([literal('auto'), literal('ltr'), literal('rtl')])),
41
+ translations: optional(record(string(), any())),
42
+ }), {
43
+ typeComment: 'API Reference UI localization. Select a built-in locale, override labels, and control LTR/RTL rendering.',
44
+ }),
36
45
  documentDownloadType: union([literal('both'), literal('yaml'), literal('json'), literal('direct'), literal('none')], {
37
46
  typeComment: 'Sets the file type of the document to download, set to `none` to hide the download button',
38
47
  }),
@@ -22,10 +22,10 @@ export const sourceConfigurationSchema = object({
22
22
  typeComment: 'Directly embed the OpenAPI document. Can be a string, object, function returning an object, or null. It is recommended to pass a URL instead of content.',
23
23
  }),
24
24
  title: optional(string(), {
25
- typeComment: 'The title of the OpenAPI document. @deprecated Please move `title` to the top level and remove the `spec` prefix.',
25
+ typeComment: 'The title of the OpenAPI document. Used for the page title and the document name in the dropdown. With multiple `sources`, set this per source.',
26
26
  }),
27
27
  slug: optional(string(), {
28
- typeComment: 'The slug of the OpenAPI document used in the URL. @deprecated Please move `slug` to the top level and remove the `spec` prefix.',
28
+ typeComment: 'The slug of the OpenAPI document used in the URL. If none is passed, the title will be used. With multiple `sources`, set this per source.',
29
29
  }),
30
30
  spec: optional(object({
31
31
  url: optional(string()),
@@ -18,6 +18,12 @@ export declare const asyncApiReferenceObject: import("@scalar/validation").Objec
18
18
  *
19
19
  * Use when the specification allows only a Reference Object (not an inline object), for example
20
20
  * `operation.channel` or `channel.servers`.
21
+ *
22
+ * `$ref-value` is a resolved-document extension populated by the bundler/proxy at access time, so it
23
+ * is optional here. If coercion required it, an unresolved `{ $ref }` would be filled with a default
24
+ * instance of `schema` (for a security scheme, the first `type` literal — `userPassword`). Because the
25
+ * magic proxy shares one target object between a `$ref-value` and the component it points at, that
26
+ * synthetic default then leaks back over the real definition, clobbering its `type`.
21
27
  */
22
28
  export declare const asyncApiResolvedReference: (schema: Schema) => Schema;
23
29
  /** Inline object or Reference Object with resolved `$ref-value`. */
@@ -1 +1 @@
1
- {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/asyncapi/3.1/reference.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAiD,MAAM,oBAAoB,CAAA;AAI/F;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;AAElD;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;EAKnC,CAAA;AAUD;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,MAAM,KAAG,MACkD,CAAA;AAE7G,oEAAoE;AACpE,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,KAAG,MAA4D,CAAA"}
1
+ {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/asyncapi/3.1/reference.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAA2D,MAAM,oBAAoB,CAAA;AAIzG;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;AAElD;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;EAKnC,CAAA;AAUD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,MAAM,KAAG,MAC4D,CAAA;AAEvH,oEAAoE;AACpE,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,KAAG,MAA4D,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { isObject } from '@scalar/helpers/object/is-object';
2
- import { evaluate, intersection, object, string, union } from '@scalar/validation';
2
+ import { evaluate, intersection, object, optional, string, union } from '@scalar/validation';
3
3
  import { referenceExtensions } from '../../general/bundler-extensions.js';
4
4
  /**
5
5
  * AsyncAPI Reference Object (JSON Reference). Only `$ref` is defined; additional
@@ -19,7 +19,13 @@ const e = (value) => {
19
19
  *
20
20
  * Use when the specification allows only a Reference Object (not an inline object), for example
21
21
  * `operation.channel` or `channel.servers`.
22
+ *
23
+ * `$ref-value` is a resolved-document extension populated by the bundler/proxy at access time, so it
24
+ * is optional here. If coercion required it, an unresolved `{ $ref }` would be filled with a default
25
+ * instance of `schema` (for a security scheme, the first `type` literal — `userPassword`). Because the
26
+ * magic proxy shares one target object between a `$ref-value` and the component it points at, that
27
+ * synthetic default then leaks back over the real definition, clobbering its `type`.
22
28
  */
23
- export const asyncApiResolvedReference = (schema) => intersection([asyncApiReferenceObject, object({ '$ref-value': evaluate(e, schema) }), referenceExtensions]);
29
+ export const asyncApiResolvedReference = (schema) => intersection([asyncApiReferenceObject, object({ '$ref-value': optional(evaluate(e, schema)) }), referenceExtensions]);
24
30
  /** Inline object or Reference Object with resolved `$ref-value`. */
25
31
  export const recursiveRef = (schema) => union([schema, asyncApiResolvedReference(schema)]);
@@ -11,6 +11,7 @@ export { XScalarEnvVar, XScalarEnvironment, XScalarEnvironments } from './x-scal
11
11
  export { XScalarIcon } from './x-scalar-icon.js';
12
12
  export { XScalarIgnore } from './x-scalar-ignore.js';
13
13
  export { XScalarIsDirty } from './x-scalar-is-dirty.js';
14
+ export { XScalarLinks } from './x-scalar-links.js';
14
15
  export { XScalarNavigation } from './x-scalar-navigation.js';
15
16
  export { XScalarOriginalDocumentHash } from './x-scalar-original-document-hash.js';
16
17
  export { XScalarOriginalSourceUrl } from './x-scalar-original-source-url.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/document/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM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AAA;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA"}
@@ -11,6 +11,7 @@ export { XScalarEnvVar, XScalarEnvironment, XScalarEnvironments } from './x-scal
11
11
  export { XScalarIcon } from './x-scalar-icon.js';
12
12
  export { XScalarIgnore } from './x-scalar-ignore.js';
13
13
  export { XScalarIsDirty } from './x-scalar-is-dirty.js';
14
+ export { XScalarLinks } from './x-scalar-links.js';
14
15
  export { XScalarNavigation } from './x-scalar-navigation.js';
15
16
  export { XScalarOriginalDocumentHash } from './x-scalar-original-document-hash.js';
16
17
  export { XScalarOriginalSourceUrl } from './x-scalar-original-source-url.js';
@@ -0,0 +1,7 @@
1
+ export declare const XScalarLinks: import("@scalar/validation").ObjectSchema<{
2
+ 'x-scalar-links': import("@scalar/validation").OptionalSchema<import("@scalar/validation").ArraySchema<import("@scalar/validation").ObjectSchema<{
3
+ name: import("@scalar/validation").StringSchema;
4
+ url: import("@scalar/validation").StringSchema;
5
+ }>>>;
6
+ }>;
7
+ //# sourceMappingURL=x-scalar-links.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-scalar-links.d.ts","sourceRoot":"","sources":["../../../src/extensions/document/x-scalar-links.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,YAAY;;;;;EAsBxB,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { array, object, optional, string } from '@scalar/validation';
2
+ import { typeCommentWithExample } from '../type-comment.js';
3
+ const XScalarLinkItem = object({
4
+ name: string({ typeComment: 'The label to display for the link.' }),
5
+ url: string({ typeComment: 'The URL the link points to.' }),
6
+ }, {
7
+ typeName: 'XScalarLinkItem',
8
+ typeComment: 'A named link to display alongside the API info',
9
+ });
10
+ export const XScalarLinks = object({
11
+ 'x-scalar-links': optional(array(XScalarLinkItem, {
12
+ typeComment: 'Additional named links to display alongside the API info (e.g. privacy policy, imprint)',
13
+ })),
14
+ }, {
15
+ typeName: 'XScalarLinks',
16
+ typeComment: typeCommentWithExample('Additional named links to display alongside the API info, for example a privacy policy or an imprint. This is handy for the legal texts that some countries require on public websites.', {
17
+ language: 'yaml',
18
+ body: `x-scalar-links:
19
+ - name: Privacy Policy
20
+ url: https://example.com/privacy
21
+ - name: Imprint
22
+ url: https://example.com/imprint`,
23
+ }),
24
+ });
@@ -22,6 +22,11 @@ export declare const openApiSchema: import("@scalar/validation").IntersectionSch
22
22
  description: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
23
23
  source: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
24
24
  }>>>;
25
+ }>, import("@scalar/validation").ObjectSchema<{
26
+ 'x-scalar-links': import("@scalar/validation").OptionalSchema<import("@scalar/validation").ArraySchema<import("@scalar/validation").ObjectSchema<{
27
+ name: import("@scalar/validation").StringSchema;
28
+ url: import("@scalar/validation").StringSchema;
29
+ }>>>;
25
30
  }>]>;
26
31
  jsonSchemaDialect: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
27
32
  servers: import("@scalar/validation").OptionalSchema<import("@scalar/validation").ArraySchema<import("@scalar/validation").ObjectSchema<{
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/openapi/3.1/document.ts"],"names":[],"mappings":"AA4GA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAGxB,CAAA"}
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/openapi/3.1/document.ts"],"names":[],"mappings":"AA4GA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAGxB,CAAA"}
@@ -20,5 +20,10 @@ export declare const info: import("@scalar/validation").IntersectionSchema<reado
20
20
  description: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
21
21
  source: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
22
22
  }>>>;
23
+ }>, import("@scalar/validation").ObjectSchema<{
24
+ 'x-scalar-links': import("@scalar/validation").OptionalSchema<import("@scalar/validation").ArraySchema<import("@scalar/validation").ObjectSchema<{
25
+ name: import("@scalar/validation").StringSchema;
26
+ url: import("@scalar/validation").StringSchema;
27
+ }>>>;
23
28
  }>]>;
24
29
  //# sourceMappingURL=info.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../src/openapi/3.1/info.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;IAuBhB,CAAA"}
1
+ {"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../src/openapi/3.1/info.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwBhB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { intersection, object, optional, string } from '@scalar/validation';
2
- import { XScalarSdkInstallation } from '../../extensions/document/index.js';
2
+ import { XScalarLinks, XScalarSdkInstallation } from '../../extensions/document/index.js';
3
3
  import { contact } from '../../openapi/3.1/contact.js';
4
4
  import { license } from '../../openapi/3.1/license.js';
5
5
  export const info = intersection([
@@ -17,4 +17,5 @@ export const info = intersection([
17
17
  license: optional(license),
18
18
  }),
19
19
  XScalarSdkInstallation,
20
+ XScalarLinks,
20
21
  ], { typeName: 'InfoObject' });
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "schemas",
15
15
  "scalar"
16
16
  ],
17
- "version": "0.6.0",
17
+ "version": "0.7.1",
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.8.2",
45
- "@scalar/validation": "0.6.0"
44
+ "@scalar/validation": "0.6.0",
45
+ "@scalar/helpers": "0.9.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "vitest": "4.1.0",
49
- "@scalar/types": "0.15.0"
49
+ "@scalar/types": "0.16.1"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",