@gitbook/react-openapi 1.1.10 → 1.2.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.
Files changed (164) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/InteractiveSection.d.ts +4 -0
  3. package/dist/InteractiveSection.jsx +11 -11
  4. package/dist/OpenAPICodeSample.d.ts +2 -1
  5. package/dist/OpenAPICodeSample.jsx +6 -5
  6. package/dist/OpenAPICodeSampleInteractive.d.ts +3 -0
  7. package/dist/OpenAPICodeSampleInteractive.jsx +19 -43
  8. package/dist/OpenAPICodeSampleSelector.d.ts +3 -4
  9. package/dist/OpenAPICodeSampleSelector.jsx +6 -11
  10. package/dist/OpenAPICopyButton.d.ts +2 -0
  11. package/dist/OpenAPICopyButton.jsx +5 -2
  12. package/dist/OpenAPIDisclosure.d.ts +4 -3
  13. package/dist/OpenAPIDisclosure.jsx +8 -11
  14. package/dist/OpenAPIDisclosureGroup.d.ts +7 -3
  15. package/dist/OpenAPIDisclosureGroup.jsx +18 -18
  16. package/dist/OpenAPIExample.d.ts +4 -22
  17. package/dist/OpenAPIExample.jsx +5 -72
  18. package/dist/OpenAPIMediaType.d.ts +21 -0
  19. package/dist/OpenAPIMediaType.jsx +61 -0
  20. package/dist/OpenAPIOperation.d.ts +3 -2
  21. package/dist/OpenAPIOperation.jsx +9 -68
  22. package/dist/OpenAPIOperationDescription.d.ts +9 -0
  23. package/dist/OpenAPIOperationDescription.jsx +22 -0
  24. package/dist/OpenAPIOperationStability.d.ts +9 -0
  25. package/dist/OpenAPIOperationStability.jsx +27 -0
  26. package/dist/OpenAPIPath.d.ts +2 -0
  27. package/dist/OpenAPIPath.jsx +3 -2
  28. package/dist/OpenAPIRequestBody.d.ts +3 -1
  29. package/dist/OpenAPIRequestBody.jsx +4 -3
  30. package/dist/OpenAPIResponse.d.ts +1 -1
  31. package/dist/OpenAPIResponse.jsx +1 -1
  32. package/dist/OpenAPIResponseExample.d.ts +3 -2
  33. package/dist/OpenAPIResponseExample.jsx +24 -63
  34. package/dist/OpenAPIResponseExampleContent.d.ts +19 -0
  35. package/dist/OpenAPIResponseExampleContent.jsx +57 -0
  36. package/dist/OpenAPIResponses.d.ts +1 -1
  37. package/dist/OpenAPIResponses.jsx +49 -36
  38. package/dist/OpenAPISchema.d.ts +1 -1
  39. package/dist/OpenAPISchema.jsx +103 -15
  40. package/dist/OpenAPISchemaName.d.ts +2 -0
  41. package/dist/OpenAPISchemaName.jsx +19 -10
  42. package/dist/OpenAPISchemaServer.d.ts +1 -1
  43. package/dist/OpenAPISecurities.d.ts +2 -1
  44. package/dist/OpenAPISecurities.jsx +11 -10
  45. package/dist/OpenAPISelect.d.ts +10 -3
  46. package/dist/OpenAPISelect.jsx +20 -9
  47. package/dist/OpenAPISpec.d.ts +3 -2
  48. package/dist/OpenAPISpec.jsx +11 -9
  49. package/dist/OpenAPIWebhook.d.ts +10 -0
  50. package/dist/OpenAPIWebhook.jsx +23 -0
  51. package/dist/OpenAPIWebhookExample.d.ts +6 -0
  52. package/dist/OpenAPIWebhookExample.jsx +41 -0
  53. package/dist/ScalarApiButton.d.ts +2 -0
  54. package/dist/ScalarApiButton.jsx +4 -3
  55. package/dist/StaticSection.d.ts +4 -1
  56. package/dist/StaticSection.jsx +13 -4
  57. package/dist/code-samples.js +57 -39
  58. package/dist/common/OpenAPIColumnSpec.d.ts +6 -0
  59. package/dist/common/OpenAPIColumnSpec.jsx +20 -0
  60. package/dist/common/OpenAPIOperationDescription.d.ts +6 -0
  61. package/dist/common/OpenAPIOperationDescription.jsx +19 -0
  62. package/dist/common/OpenAPIStability.d.ts +4 -0
  63. package/dist/common/OpenAPIStability.jsx +15 -0
  64. package/dist/common/OpenAPISummary.d.ts +6 -0
  65. package/dist/common/OpenAPISummary.jsx +30 -0
  66. package/dist/context.d.ts +23 -2
  67. package/dist/context.js +32 -0
  68. package/dist/getOrCreateStoreByKey.d.ts +1 -1
  69. package/dist/getOrCreateStoreByKey.js +0 -1
  70. package/dist/index.d.ts +5 -1
  71. package/dist/index.js +3 -0
  72. package/dist/resolveOpenAPIWebhook.d.ts +11 -0
  73. package/dist/resolveOpenAPIWebhook.js +127 -0
  74. package/dist/schemas/OpenAPISchemas.d.ts +2 -2
  75. package/dist/schemas/OpenAPISchemas.jsx +19 -23
  76. package/dist/stringifyOpenAPI.d.ts +1 -1
  77. package/dist/stringifyOpenAPI.js +6 -3
  78. package/dist/translate.d.ts +10 -0
  79. package/dist/translate.jsx +75 -0
  80. package/dist/translations/de.d.ts +37 -0
  81. package/dist/translations/de.js +37 -0
  82. package/dist/translations/en.d.ts +37 -0
  83. package/dist/translations/en.js +37 -0
  84. package/dist/translations/es.d.ts +37 -0
  85. package/dist/translations/es.js +37 -0
  86. package/dist/translations/fr.d.ts +37 -0
  87. package/dist/translations/fr.js +37 -0
  88. package/dist/translations/index.d.ts +341 -0
  89. package/dist/translations/index.js +27 -0
  90. package/dist/translations/ja.d.ts +37 -0
  91. package/dist/translations/ja.js +37 -0
  92. package/dist/translations/nl.d.ts +37 -0
  93. package/dist/translations/nl.js +37 -0
  94. package/dist/translations/no.d.ts +37 -0
  95. package/dist/translations/no.js +37 -0
  96. package/dist/translations/pt-br.d.ts +37 -0
  97. package/dist/translations/pt-br.js +37 -0
  98. package/dist/translations/types.d.ts +5 -0
  99. package/dist/translations/types.js +1 -0
  100. package/dist/translations/zh.d.ts +37 -0
  101. package/dist/translations/zh.js +37 -0
  102. package/dist/tsconfig.build.tsbuildinfo +1 -1
  103. package/dist/types.d.ts +8 -50
  104. package/dist/util/example.d.ts +35 -0
  105. package/dist/util/example.jsx +103 -0
  106. package/dist/utils.d.ts +18 -0
  107. package/dist/utils.js +57 -0
  108. package/package.json +3 -3
  109. package/src/InteractiveSection.tsx +16 -14
  110. package/src/OpenAPICodeSample.tsx +22 -4
  111. package/src/OpenAPICodeSampleInteractive.tsx +38 -58
  112. package/src/OpenAPICodeSampleSelector.tsx +19 -12
  113. package/src/OpenAPICopyButton.tsx +7 -2
  114. package/src/OpenAPIDisclosure.tsx +20 -22
  115. package/src/OpenAPIDisclosureGroup.tsx +41 -22
  116. package/src/OpenAPIExample.tsx +8 -82
  117. package/src/OpenAPIMediaType.tsx +139 -0
  118. package/src/OpenAPIOperation.tsx +11 -100
  119. package/src/OpenAPIOperationDescription.tsx +34 -0
  120. package/src/OpenAPIOperationStability.tsx +39 -0
  121. package/src/OpenAPIPath.tsx +4 -1
  122. package/src/OpenAPIRequestBody.tsx +9 -4
  123. package/src/OpenAPIResponse.tsx +2 -2
  124. package/src/OpenAPIResponseExample.tsx +39 -108
  125. package/src/OpenAPIResponseExampleContent.tsx +123 -0
  126. package/src/OpenAPIResponses.tsx +84 -62
  127. package/src/OpenAPISchema.test.ts +80 -0
  128. package/src/OpenAPISchema.tsx +123 -16
  129. package/src/OpenAPISchemaName.tsx +26 -11
  130. package/src/OpenAPISchemaServer.tsx +1 -1
  131. package/src/OpenAPISecurities.tsx +33 -12
  132. package/src/OpenAPISelect.tsx +42 -16
  133. package/src/OpenAPISpec.tsx +21 -10
  134. package/src/OpenAPIWebhook.tsx +33 -0
  135. package/src/OpenAPIWebhookExample.tsx +60 -0
  136. package/src/ScalarApiButton.tsx +6 -6
  137. package/src/StaticSection.tsx +37 -5
  138. package/src/code-samples.test.ts +3 -1
  139. package/src/code-samples.ts +67 -54
  140. package/src/common/OpenAPIColumnSpec.tsx +31 -0
  141. package/src/common/OpenAPIOperationDescription.tsx +31 -0
  142. package/src/common/OpenAPIStability.tsx +23 -0
  143. package/src/common/OpenAPISummary.tsx +45 -0
  144. package/src/context.ts +37 -2
  145. package/src/getOrCreateStoreByKey.ts +1 -3
  146. package/src/index.ts +5 -1
  147. package/src/resolveOpenAPIWebhook.ts +99 -0
  148. package/src/schemas/OpenAPISchemas.tsx +34 -34
  149. package/src/stringifyOpenAPI.ts +11 -3
  150. package/src/translate.tsx +80 -0
  151. package/src/translations/de.ts +37 -0
  152. package/src/translations/en.ts +37 -0
  153. package/src/translations/es.ts +37 -0
  154. package/src/translations/fr.ts +37 -0
  155. package/src/translations/index.ts +33 -0
  156. package/src/translations/ja.ts +37 -0
  157. package/src/translations/nl.ts +37 -0
  158. package/src/translations/no.ts +37 -0
  159. package/src/translations/pt-br.ts +37 -0
  160. package/src/translations/types.ts +7 -0
  161. package/src/translations/zh.ts +37 -0
  162. package/src/types.ts +11 -53
  163. package/src/util/example.tsx +129 -0
  164. package/src/utils.ts +67 -0
