docusaurus-theme-openapi-docs 4.3.7 → 4.5.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/theme/ApiExplorer/ApiCodeBlock/Content/String.js +3 -3
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.d.ts +5 -1
- package/lib/theme/ApiExplorer/Authorization/slice.js +2 -2
- package/lib/theme/ApiExplorer/Body/slice.js +2 -2
- package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +3 -3
- package/lib/theme/ApiExplorer/FormFileUpload/_FormFileUpload.scss +4 -2
- package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +4 -4
- package/lib/theme/ApiExplorer/Request/index.js +27 -6
- package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +1 -1
- package/lib/theme/ApiExplorer/Request/makeRequest.js +3 -2
- package/lib/theme/ApiExplorer/Response/slice.js +2 -2
- package/lib/theme/ApiExplorer/Server/slice.js +2 -2
- package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +1 -1
- package/lib/theme/ApiExplorer/buildPostmanRequest.js +119 -46
- package/lib/theme/ApiExplorer/index.js +58 -2
- package/lib/theme/CodeSamples/_CodeSamples.scss +3 -0
- package/lib/theme/CodeSamples/index.d.ts +8 -0
- package/lib/theme/{ResponseSamples → CodeSamples}/index.js +4 -4
- package/lib/theme/ParamsItem/index.d.ts +1 -4
- package/lib/theme/ParamsItem/index.js +4 -1
- package/lib/theme/ResponseExamples/index.js +9 -9
- package/lib/theme/Schema/index.js +73 -133
- package/lib/theme/SchemaItem/index.js +34 -0
- package/lib/theme/styles.scss +1 -1
- package/lib/types.d.ts +5 -116
- package/package.json +5 -3
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx +3 -3
- package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.tsx +5 -1
- package/src/theme/ApiExplorer/Body/index.tsx +1 -2
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +3 -3
- package/src/theme/ApiExplorer/FormFileUpload/_FormFileUpload.scss +4 -2
- package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +4 -4
- package/src/theme/ApiExplorer/Request/index.tsx +28 -5
- package/src/theme/ApiExplorer/Request/makeRequest.ts +4 -3
- package/src/theme/ApiExplorer/buildPostmanRequest.ts +48 -18
- package/src/theme/ApiExplorer/index.tsx +4 -2
- package/src/theme/CodeSamples/_CodeSamples.scss +3 -0
- package/src/theme/{ResponseSamples → CodeSamples}/index.tsx +5 -10
- package/src/theme/ParamsItem/index.tsx +7 -6
- package/src/theme/ResponseExamples/index.tsx +6 -9
- package/src/theme/Schema/index.tsx +69 -96
- package/src/theme/SchemaItem/index.tsx +27 -0
- package/src/theme/styles.scss +1 -1
- package/src/types.ts +5 -115
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/theme/ResponseSamples/_ResponseSamples.scss +0 -3
- package/lib/theme/ResponseSamples/index.d.ts +0 -8
- package/src/theme/ApiExplorer/postman-collection.d.ts +0 -10
- package/src/theme/ApiExplorer/react-modal.d.ts +0 -8
- package/src/theme/ResponseSamples/_ResponseSamples.scss +0 -3
- package/src/theme-translations.d.ts +0 -9
|
@@ -65,6 +65,7 @@ export default function SchemaItem(props: Props) {
|
|
|
65
65
|
let example: string | undefined;
|
|
66
66
|
let nullable;
|
|
67
67
|
let enumDescriptions: [string, string][] = [];
|
|
68
|
+
let constValue: string | undefined;
|
|
68
69
|
|
|
69
70
|
if (schema) {
|
|
70
71
|
deprecated = schema.deprecated;
|
|
@@ -75,6 +76,7 @@ export default function SchemaItem(props: Props) {
|
|
|
75
76
|
nullable =
|
|
76
77
|
schema.nullable ||
|
|
77
78
|
(Array.isArray(schema.type) && schema.type.includes("null")); // support JSON Schema nullable
|
|
79
|
+
constValue = schema.const;
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
const renderRequired = guard(
|
|
@@ -161,6 +163,30 @@ export default function SchemaItem(props: Props) {
|
|
|
161
163
|
return undefined;
|
|
162
164
|
}
|
|
163
165
|
|
|
166
|
+
function renderConstValue() {
|
|
167
|
+
if (constValue !== undefined) {
|
|
168
|
+
if (typeof constValue === "string") {
|
|
169
|
+
return (
|
|
170
|
+
<div>
|
|
171
|
+
<strong>Constant value: </strong>
|
|
172
|
+
<span>
|
|
173
|
+
<code>{constValue}</code>
|
|
174
|
+
</span>
|
|
175
|
+
</div>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
return (
|
|
179
|
+
<div>
|
|
180
|
+
<strong>Constant value: </strong>
|
|
181
|
+
<span>
|
|
182
|
+
<code>{JSON.stringify(constValue)}</code>
|
|
183
|
+
</span>
|
|
184
|
+
</div>
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
|
|
164
190
|
const schemaContent = (
|
|
165
191
|
<div>
|
|
166
192
|
<span className="openapi-schema__container">
|
|
@@ -184,6 +210,7 @@ export default function SchemaItem(props: Props) {
|
|
|
184
210
|
{renderSchemaDescription}
|
|
185
211
|
{renderEnumDescriptions}
|
|
186
212
|
{renderQualifierMessage}
|
|
213
|
+
{renderConstValue()}
|
|
187
214
|
{renderDefaultValue()}
|
|
188
215
|
{renderExample()}
|
|
189
216
|
{collapsibleSchemaContent ?? collapsibleSchemaContent}
|
package/src/theme/styles.scss
CHANGED
package/src/types.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type { DocFrontMatter as DocusaurusDocFrontMatter } from "@docusaurus/plugin-content-docs";
|
|
9
9
|
import type { JSONSchema4, JSONSchema6, JSONSchema7 } from "json-schema";
|
|
10
10
|
|
|
11
11
|
export interface ThemeConfig {
|
|
@@ -15,10 +15,6 @@ export interface ThemeConfig {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
interface Map<T> {
|
|
19
|
-
[key: string]: T;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
18
|
export type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;
|
|
23
19
|
export type SchemaObject = Omit<
|
|
24
20
|
JSONSchema,
|
|
@@ -38,7 +34,7 @@ export type SchemaObject = Omit<
|
|
|
38
34
|
anyOf?: SchemaObject[];
|
|
39
35
|
not?: SchemaObject;
|
|
40
36
|
items?: SchemaObject;
|
|
41
|
-
properties?:
|
|
37
|
+
properties?: Record<string, SchemaObject>;
|
|
42
38
|
additionalProperties?: boolean | SchemaObject;
|
|
43
39
|
|
|
44
40
|
// OpenAPI additions
|
|
@@ -54,7 +50,7 @@ export type SchemaObject = Omit<
|
|
|
54
50
|
|
|
55
51
|
export interface DiscriminatorObject {
|
|
56
52
|
propertyName: string;
|
|
57
|
-
mapping?:
|
|
53
|
+
mapping?: Record<string, string>;
|
|
58
54
|
}
|
|
59
55
|
|
|
60
56
|
export interface XMLObject {
|
|
@@ -70,113 +66,7 @@ export interface ExternalDocumentationObject {
|
|
|
70
66
|
url: string;
|
|
71
67
|
}
|
|
72
68
|
|
|
73
|
-
export
|
|
74
|
-
author?: string;
|
|
75
|
-
/** Date can be any
|
|
76
|
-
* [parsable date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).
|
|
77
|
-
*/
|
|
78
|
-
date?: Date | string;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export type DocFrontMatter = {
|
|
82
|
-
/**
|
|
83
|
-
* The last part of the doc ID (will be refactored in the future to be the
|
|
84
|
-
* full ID instead)
|
|
85
|
-
* @see {@link DocMetadata.id}
|
|
86
|
-
*/
|
|
87
|
-
id?: string;
|
|
88
|
-
/**
|
|
89
|
-
* Will override the default title collected from h1 heading.
|
|
90
|
-
* @see {@link DocMetadata.title}
|
|
91
|
-
*/
|
|
92
|
-
title?: string;
|
|
93
|
-
/**
|
|
94
|
-
* Front matter tags, unnormalized.
|
|
95
|
-
* @see {@link DocMetadata.tags}
|
|
96
|
-
*/
|
|
97
|
-
tags?: FrontMatterTag[];
|
|
98
|
-
/**
|
|
99
|
-
* If there isn't a Markdown h1 heading (which, if there is, we don't
|
|
100
|
-
* remove), this front matter will cause the front matter title to not be
|
|
101
|
-
* displayed in the doc page.
|
|
102
|
-
*/
|
|
103
|
-
hide_title?: boolean;
|
|
104
|
-
/** Hide the TOC on the right. */
|
|
105
|
-
hide_table_of_contents?: boolean;
|
|
106
|
-
/** Used in the head meta. */
|
|
107
|
-
keywords?: string[];
|
|
108
|
-
/** Used in the head meta. Should use `assets.image` in priority. */
|
|
109
|
-
image?: string;
|
|
110
|
-
/**
|
|
111
|
-
* Will override the default excerpt.
|
|
112
|
-
* @see {@link DocMetadata.description}
|
|
113
|
-
*/
|
|
114
|
-
description?: string;
|
|
115
|
-
/**
|
|
116
|
-
* Custom slug appended after /<baseUrl>/<routeBasePath>/<versionPath>
|
|
117
|
-
* @see {@link DocMetadata.slug}
|
|
118
|
-
*/
|
|
119
|
-
slug?: string;
|
|
120
|
-
/** Customizes the sidebar label for this doc. Will default to its title. */
|
|
121
|
-
sidebar_label?: string;
|
|
122
|
-
/**
|
|
123
|
-
* Controls the position of a doc inside the generated sidebar slice when
|
|
124
|
-
* using autogenerated sidebar items.
|
|
125
|
-
*
|
|
126
|
-
* @see https://docusaurus.io/docs/sidebar#autogenerated-sidebar-metadata
|
|
127
|
-
*/
|
|
128
|
-
sidebar_position?: number;
|
|
129
|
-
/**
|
|
130
|
-
* Gives the corresponding sidebar label a special class name when using
|
|
131
|
-
* autogenerated sidebars.
|
|
132
|
-
*/
|
|
133
|
-
sidebar_class_name?: string;
|
|
134
|
-
/**
|
|
135
|
-
* Will be propagated to the final sidebars data structure. Useful if you
|
|
136
|
-
* have swizzled sidebar-related code or simply querying doc data through
|
|
137
|
-
* sidebars.
|
|
138
|
-
*/
|
|
139
|
-
sidebar_custom_props?: { [key: string]: unknown };
|
|
140
|
-
/**
|
|
141
|
-
* Changes the sidebar association of the current doc. Use `null` to make
|
|
142
|
-
* the current doc not associated to any sidebar.
|
|
143
|
-
*/
|
|
144
|
-
displayed_sidebar?: string | null;
|
|
145
|
-
/**
|
|
146
|
-
* Customizes the pagination label for this doc. Will default to the sidebar
|
|
147
|
-
* label.
|
|
148
|
-
*/
|
|
149
|
-
pagination_label?: string;
|
|
150
|
-
/** Overrides the default URL computed for this doc. */
|
|
151
|
-
custom_edit_url?: string | null;
|
|
152
|
-
/**
|
|
153
|
-
* Whether number prefix parsing is disabled on this doc.
|
|
154
|
-
* @see https://docusaurus.io/docs/sidebar#using-number-prefixes
|
|
155
|
-
*/
|
|
156
|
-
parse_number_prefixes?: boolean;
|
|
157
|
-
/**
|
|
158
|
-
* Minimum TOC heading level. Must be between 2 and 6 and lower or equal to
|
|
159
|
-
* the max value.
|
|
160
|
-
*/
|
|
161
|
-
toc_min_heading_level?: number;
|
|
162
|
-
/** Maximum TOC heading level. Must be between 2 and 6. */
|
|
163
|
-
toc_max_heading_level?: number;
|
|
164
|
-
/**
|
|
165
|
-
* The ID of the documentation you want the "Next" pagination to link to.
|
|
166
|
-
* Use `null` to disable showing "Next" for this page.
|
|
167
|
-
* @see {@link DocMetadata.next}
|
|
168
|
-
*/
|
|
169
|
-
pagination_next?: string | null;
|
|
170
|
-
/**
|
|
171
|
-
* The ID of the documentation you want the "Previous" pagination to link
|
|
172
|
-
* to. Use `null` to disable showing "Previous" for this page.
|
|
173
|
-
* @see {@link DocMetadata.prev}
|
|
174
|
-
*/
|
|
175
|
-
pagination_prev?: string | null;
|
|
176
|
-
/** Should this doc be excluded from production builds? */
|
|
177
|
-
draft?: boolean;
|
|
178
|
-
/** Allows overriding the last updated author and/or date. */
|
|
179
|
-
last_update?: FileChange;
|
|
69
|
+
export interface DocFrontMatter extends DocusaurusDocFrontMatter {
|
|
180
70
|
/** Provides OpenAPI Docs with a reference path to their respective Info Doc */
|
|
181
71
|
info_path?: string;
|
|
182
|
-
}
|
|
72
|
+
}
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/index.ts","./src/plugin-content-docs.d.ts","./src/postman-code-generators.d.ts","./src/react-magic-dropzone.d.ts","./src/theme-classic.d.ts","./src/theme-openapi.d.ts","./src/
|
|
1
|
+
{"root":["./src/index.ts","./src/plugin-content-docs.d.ts","./src/postman-code-generators.d.ts","./src/react-magic-dropzone.d.ts","./src/theme-classic.d.ts","./src/theme-openapi.d.ts","./src/types.ts","./src/markdown/createDescription.ts","./src/markdown/schema.ts","./src/markdown/utils.test.ts","./src/markdown/utils.ts","./src/theme/ApiExplorer/buildPostmanRequest.ts","./src/theme/ApiExplorer/index.tsx","./src/theme/ApiExplorer/persistanceMiddleware.ts","./src/theme/ApiExplorer/storage-utils.ts","./src/theme/ApiExplorer/Accept/index.tsx","./src/theme/ApiExplorer/Accept/slice.ts","./src/theme/ApiExplorer/ApiCodeBlock/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Content/Element.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx","./src/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.tsx","./src/theme/ApiExplorer/Authorization/auth-types.ts","./src/theme/ApiExplorer/Authorization/index.tsx","./src/theme/ApiExplorer/Authorization/slice.ts","./src/theme/ApiExplorer/Body/index.tsx","./src/theme/ApiExplorer/Body/slice.ts","./src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts","./src/theme/ApiExplorer/CodeSnippets/index.tsx","./src/theme/ApiExplorer/CodeSnippets/languages.ts","./src/theme/ApiExplorer/CodeTabs/index.tsx","./src/theme/ApiExplorer/ContentType/index.tsx","./src/theme/ApiExplorer/ContentType/slice.ts","./src/theme/ApiExplorer/Export/index.tsx","./src/theme/ApiExplorer/FloatingButton/index.tsx","./src/theme/ApiExplorer/FormFileUpload/index.tsx","./src/theme/ApiExplorer/FormItem/index.tsx","./src/theme/ApiExplorer/FormMultiSelect/index.tsx","./src/theme/ApiExplorer/FormSelect/index.tsx","./src/theme/ApiExplorer/FormTextInput/index.tsx","./src/theme/ApiExplorer/LiveEditor/index.tsx","./src/theme/ApiExplorer/MethodEndpoint/index.tsx","./src/theme/ApiExplorer/ParamOptions/index.tsx","./src/theme/ApiExplorer/ParamOptions/slice.ts","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx","./src/theme/ApiExplorer/Request/index.tsx","./src/theme/ApiExplorer/Request/makeRequest.ts","./src/theme/ApiExplorer/Response/index.tsx","./src/theme/ApiExplorer/Response/slice.ts","./src/theme/ApiExplorer/SecuritySchemes/index.tsx","./src/theme/ApiExplorer/Server/index.tsx","./src/theme/ApiExplorer/Server/slice.ts","./src/theme/ApiItem/hooks.ts","./src/theme/ApiItem/index.tsx","./src/theme/ApiItem/store.ts","./src/theme/ApiItem/Layout/index.tsx","./src/theme/ApiLogo/index.tsx","./src/theme/ApiTabs/index.tsx","./src/theme/ArrayBrackets/index.tsx","./src/theme/CodeSamples/index.tsx","./src/theme/DiscriminatorTabs/index.tsx","./src/theme/MimeTabs/index.tsx","./src/theme/OperationTabs/index.tsx","./src/theme/ParamsDetails/index.tsx","./src/theme/ParamsItem/index.tsx","./src/theme/RequestSchema/index.tsx","./src/theme/ResponseExamples/index.tsx","./src/theme/ResponseHeaders/index.tsx","./src/theme/ResponseSchema/index.tsx","./src/theme/Schema/index.tsx","./src/theme/SchemaItem/index.tsx","./src/theme/SchemaTabs/index.tsx","./src/theme/SkeletonLoader/index.tsx","./src/theme/StatusCodes/index.tsx"],"version":"5.8.3"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Language } from "prism-react-renderer";
|
|
3
|
-
export interface Props {
|
|
4
|
-
readonly responseExample: string;
|
|
5
|
-
readonly language: Language;
|
|
6
|
-
}
|
|
7
|
-
declare function ResponseSamples({ responseExample, language, }: Props): React.JSX.Element;
|
|
8
|
-
export default ResponseSamples;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/* ============================================================================
|
|
2
|
-
* Copyright (c) Palo Alto Networks
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
declare module "postman-collection" {
|
|
9
|
-
export = Request.sdk;
|
|
10
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/* ============================================================================
|
|
2
|
-
* Copyright (c) Palo Alto Networks
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
declare module "react-modal";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/* ============================================================================
|
|
2
|
-
* Copyright (c) Palo Alto Networks
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
// TODO: Remove this when https://github.com/facebook/docusaurus/issues/6087 is resolved.
|
|
9
|
-
declare module "@docusaurus/theme-translations";
|