docusaurus-plugin-openapi-docs 0.0.0-1004 → 0.0.0-1006
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/markdown/createAuthentication.js +4 -2
- package/lib/openapi/createRequestExample.js +3 -0
- package/lib/openapi/createResponseExample.js +3 -0
- package/lib/openapi/types.d.ts +4 -3
- package/package.json +2 -2
- package/src/markdown/createAuthentication.ts +12 -4
- package/src/openapi/createRequestExample.ts +4 -0
- package/src/openapi/createResponseExample.ts +4 -0
- package/src/openapi/types.ts +9 -3
|
@@ -13,7 +13,7 @@ function createAuthentication(securitySchemes) {
|
|
|
13
13
|
if (!securitySchemes || !Object.keys(securitySchemes).length)
|
|
14
14
|
return "";
|
|
15
15
|
const createAuthenticationTable = (securityScheme) => {
|
|
16
|
-
const { bearerFormat, flows, name, scheme, type, openIdConnectUrl } = securityScheme;
|
|
16
|
+
const { bearerFormat, flows, name, scheme, type, openIdConnectUrl, in: paramIn, } = securityScheme;
|
|
17
17
|
const createSecuritySchemeTypeRow = () => (0, utils_1.create)("tr", {
|
|
18
18
|
children: [
|
|
19
19
|
(0, utils_1.create)("th", { children: "Security Scheme Type:" }),
|
|
@@ -54,7 +54,9 @@ function createAuthentication(securitySchemes) {
|
|
|
54
54
|
createSecuritySchemeTypeRow(),
|
|
55
55
|
(0, utils_1.create)("tr", {
|
|
56
56
|
children: [
|
|
57
|
-
(0, utils_1.create)("th", {
|
|
57
|
+
(0, utils_1.create)("th", {
|
|
58
|
+
children: `${paramIn.charAt(0).toUpperCase() + paramIn.slice(1)} parameter name:`,
|
|
59
|
+
}),
|
|
58
60
|
(0, utils_1.create)("td", { children: name }),
|
|
59
61
|
],
|
|
60
62
|
}),
|
package/lib/openapi/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { JSONSchema4, JSONSchema6, JSONSchema7 } from "json-schema";
|
|
1
|
+
import type { JSONSchema4, JSONSchema6, JSONSchema7, JSONSchema7TypeName } from "json-schema";
|
|
2
2
|
interface Map<T> {
|
|
3
3
|
[key: string]: T;
|
|
4
4
|
}
|
|
@@ -264,8 +264,9 @@ export interface ReferenceObject {
|
|
|
264
264
|
$ref: string;
|
|
265
265
|
}
|
|
266
266
|
export type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;
|
|
267
|
+
export type SchemaType = JSONSchema7TypeName;
|
|
267
268
|
export type SchemaObject = Omit<JSONSchema, "type" | "allOf" | "oneOf" | "anyOf" | "not" | "items" | "properties" | "additionalProperties"> & {
|
|
268
|
-
type?:
|
|
269
|
+
type?: SchemaType;
|
|
269
270
|
allOf?: SchemaObject[];
|
|
270
271
|
oneOf?: SchemaObject[];
|
|
271
272
|
anyOf?: SchemaObject[];
|
|
@@ -285,7 +286,7 @@ export type SchemaObject = Omit<JSONSchema, "type" | "allOf" | "oneOf" | "anyOf"
|
|
|
285
286
|
"x-enumDescriptions"?: Record<string, string>;
|
|
286
287
|
};
|
|
287
288
|
export type SchemaObjectWithRef = Omit<JSONSchema, "type" | "allOf" | "oneOf" | "anyOf" | "not" | "items" | "properties" | "additionalProperties"> & {
|
|
288
|
-
type?:
|
|
289
|
+
type?: SchemaType;
|
|
289
290
|
allOf?: (SchemaObject | ReferenceObject)[];
|
|
290
291
|
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
291
292
|
anyOf?: (SchemaObject | ReferenceObject)[];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-plugin-openapi-docs",
|
|
3
3
|
"description": "OpenAPI plugin for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-1006",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": ">=14"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "e73c0b0cead279cb3771b546adc1caebabf336ae"
|
|
69
69
|
}
|
|
@@ -13,8 +13,15 @@ export function createAuthentication(securitySchemes: SecuritySchemeObject) {
|
|
|
13
13
|
if (!securitySchemes || !Object.keys(securitySchemes).length) return "";
|
|
14
14
|
|
|
15
15
|
const createAuthenticationTable = (securityScheme: any) => {
|
|
16
|
-
const {
|
|
17
|
-
|
|
16
|
+
const {
|
|
17
|
+
bearerFormat,
|
|
18
|
+
flows,
|
|
19
|
+
name,
|
|
20
|
+
scheme,
|
|
21
|
+
type,
|
|
22
|
+
openIdConnectUrl,
|
|
23
|
+
in: paramIn,
|
|
24
|
+
} = securityScheme;
|
|
18
25
|
|
|
19
26
|
const createSecuritySchemeTypeRow = () =>
|
|
20
27
|
create("tr", {
|
|
@@ -70,7 +77,9 @@ export function createAuthentication(securitySchemes: SecuritySchemeObject) {
|
|
|
70
77
|
createSecuritySchemeTypeRow(),
|
|
71
78
|
create("tr", {
|
|
72
79
|
children: [
|
|
73
|
-
create("th", {
|
|
80
|
+
create("th", {
|
|
81
|
+
children: `${paramIn.charAt(0).toUpperCase() + paramIn.slice(1)} parameter name:`,
|
|
82
|
+
}),
|
|
74
83
|
create("td", { children: name }),
|
|
75
84
|
],
|
|
76
85
|
}),
|
|
@@ -142,7 +151,6 @@ export function createAuthentication(securitySchemes: SecuritySchemeObject) {
|
|
|
142
151
|
return "";
|
|
143
152
|
}
|
|
144
153
|
};
|
|
145
|
-
|
|
146
154
|
const formatTabLabel = (key: string, type: string, scheme: string) => {
|
|
147
155
|
const formattedLabel = key
|
|
148
156
|
.replace(/(_|-)/g, " ")
|
|
@@ -18,6 +18,7 @@ interface OASTypeToTypeMap {
|
|
|
18
18
|
boolean: boolean;
|
|
19
19
|
object: any;
|
|
20
20
|
array: any[];
|
|
21
|
+
null: string | null;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
type Primitives = {
|
|
@@ -50,6 +51,9 @@ const primitives: Primitives = {
|
|
|
50
51
|
},
|
|
51
52
|
object: {},
|
|
52
53
|
array: {},
|
|
54
|
+
null: {
|
|
55
|
+
default: () => "null",
|
|
56
|
+
},
|
|
53
57
|
};
|
|
54
58
|
|
|
55
59
|
function sampleRequestFromProp(name: string, prop: any, obj: any): any {
|
|
@@ -18,6 +18,7 @@ interface OASTypeToTypeMap {
|
|
|
18
18
|
boolean: boolean;
|
|
19
19
|
object: any;
|
|
20
20
|
array: any[];
|
|
21
|
+
null: string | null;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
type Primitives = {
|
|
@@ -50,6 +51,9 @@ const primitives: Primitives = {
|
|
|
50
51
|
},
|
|
51
52
|
object: {},
|
|
52
53
|
array: {},
|
|
54
|
+
null: {
|
|
55
|
+
default: () => "null",
|
|
56
|
+
},
|
|
53
57
|
};
|
|
54
58
|
|
|
55
59
|
function sampleResponseFromProp(name: string, prop: any, obj: any): any {
|
package/src/openapi/types.ts
CHANGED
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type {
|
|
9
|
+
JSONSchema4,
|
|
10
|
+
JSONSchema6,
|
|
11
|
+
JSONSchema7,
|
|
12
|
+
JSONSchema7TypeName,
|
|
13
|
+
} from "json-schema";
|
|
9
14
|
|
|
10
15
|
interface Map<T> {
|
|
11
16
|
[key: string]: T;
|
|
@@ -325,6 +330,7 @@ export interface ReferenceObject {
|
|
|
325
330
|
}
|
|
326
331
|
|
|
327
332
|
export type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;
|
|
333
|
+
export type SchemaType = JSONSchema7TypeName;
|
|
328
334
|
export type SchemaObject = Omit<
|
|
329
335
|
JSONSchema,
|
|
330
336
|
| "type"
|
|
@@ -337,7 +343,7 @@ export type SchemaObject = Omit<
|
|
|
337
343
|
| "additionalProperties"
|
|
338
344
|
> & {
|
|
339
345
|
// OpenAPI specific overrides
|
|
340
|
-
type?:
|
|
346
|
+
type?: SchemaType;
|
|
341
347
|
allOf?: SchemaObject[];
|
|
342
348
|
oneOf?: SchemaObject[];
|
|
343
349
|
anyOf?: SchemaObject[];
|
|
@@ -371,7 +377,7 @@ export type SchemaObjectWithRef = Omit<
|
|
|
371
377
|
| "additionalProperties"
|
|
372
378
|
> & {
|
|
373
379
|
// OpenAPI specific overrides
|
|
374
|
-
type?:
|
|
380
|
+
type?: SchemaType;
|
|
375
381
|
allOf?: (SchemaObject | ReferenceObject)[];
|
|
376
382
|
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
377
383
|
anyOf?: (SchemaObject | ReferenceObject)[];
|