@@ -0,0 +1,99 @@
1
+ import { fromJSON, toJSON } from 'flatted';
2
+
3
+ import type {
4
+ Filesystem,
5
+ OpenAPIV3,
6
+ OpenAPIV3_1,
7
+ OpenAPIV3xDocument,
8
+ } from '@gitbook/openapi-parser';
9
+ import { dereferenceFilesystem } from './dereference';
10
+ import type { OpenAPIWebhookData } from './types';
11
+
12
+ export { fromJSON, toJSON };
13
+
14
+ /**
15
+ * Resolve an OpenAPI webhook in a file and compile it to a more usable format.
16
+ */
17
+ export async function resolveOpenAPIWebhook(
18
+ filesystem: Filesystem<OpenAPIV3xDocument>,
19
+ webhookDescriptor: {
20
+ name: string;
21
+ method: string;
22
+ }
23
+ ): Promise<OpenAPIWebhookData | null> {
24
+ const { name, method } = webhookDescriptor;
25
+ const schema = await dereferenceFilesystem(filesystem);
26
+ let operation = getWebhookByNameAndMethod(schema, name, method);
27
+
28
+ if (!operation) {
29
+ return null;
30
+ }
31
+
32
+ // Resolve common parameters
33
+ const commonParameters = getPathObjectParameter(schema, name);
34
+ if (commonParameters) {
35
+ operation = {
36
+ ...operation,
37
+ parameters: [...commonParameters, ...(operation.parameters ?? [])],
38
+ };
39
+ }
40
+
41
+ const servers = 'servers' in schema ? (schema.servers ?? []) : [];
42
+
43
+ return {
44
+ servers,
45
+ operation,
46
+ method,
47
+ name,
48
+ };
49
+ }
50
+
51
+ /**
52
+ * Get a path object from its path.
53
+ */
54
+ function getPathObject(
55
+ schema: OpenAPIV3.Document | OpenAPIV3_1.Document,
56
+ name: string
57
+ ): OpenAPIV3.PathItemObject | OpenAPIV3_1.PathItemObject | null {
58
+ if (schema.webhooks?.[name]) {
59
+ return schema.webhooks[name];
60
+ }
61
+ return null;
62
+ }
63
+
64
+ /**
65
+ * Resolve parameters from a path in an OpenAPI schema.
66
+ */
67
+ function getPathObjectParameter(
68
+ schema: OpenAPIV3.Document | OpenAPIV3_1.Document,
69
+ path: string
70
+ ):
71
+ | (OpenAPIV3.ReferenceObject | OpenAPIV3.ParameterObject)[]
72
+ | (OpenAPIV3.ParameterObject | OpenAPIV3_1.ReferenceObject)[]
73
+ | null {
74
+ const pathObject = getPathObject(schema, path);
75
+ if (pathObject?.parameters) {
76
+ return pathObject.parameters;
77
+ }
78
+ return null;
79
+ }
80
+
81
+ /**
82
+ * Get an operation by its path and method.
83
+ */
84
+ function getWebhookByNameAndMethod(
85
+ schema: OpenAPIV3.Document | OpenAPIV3_1.Document,
86
+ name: string,
87
+ method: string
88
+ ): OpenAPIV3.OperationObject | null {
89
+ // Types are buffy for OpenAPIV3_1.OperationObject, so we use v3
90
+ const pathObject = getPathObject(schema, name);
91
+ if (!pathObject) {
92
+ return null;
93
+ }
94
+ const normalizedMethod = method.toLowerCase();
95
+ if (!pathObject[normalizedMethod]) {
96
+ return null;
97
+ }
98
+ return pathObject[normalizedMethod];
99
+ }
@@ -1,11 +1,16 @@
1
1
  import type { OpenAPISchema } from '@gitbook/openapi-parser';
