@gitbook/react-openapi 1.4.3 → 1.5.2
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 +36 -0
- package/dist/InteractiveSection.js +59 -0
- package/dist/Markdown.js +10 -0
- package/dist/OpenAPICodeSample.js +219 -0
- package/dist/OpenAPICodeSampleInteractive.js +66 -0
- package/dist/OpenAPICodeSampleSelector.js +45 -0
- package/dist/OpenAPICopyButton.js +39 -0
- package/dist/OpenAPIDisclosure.js +30 -0
- package/dist/OpenAPIDisclosureGroup.js +75 -0
- package/dist/OpenAPIExample.js +41 -0
- package/dist/OpenAPIMediaType.js +58 -0
- package/dist/OpenAPIOperation.d.ts +12 -7
- package/dist/OpenAPIOperation.js +30 -0
- package/dist/OpenAPIOperationContext.d.ts +10 -6
- package/dist/OpenAPIOperationContext.js +30 -0
- package/dist/OpenAPIPath.js +51 -0
- package/dist/OpenAPIPrefillContextProvider.d.ts +11 -7
- package/dist/OpenAPIPrefillContextProvider.js +25 -0
- package/dist/OpenAPIRequestBody.js +28 -0
- package/dist/OpenAPIRequestBodyHeaderType.js +23 -0
- package/dist/OpenAPIResponse.js +39 -0
- package/dist/OpenAPIResponseExample.js +75 -0
- package/dist/OpenAPIResponseExampleContent.js +61 -0
- package/dist/OpenAPIResponses.js +61 -0
- package/dist/OpenAPISchema.js +373 -0
- package/dist/OpenAPISchemaName.js +45 -0
- package/dist/OpenAPISchemaServer.js +13 -0
- package/dist/OpenAPISecurities.js +124 -0
- package/dist/OpenAPISelect.js +45 -0
- package/dist/OpenAPISpec.js +73 -0
- package/dist/OpenAPIWebhook.d.ts +12 -7
- package/dist/OpenAPIWebhook.js +28 -0
- package/dist/OpenAPIWebhookExample.js +40 -0
- package/dist/ScalarApiButton.js +87 -0
- package/dist/StaticSection.js +37 -0
- package/dist/code-samples.js +267 -419
- package/dist/common/OpenAPIColumnSpec.js +23 -0
- package/dist/common/OpenAPIOperationDescription.js +18 -0
- package/dist/common/OpenAPIStability.js +17 -0
- package/dist/common/OpenAPISummary.js +27 -0
- package/dist/contentTypeChecks.js +24 -20
- package/dist/context.d.ts +68 -72
- package/dist/context.js +25 -39
- package/dist/decycle.js +39 -68
- package/dist/dereference.js +20 -64
- package/dist/generateSchemaExample.js +188 -332
- package/dist/getDisclosureLabel.js +15 -16
- package/dist/getOrCreateStoreByKey.js +20 -17
- package/dist/index.d.ts +12 -10
- package/dist/index.js +11 -8
- package/dist/json2xml.js +10 -5
- package/dist/resolveOpenAPIOperation.d.ts +11 -7
- package/dist/resolveOpenAPIOperation.js +88 -159
- package/dist/resolveOpenAPIWebhook.d.ts +11 -7
- package/dist/resolveOpenAPIWebhook.js +41 -116
- package/dist/schemas/OpenAPISchemaItem.js +26 -0
- package/dist/schemas/OpenAPISchemas.d.ts +16 -11
- package/dist/schemas/OpenAPISchemas.js +57 -0
- package/dist/schemas/resolveOpenAPISchemas.d.ts +9 -4
- package/dist/schemas/resolveOpenAPISchemas.js +15 -59
- package/dist/stringifyOpenAPI.js +12 -13
- package/dist/translate.js +43 -0
- package/dist/translations/de.js +47 -42
- package/dist/translations/en.d.ts +46 -42
- package/dist/translations/en.js +47 -42
- package/dist/translations/es.js +47 -42
- package/dist/translations/fr.js +47 -42
- package/dist/translations/index.d.ts +404 -391
- package/dist/translations/index.js +28 -24
- package/dist/translations/ja.js +47 -42
- package/dist/translations/nl.js +47 -42
- package/dist/translations/no.js +47 -42
- package/dist/translations/pt-br.js +47 -42
- package/dist/translations/types.d.ts +7 -5
- package/dist/translations/zh.js +47 -42
- package/dist/types.d.ts +30 -24
- package/dist/util/example.js +84 -0
- package/dist/util/server.js +32 -38
- package/dist/util/tryit-prefill.js +135 -121
- package/dist/utils.js +135 -196
- package/package.json +18 -11
- package/dist/InteractiveSection.d.ts +0 -33
- package/dist/InteractiveSection.jsx +0 -61
- package/dist/Markdown.d.ts +0 -4
- package/dist/Markdown.jsx +0 -5
- package/dist/OpenAPICodeSample.d.ts +0 -19
- package/dist/OpenAPICodeSample.jsx +0 -230
- package/dist/OpenAPICodeSampleInteractive.d.ts +0 -14
- package/dist/OpenAPICodeSampleInteractive.jsx +0 -73
- package/dist/OpenAPICodeSampleSelector.d.ts +0 -14
- package/dist/OpenAPICodeSampleSelector.jsx +0 -44
- package/dist/OpenAPICopyButton.d.ts +0 -13
- package/dist/OpenAPICopyButton.jsx +0 -35
- package/dist/OpenAPIDisclosure.d.ts +0 -11
- package/dist/OpenAPIDisclosure.jsx +0 -30
- package/dist/OpenAPIDisclosureGroup.d.ts +0 -23
- package/dist/OpenAPIDisclosureGroup.jsx +0 -83
- package/dist/OpenAPIExample.d.ts +0 -16
- package/dist/OpenAPIExample.jsx +0 -36
- package/dist/OpenAPIMediaType.d.ts +0 -21
- package/dist/OpenAPIMediaType.jsx +0 -61
- package/dist/OpenAPIOperation.jsx +0 -25
- package/dist/OpenAPIOperationContext.jsx +0 -26
- package/dist/OpenAPIOperationDescription.d.ts +0 -9
- package/dist/OpenAPIOperationDescription.jsx +0 -22
- package/dist/OpenAPIOperationStability.d.ts +0 -9
- package/dist/OpenAPIOperationStability.jsx +0 -27
- package/dist/OpenAPIPath.d.ts +0 -18
- package/dist/OpenAPIPath.jsx +0 -55
- package/dist/OpenAPIPrefillContextProvider.jsx +0 -19
- package/dist/OpenAPIRequestBody.d.ts +0 -11
- package/dist/OpenAPIRequestBody.jsx +0 -28
- package/dist/OpenAPIRequestBodyHeaderType.d.ts +0 -8
- package/dist/OpenAPIRequestBodyHeaderType.jsx +0 -25
- package/dist/OpenAPIResponse.d.ts +0 -10
- package/dist/OpenAPIResponse.jsx +0 -57
- package/dist/OpenAPIResponseExample.d.ts +0 -9
- package/dist/OpenAPIResponseExample.jsx +0 -105
- package/dist/OpenAPIResponseExampleContent.d.ts +0 -22
- package/dist/OpenAPIResponseExampleContent.jsx +0 -60
- package/dist/OpenAPIResponses.d.ts +0 -9
- package/dist/OpenAPIResponses.jsx +0 -77
- package/dist/OpenAPISchema.d.ts +0 -27
- package/dist/OpenAPISchema.jsx +0 -400
- package/dist/OpenAPISchemaName.d.ts +0 -16
- package/dist/OpenAPISchemaName.jsx +0 -43
- package/dist/OpenAPISchemaServer.d.ts +0 -12
- package/dist/OpenAPISchemaServer.jsx +0 -8
- package/dist/OpenAPISecurities.d.ts +0 -9
- package/dist/OpenAPISecurities.jsx +0 -114
- package/dist/OpenAPISelect.d.ts +0 -22
- package/dist/OpenAPISelect.jsx +0 -44
- package/dist/OpenAPISpec.d.ts +0 -6
- package/dist/OpenAPISpec.jsx +0 -80
- package/dist/OpenAPITabs.d.ts +0 -26
- package/dist/OpenAPITabs.jsx +0 -109
- package/dist/OpenAPIWebhook.jsx +0 -23
- package/dist/OpenAPIWebhookExample.d.ts +0 -6
- package/dist/OpenAPIWebhookExample.jsx +0 -41
- package/dist/ScalarApiButton.d.ts +0 -14
- package/dist/ScalarApiButton.jsx +0 -81
- package/dist/StaticSection.d.ts +0 -13
- package/dist/StaticSection.jsx +0 -32
- package/dist/code-samples.d.ts +0 -17
- package/dist/common/OpenAPIColumnSpec.d.ts +0 -6
- package/dist/common/OpenAPIColumnSpec.jsx +0 -20
- package/dist/common/OpenAPIOperationDescription.d.ts +0 -6
- package/dist/common/OpenAPIOperationDescription.jsx +0 -19
- package/dist/common/OpenAPIStability.d.ts +0 -4
- package/dist/common/OpenAPIStability.jsx +0 -15
- package/dist/common/OpenAPISummary.d.ts +0 -6
- package/dist/common/OpenAPISummary.jsx +0 -30
- package/dist/contentTypeChecks.d.ts +0 -10
- package/dist/decycle.d.ts +0 -2
- package/dist/dereference.d.ts +0 -5
- package/dist/generateSchemaExample.d.ts +0 -45
- package/dist/getDisclosureLabel.d.ts +0 -7
- package/dist/getOrCreateStoreByKey.d.ts +0 -10
- package/dist/json2xml.d.ts +0 -4
- package/dist/schemas/OpenAPISchemaItem.d.ts +0 -7
- package/dist/schemas/OpenAPISchemaItem.jsx +0 -16
- package/dist/schemas/OpenAPISchemas.jsx +0 -59
- package/dist/schemas/index.d.ts +0 -2
- package/dist/schemas/index.js +0 -2
- package/dist/stringifyOpenAPI.d.ts +0 -4
- package/dist/translate.d.ts +0 -10
- package/dist/translate.jsx +0 -75
- package/dist/translations/de.d.ts +0 -43
- package/dist/translations/es.d.ts +0 -43
- package/dist/translations/fr.d.ts +0 -43
- package/dist/translations/ja.d.ts +0 -43
- package/dist/translations/nl.d.ts +0 -43
- package/dist/translations/no.d.ts +0 -43
- package/dist/translations/pt-br.d.ts +0 -43
- package/dist/translations/types.js +0 -1
- package/dist/translations/zh.d.ts +0 -43
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types.js +0 -1
- package/dist/util/example.d.ts +0 -35
- package/dist/util/example.jsx +0 -103
- package/dist/util/server.d.ts +0 -9
- package/dist/util/tryit-prefill.d.ts +0 -20
- package/dist/utils.d.ts +0 -50
- package/src/InteractiveSection.tsx +0 -147
- package/src/Markdown.tsx +0 -12
- package/src/OpenAPICodeSample.tsx +0 -330
- package/src/OpenAPICodeSampleInteractive.tsx +0 -136
- package/src/OpenAPICodeSampleSelector.tsx +0 -94
- package/src/OpenAPICopyButton.tsx +0 -72
- package/src/OpenAPIDisclosure.tsx +0 -46
- package/src/OpenAPIDisclosureGroup.tsx +0 -158
- package/src/OpenAPIExample.tsx +0 -55
- package/src/OpenAPIMediaType.tsx +0 -139
- package/src/OpenAPIOperation.tsx +0 -35
- package/src/OpenAPIOperationContext.tsx +0 -45
- package/src/OpenAPIOperationDescription.tsx +0 -34
- package/src/OpenAPIOperationStability.tsx +0 -39
- package/src/OpenAPIPath.tsx +0 -90
- package/src/OpenAPIPrefillContextProvider.tsx +0 -40
- package/src/OpenAPIRequestBody.tsx +0 -54
- package/src/OpenAPIRequestBodyHeaderType.tsx +0 -36
- package/src/OpenAPIResponse.tsx +0 -82
- package/src/OpenAPIResponseExample.tsx +0 -151
- package/src/OpenAPIResponseExampleContent.tsx +0 -125
- package/src/OpenAPIResponses.tsx +0 -125
- package/src/OpenAPISchema.test.ts +0 -172
- package/src/OpenAPISchema.tsx +0 -654
- package/src/OpenAPISchemaName.tsx +0 -80
- package/src/OpenAPISchemaServer.tsx +0 -34
- package/src/OpenAPISecurities.tsx +0 -231
- package/src/OpenAPISelect.tsx +0 -96
- package/src/OpenAPISpec.tsx +0 -138
- package/src/OpenAPITabs.tsx +0 -147
- package/src/OpenAPIWebhook.tsx +0 -33
- package/src/OpenAPIWebhookExample.tsx +0 -60
- package/src/ScalarApiButton.tsx +0 -132
- package/src/StaticSection.tsx +0 -91
- package/src/__snapshots__/json2xml.test.ts.snap +0 -18
- package/src/code-samples.test.ts +0 -714
- package/src/code-samples.ts +0 -448
- package/src/common/OpenAPIColumnSpec.tsx +0 -31
- package/src/common/OpenAPIOperationDescription.tsx +0 -31
- package/src/common/OpenAPIStability.tsx +0 -23
- package/src/common/OpenAPISummary.tsx +0 -45
- package/src/contentTypeChecks.ts +0 -39
- package/src/context.ts +0 -99
- package/src/decycle.ts +0 -68
- package/src/dereference.ts +0 -29
- package/src/generateSchemaExample.test.ts +0 -1040
- package/src/generateSchemaExample.ts +0 -530
- package/src/getDisclosureLabel.ts +0 -25
- package/src/getOrCreateStoreByKey.ts +0 -33
- package/src/index.ts +0 -10
- package/src/json2xml.test.ts +0 -46
- package/src/json2xml.ts +0 -8
- package/src/resolveOpenAPIOperation.test.ts +0 -177
- package/src/resolveOpenAPIOperation.ts +0 -151
- package/src/resolveOpenAPIWebhook.ts +0 -99
- package/src/schemas/OpenAPISchemaItem.tsx +0 -34
- package/src/schemas/OpenAPISchemas.tsx +0 -98
- package/src/schemas/index.ts +0 -2
- package/src/schemas/resolveOpenAPISchemas.test.ts +0 -174
- package/src/schemas/resolveOpenAPISchemas.ts +0 -28
- package/src/stringifyOpenAPI.ts +0 -25
- package/src/translate.tsx +0 -80
- package/src/translations/de.ts +0 -43
- package/src/translations/en.ts +0 -43
- package/src/translations/es.ts +0 -43
- package/src/translations/fr.ts +0 -43
- package/src/translations/index.ts +0 -33
- package/src/translations/ja.ts +0 -43
- package/src/translations/nl.ts +0 -43
- package/src/translations/no.ts +0 -43
- package/src/translations/pt-br.ts +0 -43
- package/src/translations/types.ts +0 -7
- package/src/translations/zh.ts +0 -43
- package/src/types.ts +0 -46
- package/src/util/example.tsx +0 -129
- package/src/util/server.test.ts +0 -58
- package/src/util/server.ts +0 -47
- package/src/util/tryit-prefill.test.ts +0 -311
- package/src/util/tryit-prefill.ts +0 -160
- package/src/utils.ts +0 -255
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { t } from "../translate.js";
|
|
2
|
+
import { OpenAPIExample } from "../OpenAPIExample.js";
|
|
3
|
+
import { OpenAPIRootSchema } from "../OpenAPISchemaServer.js";
|
|
4
|
+
import { StaticSection } from "../StaticSection.js";
|
|
5
|
+
import { getOpenAPIClientContext, resolveOpenAPIContext } from "../context.js";
|
|
6
|
+
import { getExampleFromSchema } from "../util/example.js";
|
|
7
|
+
import { OpenAPISchemaItem } from "./OpenAPISchemaItem.js";
|
|
8
|
+
import clsx from "classnames";
|
|
9
|
+
|
|
10
|
+
//#region src/schemas/OpenAPISchemas.tsx
|
|
11
|
+
/**
|
|
12
|
+
* OpenAPI Schemas component.
|
|
13
|
+
*/
|
|
14
|
+
function OpenAPISchemas(props) {
|
|
15
|
+
const { schemas, context: contextInput, grouped, className } = props;
|
|
16
|
+
const firstSchema = schemas[0];
|
|
17
|
+
if (!firstSchema) return null;
|
|
18
|
+
const context = resolveOpenAPIContext(contextInput);
|
|
19
|
+
const clientContext = getOpenAPIClientContext(context);
|
|
20
|
+
if (schemas.length === 1 && !grouped) {
|
|
21
|
+
const title = `The ${firstSchema.name} object`;
|
|
22
|
+
return <div className={clsx("openapi-schemas", className)}>
|
|
23
|
+
<div className="openapi-summary" id={context.id}>
|
|
24
|
+
{context.renderHeading({
|
|
25
|
+
title,
|
|
26
|
+
deprecated: Boolean(firstSchema.schema.deprecated),
|
|
27
|
+
stability: firstSchema.schema["x-stability"]
|
|
28
|
+
})}
|
|
29
|
+
</div>
|
|
30
|
+
<div className="openapi-columns">
|
|
31
|
+
<div className="openapi-column-spec">
|
|
32
|
+
<StaticSection className="openapi-parameters" header={t(context.translation, "attributes")}>
|
|
33
|
+
<OpenAPIRootSchema schema={firstSchema.schema} context={clientContext} />
|
|
34
|
+
</StaticSection>
|
|
35
|
+
</div>
|
|
36
|
+
<div className="openapi-column-preview">
|
|
37
|
+
<div className="openapi-column-preview-body">
|
|
38
|
+
<div className="openapi-panel">
|
|
39
|
+
<h4 className="openapi-panel-heading">{title}</h4>
|
|
40
|
+
<div className="openapi-panel-body">
|
|
41
|
+
<OpenAPIExample example={getExampleFromSchema({ schema: firstSchema.schema })} context={context} syntax="json" />
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>;
|
|
48
|
+
}
|
|
49
|
+
return <div className={clsx("openapi-schemas", className)}>
|
|
50
|
+
{schemas.map(({ name, schema }) => {
|
|
51
|
+
return <OpenAPISchemaItem key={name} name={name} context={clientContext} schema={schema} />;
|
|
52
|
+
})}
|
|
53
|
+
</div>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
export { OpenAPISchemas };
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Filesystem, OpenAPISchema, OpenAPIV3xDocument } from "@gitbook/openapi-parser";
|
|
2
|
+
|
|
3
|
+
//#region src/schemas/resolveOpenAPISchemas.d.ts
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* Resolve an OpenAPI schemas from a file and compile it to a more usable format.
|
|
4
7
|
* Schemas are extracted from the OpenAPI components.schemas
|
|
5
8
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
declare function resolveOpenAPISchemas(filesystem: Filesystem<OpenAPIV3xDocument>, options: {
|
|
10
|
+
schemas: string[];
|
|
8
11
|
}): Promise<{
|
|
9
|
-
|
|
12
|
+
schemas: OpenAPISchema[];
|
|
10
13
|
} | null>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { resolveOpenAPISchemas };
|
|
@@ -1,61 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { filterSelectedOpenAPISchemas } from '@gitbook/openapi-parser';
|
|
38
|
-
import { dereferenceFilesystem } from '../dereference';
|
|
1
|
+
import { dereferenceFilesystem } from "../dereference.js";
|
|
2
|
+
import { filterSelectedOpenAPISchemas } from "@gitbook/openapi-parser";
|
|
3
|
+
|
|
4
|
+
//#region src/schemas/resolveOpenAPISchemas.ts
|
|
39
5
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
case 0:
|
|
49
|
-
selectedSchemas = options.schemas;
|
|
50
|
-
return [4 /*yield*/, dereferenceFilesystem(filesystem)];
|
|
51
|
-
case 1:
|
|
52
|
-
schema = _a.sent();
|
|
53
|
-
schemas = filterSelectedOpenAPISchemas(schema, selectedSchemas);
|
|
54
|
-
if (schemas.length === 0) {
|
|
55
|
-
return [2 /*return*/, null];
|
|
56
|
-
}
|
|
57
|
-
return [2 /*return*/, { schemas: schemas }];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
6
|
+
* Resolve an OpenAPI schemas from a file and compile it to a more usable format.
|
|
7
|
+
* Schemas are extracted from the OpenAPI components.schemas
|
|
8
|
+
*/
|
|
9
|
+
async function resolveOpenAPISchemas(filesystem, options) {
|
|
10
|
+
const { schemas: selectedSchemas } = options;
|
|
11
|
+
const schemas = filterSelectedOpenAPISchemas(await dereferenceFilesystem(filesystem), selectedSchemas);
|
|
12
|
+
if (schemas.length === 0) return null;
|
|
13
|
+
return { schemas };
|
|
61
14
|
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { resolveOpenAPISchemas };
|
package/dist/stringifyOpenAPI.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
+
//#region src/stringifyOpenAPI.ts
|
|
1
2
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (replacer) {
|
|
11
|
-
return replacer(key, value);
|
|
12
|
-
}
|
|
13
|
-
return value;
|
|
14
|
-
}, space);
|
|
3
|
+
* Stringify an OpenAPI object. Same API as JSON.stringify.
|
|
4
|
+
*/
|
|
5
|
+
function stringifyOpenAPI(value, replacer, space) {
|
|
6
|
+
return JSON.stringify(value, (key, value$1) => {
|
|
7
|
+
if (key.startsWith("x-gitbook-")) return;
|
|
8
|
+
if (replacer) return replacer(key, value$1);
|
|
9
|
+
return value$1;
|
|
10
|
+
}, space);
|
|
15
11
|
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { stringifyOpenAPI };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/translate.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Translate a string.
|
|
6
|
+
*/
|
|
7
|
+
function t(translation, id, ...args) {
|
|
8
|
+
const string = translation[id];
|
|
9
|
+
if (!string) throw new Error(`Translation not found for "${id}"`);
|
|
10
|
+
const parts = [];
|
|
11
|
+
let currentStringToReplace = string;
|
|
12
|
+
args.forEach((arg, i) => {
|
|
13
|
+
if (typeof arg === "string") currentStringToReplace = currentStringToReplace.replace(`\${${i + 1}}`, arg);
|
|
14
|
+
else {
|
|
15
|
+
const [partToPush, partToReplace] = currentStringToReplace.split(`\${${i + 1}}`);
|
|
16
|
+
if (partToPush === void 0 || partToReplace === void 0) throw new Error(`Invalid translation "${id}"`);
|
|
17
|
+
parts.push(<React.Fragment key={`string-${i}`}>{partToPush}</React.Fragment>);
|
|
18
|
+
parts.push(<React.Fragment key={`arg-${i}`}>{arg}</React.Fragment>);
|
|
19
|
+
currentStringToReplace = partToReplace;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
if (!parts.length) return currentStringToReplace;
|
|
23
|
+
return <>
|
|
24
|
+
{parts}
|
|
25
|
+
{currentStringToReplace}
|
|
26
|
+
</>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Version of `t` that returns a string.
|
|
30
|
+
*/
|
|
31
|
+
function tString(translation, id, ...args) {
|
|
32
|
+
return reactToString(t(translation, id, ...args));
|
|
33
|
+
}
|
|
34
|
+
function reactToString(el) {
|
|
35
|
+
if (typeof el === "string" || typeof el === "number" || typeof el === "boolean") return `${el}`;
|
|
36
|
+
if (el === null || el === void 0) return "";
|
|
37
|
+
if (Array.isArray(el)) return el.map(reactToString).join("");
|
|
38
|
+
if (typeof el === "object" && "props" in el) return el.props.children.map(reactToString).join("");
|
|
39
|
+
throw new Error(`Unsupported type ${typeof el}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { t, tString };
|
package/dist/translations/de.js
CHANGED
|
@@ -1,43 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
//#region src/translations/de.ts
|
|
2
|
+
const de = {
|
|
3
|
+
required: "Erforderlich",
|
|
4
|
+
deprecated: "Veraltet",
|
|
5
|
+
deprecated_and_sunset_on: "Diese Operation ist veraltet und wird am ${1} eingestellt.",
|
|
6
|
+
stability_experimental: "Experimentell",
|
|
7
|
+
stability_alpha: "Alpha",
|
|
8
|
+
stability_beta: "Beta",
|
|
9
|
+
discriminator: "Diskriminator",
|
|
10
|
+
copy_to_clipboard: "In die Zwischenablage kopieren",
|
|
11
|
+
copied: "Kopiert",
|
|
12
|
+
no_content: "Kein Inhalt",
|
|
13
|
+
unresolved_reference: "Nicht aufgelöste Referenz",
|
|
14
|
+
circular_reference: "Zirkuläre Referenz",
|
|
15
|
+
read_only: "Nur lesen",
|
|
16
|
+
write_only: "Nur schreiben",
|
|
17
|
+
optional: "Optional",
|
|
18
|
+
min: "Min",
|
|
19
|
+
max: "Max",
|
|
20
|
+
nullable: "Nullfähig",
|
|
21
|
+
body: "Rumpf",
|
|
22
|
+
payload: "Nutzlast",
|
|
23
|
+
headers: "Header",
|
|
24
|
+
header: "Header",
|
|
25
|
+
authorizations: "Autorisierungen",
|
|
26
|
+
responses: "Antworten",
|
|
27
|
+
response: "Antwort",
|
|
28
|
+
path_parameters: "Pfadparameter",
|
|
29
|
+
query_parameters: "Abfrageparameter",
|
|
30
|
+
header_parameters: "Header-Parameter",
|
|
31
|
+
attributes: "Attribute",
|
|
32
|
+
test_it: "Teste es",
|
|
33
|
+
information: "Information",
|
|
34
|
+
success: "Erfolg",
|
|
35
|
+
redirect: "Umleitung",
|
|
36
|
+
error: "Fehler",
|
|
37
|
+
show: "Zeige ${1}",
|
|
38
|
+
hide: "Verstecke ${1}",
|
|
39
|
+
available_items: "Verfügbare Elemente",
|
|
40
|
+
required_scopes: "Erforderliche Scopes",
|
|
41
|
+
properties: "Eigenschaften",
|
|
42
|
+
or: "oder",
|
|
43
|
+
and: "und",
|
|
44
|
+
possible_values: "Mögliche Werte"
|
|
43
45
|
};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { de };
|
|
@@ -1,43 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
//#region src/translations/en.d.ts
|
|
2
|
+
declare const en: {
|
|
3
|
+
required: string;
|
|
4
|
+
deprecated: string;
|
|
5
|
+
deprecated_and_sunset_on: string;
|
|
6
|
+
stability_experimental: string;
|
|
7
|
+
stability_alpha: string;
|
|
8
|
+
stability_beta: string;
|
|
9
|
+
discriminator: string;
|
|
10
|
+
copy_to_clipboard: string;
|
|
11
|
+
copied: string;
|
|
12
|
+
no_content: string;
|
|
13
|
+
unresolved_reference: string;
|
|
14
|
+
circular_reference: string;
|
|
15
|
+
read_only: string;
|
|
16
|
+
write_only: string;
|
|
17
|
+
optional: string;
|
|
18
|
+
min: string;
|
|
19
|
+
max: string;
|
|
20
|
+
nullable: string;
|
|
21
|
+
body: string;
|
|
22
|
+
payload: string;
|
|
23
|
+
headers: string;
|
|
24
|
+
header: string;
|
|
25
|
+
authorizations: string;
|
|
26
|
+
responses: string;
|
|
27
|
+
response: string;
|
|
28
|
+
path_parameters: string;
|
|
29
|
+
query_parameters: string;
|
|
30
|
+
header_parameters: string;
|
|
31
|
+
attributes: string;
|
|
32
|
+
test_it: string;
|
|
33
|
+
information: string;
|
|
34
|
+
success: string;
|
|
35
|
+
redirect: string;
|
|
36
|
+
error: string;
|
|
37
|
+
show: string;
|
|
38
|
+
hide: string;
|
|
39
|
+
available_items: string;
|
|
40
|
+
required_scopes: string;
|
|
41
|
+
possible_values: string;
|
|
42
|
+
properties: string;
|
|
43
|
+
or: string;
|
|
44
|
+
and: string;
|
|
43
45
|
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { en };
|
package/dist/translations/en.js
CHANGED
|
@@ -1,43 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
//#region src/translations/en.ts
|
|
2
|
+
const en = {
|
|
3
|
+
required: "Required",
|
|
4
|
+
deprecated: "Deprecated",
|
|
5
|
+
deprecated_and_sunset_on: "This operation is deprecated and will be sunset on ${1}.",
|
|
6
|
+
stability_experimental: "Experimental",
|
|
7
|
+
stability_alpha: "Alpha",
|
|
8
|
+
stability_beta: "Beta",
|
|
9
|
+
discriminator: "Discriminator",
|
|
10
|
+
copy_to_clipboard: "Copy to clipboard",
|
|
11
|
+
copied: "Copied",
|
|
12
|
+
no_content: "No content",
|
|
13
|
+
unresolved_reference: "Unresolved reference",
|
|
14
|
+
circular_reference: "Circular reference",
|
|
15
|
+
read_only: "Read-only",
|
|
16
|
+
write_only: "Write-only",
|
|
17
|
+
optional: "Optional",
|
|
18
|
+
min: "Min",
|
|
19
|
+
max: "Max",
|
|
20
|
+
nullable: "Nullable",
|
|
21
|
+
body: "Body",
|
|
22
|
+
payload: "Payload",
|
|
23
|
+
headers: "Headers",
|
|
24
|
+
header: "Header",
|
|
25
|
+
authorizations: "Authorizations",
|
|
26
|
+
responses: "Responses",
|
|
27
|
+
response: "Response",
|
|
28
|
+
path_parameters: "Path parameters",
|
|
29
|
+
query_parameters: "Query parameters",
|
|
30
|
+
header_parameters: "Header parameters",
|
|
31
|
+
attributes: "Attributes",
|
|
32
|
+
test_it: "Test it",
|
|
33
|
+
information: "Information",
|
|
34
|
+
success: "Success",
|
|
35
|
+
redirect: "Redirect",
|
|
36
|
+
error: "Error",
|
|
37
|
+
show: "Show ${1}",
|
|
38
|
+
hide: "Hide ${1}",
|
|
39
|
+
available_items: "Available items",
|
|
40
|
+
required_scopes: "Required scopes",
|
|
41
|
+
possible_values: "Possible values",
|
|
42
|
+
properties: "Properties",
|
|
43
|
+
or: "or",
|
|
44
|
+
and: "and"
|
|
43
45
|
};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { en };
|
package/dist/translations/es.js
CHANGED
|
@@ -1,43 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
//#region src/translations/es.ts
|
|
2
|
+
const es = {
|
|
3
|
+
required: "Requerido",
|
|
4
|
+
deprecated: "Obsoleto",
|
|
5
|
+
deprecated_and_sunset_on: "Esta operación está obsoleta y se retirará el ${1}.",
|
|
6
|
+
stability_experimental: "Experimental",
|
|
7
|
+
stability_alpha: "Alfa",
|
|
8
|
+
stability_beta: "Beta",
|
|
9
|
+
discriminator: "Discriminador",
|
|
10
|
+
copy_to_clipboard: "Copiar al portapapeles",
|
|
11
|
+
copied: "Copiado",
|
|
12
|
+
no_content: "Sin contenido",
|
|
13
|
+
unresolved_reference: "Referencia no resuelta",
|
|
14
|
+
circular_reference: "Referencia circular",
|
|
15
|
+
read_only: "Solo lectura",
|
|
16
|
+
write_only: "Solo escritura",
|
|
17
|
+
optional: "Opcional",
|
|
18
|
+
min: "Mín",
|
|
19
|
+
max: "Máx",
|
|
20
|
+
nullable: "Nulo",
|
|
21
|
+
body: "Cuerpo",
|
|
22
|
+
payload: "Caga útil",
|
|
23
|
+
headers: "Headers",
|
|
24
|
+
header: "Header",
|
|
25
|
+
authorizations: "Autorizaciones",
|
|
26
|
+
responses: "Respuestas",
|
|
27
|
+
response: "Respuesta",
|
|
28
|
+
path_parameters: "Parámetros de ruta",
|
|
29
|
+
query_parameters: "Parámetros de consulta",
|
|
30
|
+
header_parameters: "Parámetros de encabezado",
|
|
31
|
+
attributes: "Atributos",
|
|
32
|
+
test_it: "Pruébalo",
|
|
33
|
+
information: "Información",
|
|
34
|
+
success: "Éxito",
|
|
35
|
+
redirect: "Redirección",
|
|
36
|
+
error: "Error",
|
|
37
|
+
show: "Mostrar ${1}",
|
|
38
|
+
hide: "Ocultar ${1}",
|
|
39
|
+
available_items: "Elementos disponibles",
|
|
40
|
+
required_scopes: "Scopes requeridos",
|
|
41
|
+
properties: "Propiedades",
|
|
42
|
+
or: "o",
|
|
43
|
+
and: "y",
|
|
44
|
+
possible_values: "Valores posibles"
|
|
43
45
|
};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { es };
|