@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
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { OpenAPISpec } from '../OpenAPISpec';
|
|
2
|
-
import { getOpenAPIClientContext } from '../context';
|
|
3
|
-
import { t } from '../translate';
|
|
4
|
-
import { OpenAPIOperationDescription } from './OpenAPIOperationDescription';
|
|
5
|
-
export function OpenAPIColumnSpec(props) {
|
|
6
|
-
var data = props.data, context = props.context;
|
|
7
|
-
var operation = data.operation;
|
|
8
|
-
var clientContext = getOpenAPIClientContext(context);
|
|
9
|
-
return (<div className="openapi-column-spec">
|
|
10
|
-
{operation['x-deprecated-sunset'] ? (<div className="openapi-deprecated-sunset openapi-description openapi-markdown">
|
|
11
|
-
{t(context.translation, 'deprecated_and_sunset_on', [
|
|
12
|
-
<span key="date" className="openapi-deprecated-sunset-date">
|
|
13
|
-
{operation['x-deprecated-sunset']}
|
|
14
|
-
</span>,
|
|
15
|
-
])}
|
|
16
|
-
</div>) : null}
|
|
17
|
-
<OpenAPIOperationDescription operation={operation} context={context}/>
|
|
18
|
-
<OpenAPISpec data={data} context={clientContext}/>
|
|
19
|
-
</div>);
|
|
20
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { OpenAPICustomOperationProperties, OpenAPIV3 } from '@gitbook/openapi-parser';
|
|
2
|
-
import type { OpenAPIContext } from '../context';
|
|
3
|
-
export declare function OpenAPIOperationDescription(props: {
|
|
4
|
-
operation: OpenAPIV3.OperationObject<OpenAPICustomOperationProperties>;
|
|
5
|
-
context: OpenAPIContext;
|
|
6
|
-
}): import("react").JSX.Element | null;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Markdown } from '../Markdown';
|
|
2
|
-
import { resolveDescription } from '../utils';
|
|
3
|
-
export function OpenAPIOperationDescription(props) {
|
|
4
|
-
var operation = props.operation;
|
|
5
|
-
if (operation['x-gitbook-description-document']) {
|
|
6
|
-
return (<div className="openapi-intro">
|
|
7
|
-
{props.context.renderDocument({
|
|
8
|
-
document: operation['x-gitbook-description-document'],
|
|
9
|
-
})}
|
|
10
|
-
</div>);
|
|
11
|
-
}
|
|
12
|
-
var description = resolveDescription(operation);
|
|
13
|
-
if (!description) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
return (<div className="openapi-intro">
|
|
17
|
-
<Markdown className="openapi-description" source={description}/>
|
|
18
|
-
</div>);
|
|
19
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var stabilityEnum = {
|
|
2
|
-
experimental: 'Experimental',
|
|
3
|
-
alpha: 'Alpha',
|
|
4
|
-
beta: 'Beta',
|
|
5
|
-
};
|
|
6
|
-
export function OpenAPIStability(props) {
|
|
7
|
-
var stability = props.stability;
|
|
8
|
-
var foundStability = stabilityEnum[stability];
|
|
9
|
-
if (!foundStability) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
return (<div className={"openapi-stability openapi-stability-".concat(foundStability.toLowerCase())}>
|
|
13
|
-
{foundStability}
|
|
14
|
-
</div>);
|
|
15
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { OpenAPIContext } from '../context';
|
|
2
|
-
import type { OpenAPIOperationData, OpenAPIWebhookData } from '../types';
|
|
3
|
-
export declare function OpenAPISummary(props: {
|
|
4
|
-
data: OpenAPIOperationData | OpenAPIWebhookData;
|
|
5
|
-
context: OpenAPIContext;
|
|
6
|
-
}): import("react").JSX.Element;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { OpenAPIPath } from '../OpenAPIPath';
|
|
2
|
-
import { OpenAPIStability } from './OpenAPIStability';
|
|
3
|
-
export function OpenAPISummary(props) {
|
|
4
|
-
var _a;
|
|
5
|
-
var data = props.data, context = props.context;
|
|
6
|
-
var operation = data.operation;
|
|
7
|
-
var title = (function () {
|
|
8
|
-
if (operation.summary) {
|
|
9
|
-
return operation.summary;
|
|
10
|
-
}
|
|
11
|
-
if ('name' in data) {
|
|
12
|
-
return data.name;
|
|
13
|
-
}
|
|
14
|
-
return undefined;
|
|
15
|
-
})();
|
|
16
|
-
return (<div className="openapi-summary" id={operation.summary ? undefined : context.id}>
|
|
17
|
-
{(operation.deprecated || operation['x-stability']) && (<div className="openapi-summary-tags">
|
|
18
|
-
{operation.deprecated && <div className="openapi-deprecated">Deprecated</div>}
|
|
19
|
-
{operation['x-stability'] && (<OpenAPIStability stability={operation['x-stability']}/>)}
|
|
20
|
-
</div>)}
|
|
21
|
-
{title
|
|
22
|
-
? context.renderHeading({
|
|
23
|
-
deprecated: (_a = operation.deprecated) !== null && _a !== void 0 ? _a : false,
|
|
24
|
-
stability: operation['x-stability'],
|
|
25
|
-
title: title,
|
|
26
|
-
})
|
|
27
|
-
: null}
|
|
28
|
-
{'path' in data ? <OpenAPIPath data={data} context={context}/> : null}
|
|
29
|
-
</div>);
|
|
30
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare function isJSON(contentType?: string): boolean;
|
|
2
|
-
export declare function isXML(contentType?: string): boolean;
|
|
3
|
-
export declare function isYAML(contentType?: string): boolean;
|
|
4
|
-
export declare function isGraphQL(contentType?: string): boolean;
|
|
5
|
-
export declare function isCSV(contentType?: string): boolean;
|
|
6
|
-
export declare function isPDF(contentType?: string): boolean;
|
|
7
|
-
export declare function isText(contentType?: string): boolean;
|
|
8
|
-
export declare function isFormUrlEncoded(contentType?: string): boolean;
|
|
9
|
-
export declare function isFormData(contentType?: string): boolean;
|
|
10
|
-
export declare function isPlainObject(value: unknown): boolean;
|
package/dist/decycle.d.ts
DELETED
package/dist/dereference.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { OpenAPIV3 } from '@gitbook/openapi-parser';
|
|
2
|
-
type JSONValue = string | number | boolean | null | JSONValue[] | {
|
|
3
|
-
[key: string]: JSONValue;
|
|
4
|
-
};
|
|
5
|
-
type ScalarGetExampleFromSchemaOptions = NonNullable<Parameters<typeof getExampleFromSchema>[1]>;
|
|
6
|
-
type GenerateSchemaExampleOptions = Pick<ScalarGetExampleFromSchemaOptions, 'xml' | 'omitEmptyAndOptionalProperties' | 'mode'>;
|
|
7
|
-
/**
|
|
8
|
-
* Generate a JSON example from a schema
|
|
9
|
-
*/
|
|
10
|
-
export declare function generateSchemaExample(schema: OpenAPIV3.SchemaObject, options?: GenerateSchemaExampleOptions): JSONValue | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Generate an example for a media type.
|
|
13
|
-
*/
|
|
14
|
-
export declare function generateMediaTypeExamples(mediaType: OpenAPIV3.MediaTypeObject, options?: GenerateSchemaExampleOptions): OpenAPIV3.ExampleObject[];
|
|
15
|
-
/**
|
|
16
|
-
* This function takes an OpenAPI schema and generates an example from it
|
|
17
|
-
* Forked from : https://github.com/scalar/scalar/blob/main/packages/oas-utils/src/spec-getters/getExampleFromSchema.ts
|
|
18
|
-
*/
|
|
19
|
-
declare const getExampleFromSchema: (schema: Record<string, any>, options?: {
|
|
20
|
-
/**
|
|
21
|
-
* The fallback string for empty string values.
|
|
22
|
-
* @default ''
|
|
23
|
-
*/
|
|
24
|
-
emptyString?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Whether to use the XML tag names as keys
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
xml?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Whether to show read-only/write-only properties. Otherwise all properties are shown.
|
|
32
|
-
* @default undefined
|
|
33
|
-
*/
|
|
34
|
-
mode?: "read" | "write";
|
|
35
|
-
/**
|
|
36
|
-
* Dynamic values to add to the example.
|
|
37
|
-
*/
|
|
38
|
-
variables?: Record<string, any>;
|
|
39
|
-
/**
|
|
40
|
-
* Whether to omit empty and optional properties.
|
|
41
|
-
* @default false
|
|
42
|
-
*/
|
|
43
|
-
omitEmptyAndOptionalProperties?: boolean;
|
|
44
|
-
}, level?: number, parentSchema?: Record<string, any>, name?: string, resultCache?: WeakMap<Record<string, any>, any>) => any;
|
|
45
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { OpenAPIV3 } from '@gitbook/openapi-parser';
|
|
2
|
-
import type { OpenAPIClientContext } from './context';
|
|
3
|
-
export declare function getDisclosureLabel(props: {
|
|
4
|
-
schema: OpenAPIV3.SchemaObject;
|
|
5
|
-
isExpanded: boolean;
|
|
6
|
-
context: OpenAPIClientContext;
|
|
7
|
-
}): string;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
type Key = string | number;
|
|
2
|
-
type State = {
|
|
3
|
-
key: Key | null;
|
|
4
|
-
};
|
|
5
|
-
type Actions = {
|
|
6
|
-
setKey: (key: Key | null) => void;
|
|
7
|
-
};
|
|
8
|
-
export type Store = State & Actions;
|
|
9
|
-
export declare const getOrCreateStoreByKey: (storeKey: string, initialKey?: Key) => import("zustand").StoreApi<Store>;
|
|
10
|
-
export {};
|
package/dist/json2xml.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { OpenAPIV3 } from '@gitbook/openapi-parser';
|
|
2
|
-
import type { OpenAPIClientContext } from '../context';
|
|
3
|
-
export declare function OpenAPISchemaItem(props: {
|
|
4
|
-
name: string;
|
|
5
|
-
schema: OpenAPIV3.SchemaObject;
|
|
6
|
-
context: OpenAPIClientContext;
|
|
7
|
-
}): import("react").JSX.Element;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { SectionBody } from '../StaticSection';
|
|
3
|
-
import { OpenAPIDisclosure } from '../OpenAPIDisclosure';
|
|
4
|
-
import { OpenAPIRootSchema } from '../OpenAPISchemaServer';
|
|
5
|
-
import { Section } from '../StaticSection';
|
|
6
|
-
import { getDisclosureLabel } from '../getDisclosureLabel';
|
|
7
|
-
export function OpenAPISchemaItem(props) {
|
|
8
|
-
var schema = props.schema, context = props.context, name = props.name;
|
|
9
|
-
return (<OpenAPIDisclosure className="openapi-schemas-disclosure" key={name} icon={context.icons.plus} header={name} label={function (isExpanded) { return getDisclosureLabel({ schema: schema, isExpanded: isExpanded, context: context }); }}>
|
|
10
|
-
<Section className="openapi-section-schemas">
|
|
11
|
-
<SectionBody>
|
|
12
|
-
<OpenAPIRootSchema schema={schema} context={context}/>
|
|
13
|
-
</SectionBody>
|
|
14
|
-
</Section>
|
|
15
|
-
</OpenAPIDisclosure>);
|
|
16
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import clsx from 'clsx';
|
|
2
|
-
import { OpenAPIExample } from '../OpenAPIExample';
|
|
3
|
-
import { OpenAPIRootSchema } from '../OpenAPISchemaServer';
|
|
4
|
-
import { StaticSection } from '../StaticSection';
|
|
5
|
-
import { getOpenAPIClientContext, resolveOpenAPIContext, } from '../context';
|
|
6
|
-
import { t } from '../translate';
|
|
7
|
-
import { getExampleFromSchema } from '../util/example';
|
|
8
|
-
import { OpenAPISchemaItem } from './OpenAPISchemaItem';
|
|
9
|
-
/**
|
|
10
|
-
* OpenAPI Schemas component.
|
|
11
|
-
*/
|
|
12
|
-
export function OpenAPISchemas(props) {
|
|
13
|
-
var schemas = props.schemas, contextInput = props.context, grouped = props.grouped, className = props.className;
|
|
14
|
-
var firstSchema = schemas[0];
|
|
15
|
-
if (!firstSchema) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
var context = resolveOpenAPIContext(contextInput);
|
|
19
|
-
var clientContext = getOpenAPIClientContext(context);
|
|
20
|
-
// If there is only one model and we are not grouping, we show it directly.
|
|
21
|
-
if (schemas.length === 1 && !grouped) {
|
|
22
|
-
var title = "The ".concat(firstSchema.name, " object");
|
|
23
|
-
return (<div className={clsx('openapi-schemas', className)}>
|
|
24
|
-
<div className="openapi-summary" id={context.id}>
|
|
25
|
-
{context.renderHeading({
|
|
26
|
-
title: title,
|
|
27
|
-
deprecated: Boolean(firstSchema.schema.deprecated),
|
|
28
|
-
stability: firstSchema.schema['x-stability'],
|
|
29
|
-
})}
|
|
30
|
-
</div>
|
|
31
|
-
<div className="openapi-columns">
|
|
32
|
-
<div className="openapi-column-spec">
|
|
33
|
-
<StaticSection className="openapi-parameters" header={t(context.translation, 'attributes')}>
|
|
34
|
-
<OpenAPIRootSchema schema={firstSchema.schema} context={clientContext}/>
|
|
35
|
-
</StaticSection>
|
|
36
|
-
</div>
|
|
37
|
-
<div className="openapi-column-preview">
|
|
38
|
-
<div className="openapi-column-preview-body">
|
|
39
|
-
<div className="openapi-panel">
|
|
40
|
-
<h4 className="openapi-panel-heading">{title}</h4>
|
|
41
|
-
<div className="openapi-panel-body">
|
|
42
|
-
<OpenAPIExample example={getExampleFromSchema({
|
|
43
|
-
schema: firstSchema.schema,
|
|
44
|
-
})} context={context} syntax="json"/>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</div>);
|
|
51
|
-
}
|
|
52
|
-
// If there are multiple schemas, we use a disclosure group to show them all.
|
|
53
|
-
return (<div className={clsx('openapi-schemas', className)}>
|
|
54
|
-
{schemas.map(function (_a) {
|
|
55
|
-
var name = _a.name, schema = _a.schema;
|
|
56
|
-
return (<OpenAPISchemaItem key={name} name={name} context={clientContext} schema={schema}/>);
|
|
57
|
-
})}
|
|
58
|
-
</div>);
|
|
59
|
-
}
|
package/dist/schemas/index.d.ts
DELETED
package/dist/schemas/index.js
DELETED
package/dist/translate.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Translation, TranslationKey } from './translations';
|
|
3
|
-
/**
|
|
4
|
-
* Translate a string.
|
|
5
|
-
*/
|
|
6
|
-
export declare function t(translation: Translation, id: TranslationKey, ...args: React.ReactNode[]): React.ReactNode;
|
|
7
|
-
/**
|
|
8
|
-
* Version of `t` that returns a string.
|
|
9
|
-
*/
|
|
10
|
-
export declare function tString(translation: Translation, id: TranslationKey, ...args: React.ReactNode[]): string;
|
package/dist/translate.jsx
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
|
-
import React from 'react';
|
|
11
|
-
/**
|
|
12
|
-
* Translate a string.
|
|
13
|
-
*/
|
|
14
|
-
export function t(translation, id) {
|
|
15
|
-
var args = [];
|
|
16
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
17
|
-
args[_i - 2] = arguments[_i];
|
|
18
|
-
}
|
|
19
|
-
var string = translation[id];
|
|
20
|
-
if (!string) {
|
|
21
|
-
throw new Error("Translation not found for \"".concat(id, "\""));
|
|
22
|
-
}
|
|
23
|
-
// Now we are going to replace the arguments
|
|
24
|
-
// but we want to return a string as long as it's possible
|
|
25
|
-
// (eg. if there isn't any argument that is a ReactNode)
|
|
26
|
-
var parts = [];
|
|
27
|
-
var currentStringToReplace = string;
|
|
28
|
-
args.forEach(function (arg, i) {
|
|
29
|
-
if (typeof arg === 'string') {
|
|
30
|
-
currentStringToReplace = currentStringToReplace.replace("${".concat(i + 1, "}"), arg);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
var _a = currentStringToReplace.split("${".concat(i + 1, "}")), partToPush = _a[0], partToReplace = _a[1];
|
|
34
|
-
if (partToPush === undefined || partToReplace === undefined) {
|
|
35
|
-
throw new Error("Invalid translation \"".concat(id, "\""));
|
|
36
|
-
}
|
|
37
|
-
parts.push(<React.Fragment key={"string-".concat(i)}>{partToPush}</React.Fragment>);
|
|
38
|
-
parts.push(<React.Fragment key={"arg-".concat(i)}>{arg}</React.Fragment>);
|
|
39
|
-
currentStringToReplace = partToReplace;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
if (!parts.length) {
|
|
43
|
-
return currentStringToReplace;
|
|
44
|
-
}
|
|
45
|
-
return (<>
|
|
46
|
-
{parts}
|
|
47
|
-
{currentStringToReplace}
|
|
48
|
-
</>);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Version of `t` that returns a string.
|
|
52
|
-
*/
|
|
53
|
-
export function tString(translation, id) {
|
|
54
|
-
var args = [];
|
|
55
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
56
|
-
args[_i - 2] = arguments[_i];
|
|
57
|
-
}
|
|
58
|
-
var result = t.apply(void 0, __spreadArray([translation, id], args, false));
|
|
59
|
-
return reactToString(result);
|
|
60
|
-
}
|
|
61
|
-
function reactToString(el) {
|
|
62
|
-
if (typeof el === 'string' || typeof el === 'number' || typeof el === 'boolean') {
|
|
63
|
-
return "".concat(el);
|
|
64
|
-
}
|
|
65
|
-
if (el === null || el === undefined) {
|
|
66
|
-
return '';
|
|
67
|
-
}
|
|
68
|
-
if (Array.isArray(el)) {
|
|
69
|
-
return el.map(reactToString).join('');
|
|
70
|
-
}
|
|
71
|
-
if (typeof el === 'object' && 'props' in el) {
|
|
72
|
-
return el.props.children.map(reactToString).join('');
|
|
73
|
-
}
|
|
74
|
-
throw new Error("Unsupported type ".concat(typeof el));
|
|
75
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export declare const de: {
|
|
2
|
-
required: string;
|
|
3
|
-
deprecated: string;
|
|
4
|
-
deprecated_and_sunset_on: string;
|
|
5
|
-
stability_experimental: string;
|
|
6
|
-
stability_alpha: string;
|
|
7
|
-
stability_beta: string;
|
|
8
|
-
copy_to_clipboard: string;
|
|
9
|
-
copied: string;
|
|
10
|
-
no_content: string;
|
|
11
|
-
unresolved_reference: string;
|
|
12
|
-
circular_reference: string;
|
|
13
|
-
read_only: string;
|
|
14
|
-
write_only: string;
|
|
15
|
-
optional: string;
|
|
16
|
-
min: string;
|
|
17
|
-
max: string;
|
|
18
|
-
nullable: string;
|
|
19
|
-
body: string;
|
|
20
|
-
payload: string;
|
|
21
|
-
headers: string;
|
|
22
|
-
header: string;
|
|
23
|
-
authorizations: string;
|
|
24
|
-
responses: string;
|
|
25
|
-
response: string;
|
|
26
|
-
path_parameters: string;
|
|
27
|
-
query_parameters: string;
|
|
28
|
-
header_parameters: string;
|
|
29
|
-
attributes: string;
|
|
30
|
-
test_it: string;
|
|
31
|
-
information: string;
|
|
32
|
-
success: string;
|
|
33
|
-
redirect: string;
|
|
34
|
-
error: string;
|
|
35
|
-
show: string;
|
|
36
|
-
hide: string;
|
|
37
|
-
available_items: string;
|
|
38
|
-
available_scopes: string;
|
|
39
|
-
properties: string;
|
|
40
|
-
or: string;
|
|
41
|
-
and: string;
|
|
42
|
-
possible_values: string;
|
|
43
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export declare const es: {
|
|
2
|
-
required: string;
|
|
3
|
-
deprecated: string;
|
|
4
|
-
deprecated_and_sunset_on: string;
|
|
5
|
-
stability_experimental: string;
|
|
6
|
-
stability_alpha: string;
|
|
7
|
-
stability_beta: string;
|
|
8
|
-
copy_to_clipboard: string;
|
|
9
|
-
copied: string;
|
|
10
|
-
no_content: string;
|
|
11
|
-
unresolved_reference: string;
|
|
12
|
-
circular_reference: string;
|
|
13
|
-
read_only: string;
|
|
14
|
-
write_only: string;
|
|
15
|
-
optional: string;
|
|
16
|
-
min: string;
|
|
17
|
-
max: string;
|
|
18
|
-
nullable: string;
|
|
19
|
-
body: string;
|
|
20
|
-
payload: string;
|
|
21
|
-
headers: string;
|
|
22
|
-
header: string;
|
|
23
|
-
authorizations: string;
|
|
24
|
-
responses: string;
|
|
25
|
-
response: string;
|
|
26
|
-
path_parameters: string;
|
|
27
|
-
query_parameters: string;
|
|
28
|
-
header_parameters: string;
|
|
29
|
-
attributes: string;
|
|
30
|
-
test_it: string;
|
|
31
|
-
information: string;
|
|
32
|
-
success: string;
|
|
33
|
-
redirect: string;
|
|
34
|
-
error: string;
|
|
35
|
-
show: string;
|
|
36
|
-
hide: string;
|
|
37
|
-
available_items: string;
|
|
38
|
-
available_scopes: string;
|
|
39
|
-
properties: string;
|
|
40
|
-
or: string;
|
|
41
|
-
and: string;
|
|
42
|
-
possible_values: string;
|
|
43
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export declare const fr: {
|
|
2
|
-
required: string;
|
|
3
|
-
deprecated: string;
|
|
4
|
-
deprecated_and_sunset_on: string;
|
|
5
|
-
stability_experimental: string;
|
|
6
|
-
stability_alpha: string;
|
|
7
|
-
stability_beta: string;
|
|
8
|
-
copy_to_clipboard: string;
|
|
9
|
-
copied: string;
|
|
10
|
-
no_content: string;
|
|
11
|
-
unresolved_reference: string;
|
|
12
|
-
circular_reference: string;
|
|
13
|
-
read_only: string;
|
|
14
|
-
write_only: string;
|
|
15
|
-
optional: string;
|
|
16
|
-
min: string;
|
|
17
|
-
max: string;
|
|
18
|
-
nullable: string;
|
|
19
|
-
body: string;
|
|
20
|
-
payload: string;
|
|
21
|
-
headers: string;
|
|
22
|
-
header: string;
|
|
23
|
-
authorizations: string;
|
|
24
|
-
responses: string;
|
|
25
|
-
response: string;
|
|
26
|
-
path_parameters: string;
|
|
27
|
-
query_parameters: string;
|
|
28
|
-
header_parameters: string;
|
|
29
|
-
attributes: string;
|
|
30
|
-
test_it: string;
|
|
31
|
-
information: string;
|
|
32
|
-
success: string;
|
|
33
|
-
redirect: string;
|
|
34
|
-
error: string;
|
|
35
|
-
show: string;
|
|
36
|
-
hide: string;
|
|
37
|
-
available_items: string;
|
|
38
|
-
available_scopes: string;
|
|
39
|
-
properties: string;
|
|
40
|
-
or: string;
|
|
41
|
-
and: string;
|
|
42
|
-
possible_values: string;
|
|
43
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export declare const ja: {
|
|
2
|
-
required: string;
|
|
3
|
-
deprecated: string;
|
|
4
|
-
deprecated_and_sunset_on: string;
|
|
5
|
-
stability_experimental: string;
|
|
6
|
-
stability_alpha: string;
|
|
7
|
-
stability_beta: string;
|
|
8
|
-
copy_to_clipboard: string;
|
|
9
|
-
copied: string;
|
|
10
|
-
no_content: string;
|
|
11
|
-
unresolved_reference: string;
|
|
12
|
-
circular_reference: string;
|
|
13
|
-
read_only: string;
|
|
14
|
-
write_only: string;
|
|
15
|
-
optional: string;
|
|
16
|
-
min: string;
|
|
17
|
-
max: string;
|
|
18
|
-
nullable: string;
|
|
19
|
-
body: string;
|
|
20
|
-
payload: string;
|
|
21
|
-
headers: string;
|
|
22
|
-
header: string;
|
|
23
|
-
authorizations: string;
|
|
24
|
-
responses: string;
|
|
25
|
-
response: string;
|
|
26
|
-
path_parameters: string;
|
|
27
|
-
query_parameters: string;
|
|
28
|
-
header_parameters: string;
|
|
29
|
-
attributes: string;
|
|
30
|
-
test_it: string;
|
|
31
|
-
information: string;
|
|
32
|
-
success: string;
|
|
33
|
-
redirect: string;
|
|
34
|
-
error: string;
|
|
35
|
-
show: string;
|
|
36
|
-
hide: string;
|
|
37
|
-
available_items: string;
|
|
38
|
-
available_scopes: string;
|
|
39
|
-
properties: string;
|
|
40
|
-
or: string;
|
|
41
|
-
and: string;
|
|
42
|
-
possible_values: string;
|
|
43
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export declare const nl: {
|
|
2
|
-
required: string;
|
|
3
|
-
deprecated: string;
|
|
4
|
-
deprecated_and_sunset_on: string;
|
|
5
|
-
stability_experimental: string;
|
|
6
|
-
stability_alpha: string;
|
|
7
|
-
stability_beta: string;
|
|
8
|
-
copy_to_clipboard: string;
|
|
9
|
-
copied: string;
|
|
10
|
-
no_content: string;
|
|
11
|
-
unresolved_reference: string;
|
|
12
|
-
circular_reference: string;
|
|
13
|
-
read_only: string;
|
|
14
|
-
write_only: string;
|
|
15
|
-
optional: string;
|
|
16
|
-
min: string;
|
|
17
|
-
max: string;
|
|
18
|
-
nullable: string;
|
|
19
|
-
body: string;
|
|
20
|
-
payload: string;
|
|
21
|
-
headers: string;
|
|
22
|
-
header: string;
|
|
23
|
-
authorizations: string;
|
|
24
|
-
responses: string;
|
|
25
|
-
response: string;
|
|
26
|
-
path_parameters: string;
|
|
27
|
-
query_parameters: string;
|
|
28
|
-
header_parameters: string;
|
|
29
|
-
attributes: string;
|
|
30
|
-
test_it: string;
|
|
31
|
-
information: string;
|
|
32
|
-
success: string;
|
|
33
|
-
redirect: string;
|
|
34
|
-
error: string;
|
|
35
|
-
show: string;
|
|
36
|
-
hide: string;
|
|
37
|
-
available_items: string;
|
|
38
|
-
available_scopes: string;
|
|
39
|
-
properties: string;
|
|
40
|
-
or: string;
|
|
41
|
-
and: string;
|
|
42
|
-
possible_values: string;
|
|
43
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export declare const no: {
|
|
2
|
-
required: string;
|
|
3
|
-
deprecated: string;
|
|
4
|
-
deprecated_and_sunset_on: string;
|
|
5
|
-
stability_experimental: string;
|
|
6
|
-
stability_alpha: string;
|
|
7
|
-
stability_beta: string;
|
|
8
|
-
copy_to_clipboard: string;
|
|
9
|
-
copied: string;
|
|
10
|
-
no_content: string;
|
|
11
|
-
unresolved_reference: string;
|
|
12
|
-
circular_reference: string;
|
|
13
|
-
read_only: string;
|
|
14
|
-
write_only: string;
|
|
15
|
-
optional: string;
|
|
16
|
-
min: string;
|
|
17
|
-
max: string;
|
|
18
|
-
nullable: string;
|
|
19
|
-
body: string;
|
|
20
|
-
payload: string;
|
|
21
|
-
headers: string;
|
|
22
|
-
header: string;
|
|
23
|
-
authorizations: string;
|
|
24
|
-
responses: string;
|
|
25
|
-
response: string;
|
|
26
|
-
path_parameters: string;
|
|
27
|
-
query_parameters: string;
|
|
28
|
-
header_parameters: string;
|
|
29
|
-
attributes: string;
|
|
30
|
-
test_it: string;
|
|
31
|
-
information: string;
|
|
32
|
-
success: string;
|
|
33
|
-
redirect: string;
|
|
34
|
-
error: string;
|
|
35
|
-
show: string;
|
|
36
|
-
hide: string;
|
|
37
|
-
available_items: string;
|
|
38
|
-
available_scopes: string;
|
|
39
|
-
properties: string;
|
|
40
|
-
or: string;
|
|
41
|
-
and: string;
|
|
42
|
-
possible_values: string;
|
|
43
|
-
};
|