@scalar/schemas 0.5.0 → 0.7.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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # @scalar/schemas
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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.
8
+
9
+ Update the shared theme reset so text inputs align to the logical start by default for RTL documents.
10
+
11
+ Add a `mergeObjects` deep-merge helper to `@scalar/helpers`, used by the localization layer to merge translation overrides onto the built-in locale.
12
+
13
+ - [#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.
14
+
15
+ ### Patch Changes
16
+
17
+ - [#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.
18
+
19
+ ## 0.6.0
20
+
21
+ ### Minor Changes
22
+
23
+ - [#9515](https://github.com/scalar/scalar/pull/9515): feat: add `requestBuilt` client plugin hook and `onRequestBuilt` configuration callback that receive the exact fetch `Request` that is sent over the wire
24
+
25
+ The hook runs after the request has been built, right before it is sent. Header mutations apply to the outgoing request and the body bytes match what the server receives, which makes request signing possible: hashing the body of a rebuilt `multipart/form-data` request would produce a different multipart boundary than the request that is actually sent.
26
+
3
27
  ## 0.5.0
4
28
 
5
29
  ### 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;
@@ -108,6 +113,11 @@ export declare const apiReferenceConfigurationSchema: import("@scalar/validation
108
113
  requestBuilder: unknown;
109
114
  envVariables: Record<string, string>;
110
115
  }) => Promise<void> | void>>;
116
+ onRequestBuilt: import("@scalar/validation").OptionalSchema<import("@scalar/validation").FunctionSchema<(input: {
117
+ request: Request;
118
+ requestBuilder: unknown;
119
+ envVariables: Record<string, string>;
120
+ }) => Promise<void> | void>>;
111
121
  onShowMore: import("@scalar/validation").OptionalSchema<import("@scalar/validation").FunctionSchema<(tagId: string) => Promise<void> | void>>;
112
122
  onSidebarClick: import("@scalar/validation").OptionalSchema<import("@scalar/validation").FunctionSchema<(href: string) => Promise<void> | void>>;
113
123
  pathRouting: import("@scalar/validation").OptionalSchema<import("@scalar/validation").ObjectSchema<{
@@ -258,6 +268,11 @@ export declare const apiReferenceConfigurationWithSourceSchema: (rawInput: unkno
258
268
  apiClientPlugins: any[];
259
269
  })[] | undefined;
260
270
  modelsSectionLabel?: string | undefined;
271
+ localization?: {
272
+ locale?: string | undefined;
273
+ direction?: "auto" | "ltr" | "rtl" | undefined;
274
+ translations?: Record<string, any> | undefined;
275
+ } | undefined;
261
276
  hideDownloadButton?: boolean | undefined;
262
277
  darkMode?: boolean | undefined;
263
278
  forceDarkModeState?: "dark" | "light" | undefined;
@@ -277,6 +292,11 @@ export declare const apiReferenceConfigurationWithSourceSchema: (rawInput: unkno
277
292
  requestBuilder: unknown;
278
293
  envVariables: Record<string, string>;
279
294
  }) => Promise<void> | void) | undefined;
295
+ onRequestBuilt?: ((input: {
296
+ request: Request;
297
+ requestBuilder: unknown;
298
+ envVariables: Record<string, string>;
299
+ }) => Promise<void> | void) | undefined;
280
300
  onShowMore?: ((tagId: string) => Promise<void> | void) | undefined;
281
301
  onSidebarClick?: ((href: string) => Promise<void> | void) | undefined;
282
302
  pathRouting?: {
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oHAyFJ,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;gHAOE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;mHAG5B,MAAM,KAAK,OAAO,CAAC,IA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M,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
  }),
@@ -91,6 +100,9 @@ export const apiReferenceConfigurationSchema = intersection([
91
100
  onBeforeRequest: optional(fn(), {
92
101
  typeComment: 'Fired before the outbound request is built; callback receives a mutable request builder. Experimental API.',
93
102
  }),
103
+ onRequestBuilt: optional(fn(), {
104
+ typeComment: 'Fired right before the outbound request is sent; callback receives the exact fetch Request that goes over the wire. Experimental API.',
105
+ }),
94
106
  onShowMore: optional(fn(), {
95
107
  typeComment: 'onShowMore is fired when the user clicks the "Show more" button on the references',
96
108
  }),
@@ -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()),
@@ -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,qBAAqB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA"}
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,qBAAqB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;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.5.0",
17
+ "version": "0.7.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.8.2",
44
+ "@scalar/helpers": "0.9.0",
45
45
  "@scalar/validation": "0.6.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "vitest": "4.1.0",
49
- "@scalar/types": "0.14.0"
49
+ "@scalar/types": "0.16.0"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",