2
2
  import clsx from 'clsx';
3
- import { OpenAPIDisclosureGroup } from '../OpenAPIDisclosureGroup';
4
- import { OpenAPIExample, getExampleFromSchema } from '../OpenAPIExample';
3
+ import { OpenAPIDisclosure } from '../OpenAPIDisclosure';
4
+ import { OpenAPIExample } from '../OpenAPIExample';
5
5
  import { OpenAPIRootSchema } from '../OpenAPISchemaServer';
6
6
  import { Section, SectionBody, StaticSection } from '../StaticSection';
7
- import { getOpenAPIClientContext } from '../context';
8
- import type { OpenAPIContext } from '../types';
7
+ import {
8
+ type OpenAPIContextInput,
9
+ getOpenAPIClientContext,
10
+ resolveOpenAPIContext,
11
+ } from '../context';
12
+ import { t } from '../translate';
13
+ import { getExampleFromSchema } from '../util/example';
9
14
 
10
15
  /**
11
16
  * OpenAPI Schemas component.
@@ -13,13 +18,13 @@ import type { OpenAPIContext } from '../types';
13
18
  export function OpenAPISchemas(props: {
14
19
  className?: string;
15
20
  schemas: OpenAPISchema[];
16
- context: OpenAPIContext;
21
+ context: OpenAPIContextInput;
17
22
  /**
18
23
  * Whether to show the schema directly if there is only one.
19
24
  */
