docusaurus-theme-openapi-docs 4.7.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +2 -0
- package/lib/markdown/schema.js +63 -9
- package/lib/theme/ApiExplorer/Accept/index.js +2 -1
- package/lib/theme/ApiExplorer/Authorization/index.js +12 -18
- package/lib/theme/ApiExplorer/Authorization/slice.d.ts +1 -1
- package/lib/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.js +0 -4
- package/lib/theme/ApiExplorer/Body/FormBodyItem/index.d.ts +6 -2
- package/lib/theme/ApiExplorer/Body/FormBodyItem/index.js +191 -38
- package/lib/theme/ApiExplorer/Body/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/Body/index.js +86 -15
- package/lib/theme/ApiExplorer/Body/resolveSchemaWithSelections.d.ts +1 -1
- package/lib/theme/ApiExplorer/Body/slice.d.ts +136 -544
- package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +2 -1
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +4 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.js +15 -16
- package/lib/theme/ApiExplorer/ContentType/index.js +7 -2
- package/lib/theme/ApiExplorer/EncodingSelection/slice.d.ts +17 -0
- package/lib/theme/ApiExplorer/EncodingSelection/slice.js +29 -0
- package/lib/theme/ApiExplorer/EncodingSelection/useResolvedEncoding.d.ts +12 -0
- package/lib/theme/ApiExplorer/EncodingSelection/useResolvedEncoding.js +39 -0
- package/lib/theme/ApiExplorer/FormItem/_FormItem.scss +0 -5
- package/lib/theme/ApiExplorer/FormItem/index.d.ts +1 -4
- package/lib/theme/ApiExplorer/FormItem/index.js +2 -26
- package/lib/theme/ApiExplorer/FormLabel/_FormLabel.scss +4 -0
- package/lib/theme/ApiExplorer/FormLabel/index.d.ts +9 -0
- package/lib/theme/ApiExplorer/FormLabel/index.js +50 -0
- package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +4 -1
- package/lib/theme/ApiExplorer/FormMultiSelect/index.js +97 -19
- package/lib/theme/ApiExplorer/FormSelect/index.d.ts +6 -1
- package/lib/theme/ApiExplorer/FormSelect/index.js +96 -15
- package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +4 -1
- package/lib/theme/ApiExplorer/FormTextInput/index.js +71 -1
- package/lib/theme/ApiExplorer/MethodEndpoint/index.js +28 -0
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +4 -1
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +11 -3
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +4 -1
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +4 -1
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +4 -1
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +6 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +4 -1
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +6 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +4 -1
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +8 -3
- package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +0 -9
- package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +10 -0
- package/lib/theme/ApiExplorer/ParamOptions/index.js +55 -5
- package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +1 -1
- package/lib/theme/ApiExplorer/Request/_Request.scss +11 -0
- package/lib/theme/ApiExplorer/Request/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/Request/index.js +19 -5
- package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +3 -1
- package/lib/theme/ApiExplorer/Request/makeRequest.js +19 -3
- package/lib/theme/ApiExplorer/Response/_Response.scss +11 -0
- package/lib/theme/ApiExplorer/Response/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/Response/index.js +98 -12
- package/lib/theme/ApiExplorer/SecuritySchemes/index.js +2 -2
- package/lib/theme/ApiExplorer/Server/index.d.ts +4 -1
- package/lib/theme/ApiExplorer/Server/index.js +6 -3
- package/lib/theme/ApiExplorer/Server/slice.d.ts +1 -1
- package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +5 -2
- package/lib/theme/ApiExplorer/buildPostmanRequest.js +46 -5
- package/lib/theme/ApiExplorer/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/index.js +1 -0
- package/lib/theme/ApiExplorer/persistenceMiddleware.d.ts +2 -0
- package/lib/theme/ApiItem/hooks.d.ts +1 -0
- package/lib/theme/ApiItem/index.js +2 -1
- package/lib/theme/ApiItem/store.d.ts +6 -0
- package/lib/theme/ApiItem/store.js +11 -7
- package/lib/theme/ApiTabs/index.js +10 -11
- package/lib/theme/DiscriminatorTabs/index.js +10 -11
- package/lib/theme/MimeTabs/index.js +10 -11
- package/lib/theme/OperationTabs/index.js +10 -11
- package/lib/theme/ParamsDetails/index.js +2 -2
- package/lib/theme/ParamsItem/index.js +27 -0
- package/lib/theme/RequestSchema/index.d.ts +1 -1
- package/lib/theme/RequestSchema/index.js +174 -111
- package/lib/theme/ResponseHeaders/index.js +0 -1
- package/lib/theme/ResponseSchema/index.d.ts +1 -1
- package/lib/theme/Schema/index.d.ts +1 -1
- package/lib/theme/Schema/index.js +91 -23
- package/lib/theme/SchemaItem/index.js +6 -1
- package/lib/theme/SchemaTabs/index.d.ts +1 -1
- package/lib/theme/SchemaTabs/index.js +31 -12
- package/lib/theme/StatusCodes/index.d.ts +1 -1
- package/lib/theme/styles.scss +1 -0
- package/lib/theme/translationIds.d.ts +3 -0
- package/lib/theme/translationIds.js +3 -0
- package/package.json +9 -8
- package/src/index.ts +2 -0
- package/src/markdown/schema.ts +69 -13
- package/src/theme/ApiExplorer/Accept/index.tsx +2 -1
- package/src/theme/ApiExplorer/Authorization/index.tsx +27 -33
- package/src/theme/ApiExplorer/Authorization/slice.ts +1 -1
- package/src/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.tsx +2 -5
- package/src/theme/ApiExplorer/Body/FormBodyItem/index.tsx +119 -39
- package/src/theme/ApiExplorer/Body/index.tsx +88 -21
- package/src/theme/ApiExplorer/Body/resolveSchemaWithSelections.ts +1 -1
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +9 -1
- package/src/theme/ApiExplorer/CodeTabs/index.tsx +19 -19
- package/src/theme/ApiExplorer/ContentType/index.tsx +7 -4
- package/src/theme/ApiExplorer/EncodingSelection/slice.ts +31 -0
- package/src/theme/ApiExplorer/EncodingSelection/useResolvedEncoding.ts +43 -0
- package/src/theme/ApiExplorer/FormItem/_FormItem.scss +0 -5
- package/src/theme/ApiExplorer/FormItem/index.tsx +2 -17
- package/src/theme/ApiExplorer/FormLabel/_FormLabel.scss +4 -0
- package/src/theme/ApiExplorer/FormLabel/index.tsx +43 -0
- package/src/theme/ApiExplorer/FormMultiSelect/index.tsx +40 -20
- package/src/theme/ApiExplorer/FormSelect/index.tsx +41 -15
- package/src/theme/ApiExplorer/FormTextInput/index.tsx +15 -1
- package/src/theme/ApiExplorer/MethodEndpoint/index.tsx +21 -0
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +13 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +12 -1
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +14 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +14 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +16 -3
- package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +0 -9
- package/src/theme/ApiExplorer/ParamOptions/index.tsx +97 -11
- package/src/theme/ApiExplorer/ParamOptions/slice.ts +1 -1
- package/src/theme/ApiExplorer/Request/_Request.scss +11 -0
- package/src/theme/ApiExplorer/Request/index.tsx +22 -10
- package/src/theme/ApiExplorer/Request/makeRequest.ts +19 -3
- package/src/theme/ApiExplorer/Response/_Response.scss +11 -0
- package/src/theme/ApiExplorer/Response/index.tsx +37 -17
- package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +2 -3
- package/src/theme/ApiExplorer/Server/index.tsx +10 -3
- package/src/theme/ApiExplorer/Server/slice.ts +1 -1
- package/src/theme/ApiExplorer/buildPostmanRequest.ts +53 -6
- package/src/theme/ApiExplorer/index.tsx +2 -1
- package/src/theme/ApiItem/index.tsx +3 -2
- package/src/theme/ApiItem/store.ts +2 -0
- package/src/theme/ApiTabs/index.tsx +14 -19
- package/src/theme/DiscriminatorTabs/index.tsx +14 -19
- package/src/theme/MimeTabs/index.tsx +15 -19
- package/src/theme/OperationTabs/index.tsx +14 -19
- package/src/theme/ParamsDetails/index.tsx +2 -3
- package/src/theme/ParamsItem/index.tsx +25 -0
- package/src/theme/RequestSchema/index.tsx +144 -87
- package/src/theme/ResponseHeaders/index.tsx +1 -2
- package/src/theme/ResponseSchema/index.tsx +1 -1
- package/src/theme/Schema/index.tsx +112 -27
- package/src/theme/SchemaItem/index.tsx +6 -1
- package/src/theme/SchemaTabs/index.tsx +42 -21
- package/src/theme/StatusCodes/index.tsx +1 -1
- package/src/theme/styles.scss +1 -0
- package/src/theme/translationIds.ts +3 -0
- package/src/theme-classic.d.ts +25 -1
- package/src/types.d.ts +15 -52
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -80,11 +80,11 @@ const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
|
80
80
|
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
81
81
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
82
82
|
const translationIds_1 = require("@theme/translationIds");
|
|
83
|
-
const createSchemaExample_1 = require("docusaurus-plugin-openapi-docs/
|
|
83
|
+
const createSchemaExample_1 = require("docusaurus-plugin-openapi-docs/lib/openapi/createSchemaExample");
|
|
84
84
|
const xml_formatter_1 = __importDefault(require("xml-formatter"));
|
|
85
|
-
const slice_1 = require("./slice");
|
|
86
85
|
const FormBodyItem_1 = __importDefault(require("./FormBodyItem"));
|
|
87
86
|
const resolveSchemaWithSelections_1 = require("./resolveSchemaWithSelections");
|
|
87
|
+
const slice_1 = require("./slice");
|
|
88
88
|
function BodyWrap({
|
|
89
89
|
requestBodyMetadata,
|
|
90
90
|
jsonRequestBodyExample,
|
|
@@ -140,6 +140,7 @@ function Body({
|
|
|
140
140
|
const rawSchema = requestBodyMetadata?.content?.[contentType]?.schema;
|
|
141
141
|
const example = requestBodyMetadata?.content?.[contentType]?.example;
|
|
142
142
|
const examples = requestBodyMetadata?.content?.[contentType]?.examples;
|
|
143
|
+
const encoding = requestBodyMetadata?.content?.[contentType]?.encoding;
|
|
143
144
|
// Resolve the schema based on user's anyOf/oneOf tab selections
|
|
144
145
|
const schema = (0, react_1.useMemo)(() => {
|
|
145
146
|
if (!rawSchema) return rawSchema;
|
|
@@ -365,22 +366,92 @@ function Body({
|
|
|
365
366
|
return react_1.default.createElement(
|
|
366
367
|
FormItem_1.default,
|
|
367
368
|
{ className: "openapi-explorer__form-item-body-container" },
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
369
|
+
react_1.default.createElement(
|
|
370
|
+
SchemaTabs_1.default,
|
|
371
|
+
{ className: "openapi-tabs__schema", lazy: true },
|
|
372
|
+
react_1.default.createElement(
|
|
373
|
+
TabItem_1.default,
|
|
371
374
|
{
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
375
|
+
label: (0, Translate_1.translate)({
|
|
376
|
+
id: translationIds_1.OPENAPI_BODY.EXAMPLE_FROM_SCHEMA,
|
|
377
|
+
message: "Example (from schema)",
|
|
378
|
+
}),
|
|
379
|
+
value: "Example (from schema)",
|
|
380
|
+
default: true,
|
|
376
381
|
},
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
382
|
+
Object.entries(schema.properties ?? {}).map(([key, val]) => {
|
|
383
|
+
return react_1.default.createElement(
|
|
384
|
+
FormItem_1.default,
|
|
385
|
+
{ key: key },
|
|
386
|
+
react_1.default.createElement(FormBodyItem_1.default, {
|
|
387
|
+
schemaObject: val,
|
|
388
|
+
id: key,
|
|
389
|
+
schema: schema,
|
|
390
|
+
exampleValue: val.example,
|
|
391
|
+
label: key,
|
|
392
|
+
required:
|
|
393
|
+
Array.isArray(schema.required) &&
|
|
394
|
+
schema.required.includes(key),
|
|
395
|
+
fieldEncoding: encoding?.[key]?.contentType,
|
|
396
|
+
})
|
|
397
|
+
);
|
|
381
398
|
})
|
|
382
|
-
)
|
|
383
|
-
|
|
399
|
+
),
|
|
400
|
+
example &&
|
|
401
|
+
// @ts-ignore
|
|
402
|
+
react_1.default.createElement(
|
|
403
|
+
TabItem_1.default,
|
|
404
|
+
{ label: "Example", value: "example" },
|
|
405
|
+
Object.entries(schema.properties ?? {}).map(
|
|
406
|
+
([schemaKey, schemaVal]) => {
|
|
407
|
+
return react_1.default.createElement(
|
|
408
|
+
FormItem_1.default,
|
|
409
|
+
{ key: schemaKey },
|
|
410
|
+
react_1.default.createElement(FormBodyItem_1.default, {
|
|
411
|
+
schemaObject: schemaVal,
|
|
412
|
+
id: schemaKey,
|
|
413
|
+
schema: schema,
|
|
414
|
+
exampleValue: example[schemaKey],
|
|
415
|
+
label: schemaKey,
|
|
416
|
+
required:
|
|
417
|
+
Array.isArray(schema.required) &&
|
|
418
|
+
schema.required.includes(schemaKey),
|
|
419
|
+
fieldEncoding: encoding?.[schemaKey]?.contentType,
|
|
420
|
+
})
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
)
|
|
424
|
+
),
|
|
425
|
+
examples &&
|
|
426
|
+
Object.entries(examples).map(([key, value]) => {
|
|
427
|
+
return (
|
|
428
|
+
// @ts-ignore
|
|
429
|
+
react_1.default.createElement(
|
|
430
|
+
TabItem_1.default,
|
|
431
|
+
{ label: key, value: key, key: key },
|
|
432
|
+
Object.entries(schema.properties ?? {}).map(
|
|
433
|
+
([schemaKey, schemaVal]) => {
|
|
434
|
+
return react_1.default.createElement(
|
|
435
|
+
FormItem_1.default,
|
|
436
|
+
{ key: schemaKey },
|
|
437
|
+
react_1.default.createElement(FormBodyItem_1.default, {
|
|
438
|
+
schemaObject: schemaVal,
|
|
439
|
+
id: schemaKey,
|
|
440
|
+
schema: schema,
|
|
441
|
+
exampleValue: value.value?.[schemaKey],
|
|
442
|
+
label: schemaKey,
|
|
443
|
+
required:
|
|
444
|
+
Array.isArray(schema.required) &&
|
|
445
|
+
schema.required.includes(schemaKey),
|
|
446
|
+
fieldEncoding: encoding?.[schemaKey]?.contentType,
|
|
447
|
+
})
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
)
|
|
451
|
+
)
|
|
452
|
+
);
|
|
453
|
+
})
|
|
454
|
+
)
|
|
384
455
|
);
|
|
385
456
|
}
|
|
386
457
|
if (exampleBody) {
|