20
25
  grouped?: boolean;
21
26
  }) {
22
- const { schemas, context, grouped, className } = props;
27
+ const { schemas, context: contextInput, grouped, className } = props;
23
28
 
24
29
  const firstSchema = schemas[0];
25
30
 
@@ -27,6 +32,7 @@ export function OpenAPISchemas(props: {
27
32
  return null;
28
33
  }
29
34
 
35
+ const context = resolveOpenAPIContext(contextInput);
30
36
  const clientContext = getOpenAPIClientContext(context);
31
37
 
32
38
  // If there is only one model and we are not grouping, we show it directly.
@@ -37,11 +43,16 @@ export function OpenAPISchemas(props: {
37
43
  <div className="openapi-summary" id={context.id}>
38
44
  {context.renderHeading({
39
45
  title,
46
+ deprecated: Boolean(firstSchema.schema.deprecated),
47
+ stability: firstSchema.schema['x-stability'],
40
48
  })}
41
49
  </div>
42
50
  <div className="openapi-columns">
43
51
  <div className="openapi-column-spec">
44
- <StaticSection className="openapi-parameters" header="Attributes">
52
+ <StaticSection
53
+ className="openapi-parameters"
54
+ header={t(context.translation, 'attributes')}
55
+ >
45
56
  <OpenAPIRootSchema
46
57
  schema={firstSchema.schema}
47
58
  context={clientContext}
@@ -72,33 +83,22 @@ export function OpenAPISchemas(props: {
72
83
  // If there are multiple schemas, we use a disclosure group to show them all.
73
84
  return (
74
85
  <div className={clsx('openapi-schemas', className)}>
75
- <OpenAPIDisclosureGroup
76
- allowsMultipleExpanded
77
- icon={context.icons.chevronRight}
78
- groups={schemas.map(({ name, schema }) => ({
79
- id: name,
80
- label: (
81
- <div className="openapi-response-tab-content" key={`model-${name}`}>
82
- <span className="openapi-response-statuscode">{name}</span>
83
- </div>
84
- ),
85
- tabs: [
86
- {
87
- id: 'model',
88
- body: (
89
- <Section className="openapi-section-schemas">
90
- <SectionBody>
91
- <OpenAPIRootSchema
92
- schema={schema}
93
- context={clientContext}
94
- />
95
- </SectionBody>
96
- </Section>
97
- ),
98
- },
99
- ],
100
- }))}
101
- />
86
+ {schemas.map(({ name, schema }) => {
87
+ return (
88
+ <OpenAPIDisclosure
89
+ className="openapi-schemas-disclosure"
90
+ key={name}
91
+ icon={context.icons.chevronRight}
92
+ label={name}
93
+ >
94
+ <Section className="openapi-section-schemas">
95
+ <SectionBody>
96
+ <OpenAPIRootSchema schema={schema} context={clientContext} />
97
+ </SectionBody>
98
+ </Section>
99
+ </OpenAPIDisclosure>
100
+ );
101
+ })}
102
102
  </div>
103
103
  );
104
104
  }
@@ -1,17 +1,25 @@
1
1
  /**
2
2
  * Stringify an OpenAPI object. Same API as JSON.stringify.
3
3
  */
4
- export function stringifyOpenAPI(body: unknown, _?: null, indent?: number): string {
4
+ export function stringifyOpenAPI(
5
+ value: any,
6
+ replacer?: ((this: any, key: string, value: any) => any) | null,
7
+ space?: string | number
8
+ ): string {
5
9
  return JSON.stringify(
6
- body,
10
+ value,
7
11
  (key, value) => {
8
12
  // Ignore internal keys
9
13
  if (key.startsWith('x-gitbook-')) {
10
14
  return undefined;
11
15
  }
12
16
 
17
+ if (replacer) {
18
+ return replacer(key, value);
19
+ }
20
+
13
21
  return value;
14
22
  },
15
- indent
23
+ space
16
24
  );
17
25
  }
@@ -0,0 +1,80 @@
1
+ import React from 'react';
2
+
3
+ import type { Translation, TranslationKey } from './translations';
4
+
5
+ /**
6
+ * Translate a string.
7
+ */
8
+ export function t(
9
+ translation: Translation,
10
+ id: TranslationKey,
11
+ ...args: React.ReactNode[]
12
+ ): React.ReactNode {
13
+ const string = translation[id];
14
+ if (!string) {
15
+ throw new Error(`Translation not found for "${id}"`);
16
+ }
17
+
18
+ // Now we are going to replace the arguments
19
+ // but we want to return a string as long as it's possible
20
+ // (eg. if there isn't any argument that is a ReactNode)
21
+ const parts: React.ReactNode[] = [];
22
+ let currentStringToReplace: string = string;
23
+
24
+ args.forEach((arg, i) => {
25
+ if (typeof arg === 'string') {
26
+ currentStringToReplace = currentStringToReplace.replace(`\${${i + 1}}`, arg);
27
+ } else {
28
+ const [partToPush, partToReplace] = currentStringToReplace.split(`\${${i + 1}}`);
29
+ if (partToPush === undefined || partToReplace === undefined) {
30
+ throw new Error(`Invalid translation "${id}"`);
31
+ }
32
+ parts.push(<React.Fragment key={`string-${i}`}>{partToPush}</React.Fragment>);
33
+ parts.push(<React.Fragment key={`arg-${i}`}>{arg}</React.Fragment>);
34
+ currentStringToReplace = partToReplace;
35
+ }
36
+ });
37
+
38
+ if (!parts.length) {
39
+ return currentStringToReplace;
40
+ }
41
+
42
+ return (
43
+ <>
44
+ {parts}
45
+ {currentStringToReplace}
46
+ </>
47
+ );
48
+ }
49
+
50
+ /**
51
+ * Version of `t` that returns a string.
52
+ */
53
+ export function tString(
54
+ translation: Translation,
55
+ id: TranslationKey,
56
+ ...args: React.ReactNode[]
57
+ ): string {
58
+ const result = t(translation, id, ...args);
59
+ return reactToString(result);
60
+ }
61
+
62
+ function reactToString(el: React.ReactNode): string {
63
+ if (typeof el === 'string' || typeof el === 'number' || typeof el === 'boolean') {
64
+ return `${el}`;
65
+ }
66
+
67
+ if (el === null || el === undefined) {
68
+ return '';
69
+ }
70
+
71
+ if (Array.isArray(el)) {
72
+ return el.map(reactToString).join('');
73
+ }
74
+
75
+ if (typeof el === 'object' && 'props' in el) {
76
+ return el.props.children.map(reactToString).join('');
77
+ }
78
+
79
+ throw new Error(`Unsupported type ${typeof el}`);
80
+ }
@@ -0,0 +1,37 @@
1
+ export const de = {
2
+ required: 'Erforderlich',
3
+ deprecated: 'Veraltet',
4
+ deprecated_and_sunset_on: 'Diese Operation ist veraltet und wird am ${1} eingestellt.',
5
+ stability_experimental: 'Experimentell',
6
+ stability_alpha: 'Alpha',
7
+ stability_beta: 'Beta',
8
+ copy_to_clipboard: 'In die Zwischenablage kopieren',
9
+ copied: 'Kopiert',
10
+ no_content: 'Kein Inhalt',
11
+ unresolved_reference: 'Nicht aufgelöste Referenz',
12
+ circular_reference: 'Zirkuläre Referenz',
13
+ read_only: 'Nur lesen',
14
+ write_only: 'Nur schreiben',
15
+ optional: 'Optional',
16
+ min: 'Min',
17
+ max: 'Max',
18
+ nullable: 'Nullfähig',
19
+ body: 'Rumpf',
20
+ payload: 'Nutzlast',
21
+ headers: 'Kopfzeilen',
22
+ authorizations: 'Autorisierungen',
23
+ responses: 'Antworten',
24
+ path_parameters: 'Pfadparameter',
25
+ query_parameters: 'Abfrageparameter',
26
+ header_parameters: 'Header-Parameter',
27
+ attributes: 'Attribute',
28
+ test_it: 'Teste es',
29
+ information: 'Information',
30
+ success: 'Erfolg',
31
+ redirect: 'Umleitung',
32
+ error: 'Fehler',
33
+ show: 'Anzeigen',
34
+ hide: 'Verstecken',
35
+ available_items: 'Verfügbare Elemente',
36
+ child_attributes: 'Unterattribute',
37
+ };
@@ -0,0 +1,37 @@
1
+ export const en = {
2
+ required: 'Required',
3
+ deprecated: 'Deprecated',
4
+ deprecated_and_sunset_on: 'This operation is deprecated and will be sunset on ${1}.',
5
+ stability_experimental: 'Experimental',
6
+ stability_alpha: 'Alpha',
7
+ stability_beta: 'Beta',
8
+ copy_to_clipboard: 'Copy to clipboard',
9
+ copied: 'Copied',
10
+ no_content: 'No content',
11
+ unresolved_reference: 'Unresolved reference',
12
+ circular_reference: 'Circular reference',
13
+ read_only: 'Read-only',
14
+ write_only: 'Write-only',
15
+ optional: 'Optional',
16
+ min: 'Min',
17
+ max: 'Max',
18
+ nullable: 'Nullable',
19
+ body: 'Body',
20
+ payload: 'Payload',
21
+ headers: 'Headers',
22
+ authorizations: 'Authorizations',
23
+ responses: 'Responses',
24
+ path_parameters: 'Path parameters',
25
+ query_parameters: 'Query parameters',
26
+ header_parameters: 'Header parameters',
27
+ attributes: 'Attributes',
28
+ test_it: 'Test it',
29
+ information: 'Information',
30
+ success: 'Success',
31
+ redirect: 'Redirect',
32
+ error: 'Error',
33
+ show: 'Show',
34
+ hide: 'Hide',
35
+ available_items: 'Available items',
36
+ child_attributes: 'Child attributes',
37
+ };
@@ -0,0 +1,37 @@
1
+ export const es = {
2
+ required: 'Requerido',
3
+ deprecated: 'Obsoleto',
4
+ deprecated_and_sunset_on: 'Esta operación está obsoleta y se retirará el ${1}.',
5
+ stability_experimental: 'Experimental',
6
+ stability_alpha: 'Alfa',
7
+ stability_beta: 'Beta',
8
+ copy_to_clipboard: 'Copiar al portapapeles',
9
+ copied: 'Copiado',
10
+ no_content: 'Sin contenido',
11
+ unresolved_reference: 'Referencia no resuelta',
12
+ circular_reference: 'Referencia circular',
13
+ read_only: 'Solo lectura',
14
+ write_only: 'Solo escritura',
15
+ optional: 'Opcional',
16
+ min: 'Mín',
17
+ max: 'Máx',
18
+ nullable: 'Nulo',
19
+ body: 'Cuerpo',
20
+ payload: 'Caga útil',
21
+ headers: 'Encabezados',
22
+ authorizations: 'Autorizaciones',
23
+ responses: 'Respuestas',
24
+ path_parameters: 'Parámetros de ruta',
25
+ query_parameters: 'Parámetros de consulta',
26
+ header_parameters: 'Parámetros de encabezado',
27
+ attributes: 'Atributos',
28
+ test_it: 'Pruébalo',
29
+ information: 'Información',
30
+ success: 'Éxito',
31
+ redirect: 'Redirección',
32
+ error: 'Error',
33
+ show: 'Mostrar',
34
+ hide: 'Ocultar',
35
+ available_items: 'Elementos disponibles',
36
+ child_attributes: 'Atributos secundarios',
37
+ };
@@ -0,0 +1,37 @@
1
+ export const fr = {
2
+ required: 'Requis',
3
+ deprecated: 'Obsolète',
4
+ deprecated_and_sunset_on: 'Cette opération est obsolète et sera supprimée le ${1}.',
5
+ stability_experimental: 'Expérimental',
6
+ stability_alpha: 'Alpha',
7
+ stability_beta: 'Bêta',
8
+ copy_to_clipboard: 'Copier dans le presse-papiers',
9
+ copied: 'Copié',
10
+ no_content: 'Aucun contenu',
11
+ unresolved_reference: 'Référence non résolue',
12
+ circular_reference: 'Référence circulaire',
13
+ read_only: 'Lecture seule',
14
+ write_only: 'Écriture seule',
15
+ optional: 'Optionnel',
16
+ min: 'Min',
17
+ max: 'Max',
18
+ nullable: 'Nullable',
19
+ body: 'Corps',
20
+ payload: 'Charge utile',
21
+ headers: 'En-têtes',
22
+ authorizations: 'Autorisations',
23
+ responses: 'Réponses',
24
+ path_parameters: 'Paramètres de chemin',
25
+ query_parameters: 'Paramètres de requête',
26
+ header_parameters: 'Paramètres d’en-tête',
27
+ attributes: 'Attributs',
28
+ test_it: 'Tester',
29
+ information: 'Information',
30
+ success: 'Succès',
31
+ redirect: 'Redirection',
32
+ error: 'Erreur',
33
+ show: 'Afficher',
34
+ hide: 'Masquer',
35
+ available_items: 'Éléments disponibles',
36
+ child_attributes: 'Attributs enfants',
37
+ };
@@ -0,0 +1,33 @@
1
+ import { de } from './de';
2
+ import { en } from './en';
3
+ import { es } from './es';
4
+ import { fr } from './fr';
5
+ import { ja } from './ja';
6
+ import { nl } from './nl';
7
+ import { no } from './no';
8
+ import { pt_br } from './pt-br';
9
+ import type { Translation } from './types';
10
+ import { zh } from './zh';
11
+
12
+ export * from './types';
13
+
14
+ export const translations = {
15
+ en,
16
+ de,
17
+ es,
18
+ fr,
19
+ ja,
20
+ nl,
21
+ no,
22
+ 'pt-br': pt_br,
23
+ zh,
24
+ } satisfies Record<string, Translation>;
25
+
26
+ export type TranslationLocale = keyof typeof translations;
27
+
28
+ /**
29
+ * Check if the locale is valid.
30
+ */
31
+ export function checkIsValidLocale(locale: string): locale is TranslationLocale {
32
+ return Object.prototype.hasOwnProperty.call(translations, locale);
33
+ }
@@ -0,0 +1,37 @@
1
+ export const ja = {
2
+ required: '必須',
3
+ deprecated: '非推奨',
4
+ deprecated_and_sunset_on: 'この操作は非推奨であり、${1}に廃止されます。',
5
+ stability_experimental: '実験的',
6
+ stability_alpha: 'アルファ',
7
+ stability_beta: 'ベータ',
8
+ copy_to_clipboard: 'クリップボードにコピー',
9
+ copied: 'コピー済み',
10
+ no_content: 'コンテンツなし',
11
+ unresolved_reference: '未解決の参照',
12
+ circular_reference: '循環参照',
13
+ read_only: '読み取り専用',
14
+ write_only: '書き込み専用',
15
+ optional: 'オプション',
16
+ min: '最小',
17
+ max: '最大',
18
+ nullable: 'ヌル許容',
19
+ body: '本文',
20
+ payload: 'ペイロード',
21
+ headers: 'ヘッダー',
22
+ authorizations: '認可',
23
+ responses: 'レスポンス',
24
+ path_parameters: 'パスパラメータ',
25
+ query_parameters: 'クエリパラメータ',
26
+ header_parameters: 'ヘッダーパラメータ',
27
+ attributes: '属性',
28
+ test_it: 'テストする',
29
+ information: '情報',
30
+ success: '成功',
31
+ redirect: 'リダイレクト',
32
+ error: 'エラー',
33
+ show: '表示',
34
+ hide: '非表示',
35
+ available_items: '利用可能なアイテム',
36
+ child_attributes: '子属性',
37
+ };
@@ -0,0 +1,37 @@
1
+ export const nl = {
2
+ required: 'Vereist',
3
+ deprecated: 'Verouderd',
4
+ deprecated_and_sunset_on: 'Deze bewerking is verouderd en wordt op ${1} beëindigd.',
5
+ stability_experimental: 'Experimenteel',
6
+ stability_alpha: 'Alfa',
7
+ stability_beta: 'Bèta',
8
+ copy_to_clipboard: 'Kopiëren naar klembord',
9
+ copied: 'Gekopieerd',
10
+ no_content: 'Geen inhoud',
11
+ unresolved_reference: 'Onopgeloste verwijzing',
12
+ circular_reference: 'Circulaire verwijzing',
13
+ read_only: 'Alleen lezen',
14
+ write_only: 'Alleen schrijven',
15
+ optional: 'Optioneel',
16
+ min: 'Min',
17
+ max: 'Max',
18
+ nullable: 'Null toegestaan',
19
+ body: 'Body',
20
+ payload: 'Payload',
21
+ headers: 'Headers',
22
+ authorizations: 'Autorisaties',
23
+ responses: 'Reacties',
24
+ path_parameters: 'Padparameters',
25
+ query_parameters: 'Queryparameters',
26
+ header_parameters: 'Headerparameters',
27
+ attributes: 'Attributen',
28
+ test_it: 'Test het',
29
+ information: 'Informatie',
30
+ success: 'Succes',
31
+ redirect: 'Omleiding',
32
+ error: 'Fout',
33
+ show: 'Toon',
34
+ hide: 'Verbergen',
35
+ available_items: 'Beschikbare items',
36
+ child_attributes: 'Kindattributen',
37
+ };
@@ -0,0 +1,37 @@
1
+ export const no = {
2
+ required: 'Påkrevd',
3
+ deprecated: 'Foreldet',
4
+ deprecated_and_sunset_on: 'Denne operasjonen er foreldet og vil bli avviklet den ${1}.',
5
+ stability_experimental: 'Eksperimentell',
6
+ stability_alpha: 'Alfa',
7
+ stability_beta: 'Beta',
8
+ copy_to_clipboard: 'Kopier til utklippstavle',
9
+ copied: 'Kopiert',
10
+ no_content: 'Ingen innhold',
11
+ unresolved_reference: 'Uavklart referanse',
12
+ circular_reference: 'Sirkulær referanse',
13
+ read_only: 'Skrivebeskyttet',
14
+ write_only: 'Kun skriving',
15
+ optional: 'Valgfri',
16
+ min: 'Min',
17
+ max: 'Maks',
18
+ nullable: 'Kan være null',
19
+ body: 'Brødtekst',
20
+ payload: 'Nyttelast',
21
+ headers: 'Overskrifter',
22
+ authorizations: 'Autorisasjoner',
23
+ responses: 'Responser',
24
+ path_parameters: 'Sti-parametere',
25
+ query_parameters: 'Forespørselsparametere',
26
+ header_parameters: 'Header-parametere',
27
+ attributes: 'Attributter',
28
+ test_it: 'Test det',
29
+ information: 'Informasjon',
30
+ success: 'Suksess',
31
+ redirect: 'Viderekobling',
32
+ error: 'Feil',
33
+ show: 'Vis',
34
+ hide: 'Skjul',
35
+ available_items: 'Tilgjengelige elementer',
36
+ child_attributes: 'Barneattributter',
37
+ };
@@ -0,0 +1,37 @@
1
+ export const pt_br = {
2
+ required: 'Obrigatório',
3
+ deprecated: 'Obsoleto',
4
+ deprecated_and_sunset_on: 'Esta operação está obsoleta e será descontinuada em ${1}.',
5
+ stability_experimental: 'Experimental',
6
+ stability_alpha: 'Alfa',
7
+ stability_beta: 'Beta',
8
+ copy_to_clipboard: 'Copiar para a área de transferência',
9
+ copied: 'Copiado',
10
+ no_content: 'Sem conteúdo',
11
+ unresolved_reference: 'Referência não resolvida',
12
+ circular_reference: 'Referência circular',
13
+ read_only: 'Somente leitura',
14
+ write_only: 'Somente escrita',
15
+ optional: 'Opcional',
16
+ min: 'Mín',
17
+ max: 'Máx',
18
+ nullable: 'Nulo',
19
+ body: 'Corpo',
20
+ payload: 'Carga útil',
21
+ headers: 'Cabeçalhos',
22
+ authorizations: 'Autorizações',
23
+ responses: 'Respostas',
24
+ path_parameters: 'Parâmetros de rota',
25
+ query_parameters: 'Parâmetros de consulta',
26
+ header_parameters: 'Parâmetros de cabeçalho',
27
+ attributes: 'Atributos',
28
+ test_it: 'Testar',
29
+ information: 'Informação',
30
+ success: 'Sucesso',
31
+ redirect: 'Redirecionamento',
32
+ error: 'Erro',
33
+ show: 'Mostrar',
34
+ hide: 'Ocultar',
35
+ available_items: 'Itens disponíveis',
36
+ child_attributes: 'Atributos filhos',
37
+ };
@@ -0,0 +1,7 @@
1
+ import type { en } from './en';
2
+
3
+ export type TranslationKey = keyof typeof en;
4
+
5
+ export type Translation = {
6
+ [key in TranslationKey]: string;
7
+ };