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.
@@ -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", { children: "Header parameter name:" }),
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
  }),
@@ -36,6 +36,9 @@ const primitives = {
36
36
  },
37
37
  object: {},
38
38
  array: {},
39
+ null: {
40
+ default: () => "null",
41
+ },
39
42
  };
40
43
  function sampleRequestFromProp(name, prop, obj) {
41
44
  // Handle resolved circular props
@@ -36,6 +36,9 @@ const primitives = {
36
36
  },
37
37
  object: {},
38
38
  array: {},
39
+ null: {
40
+ default: () => "null",
41
+ },
39
42
  };
40
43
  function sampleResponseFromProp(name, prop, obj) {
41
44
  // Handle resolved circular props
@@ -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?: "string" | "number" | "integer" | "boolean" | "object" | "array";
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?: "string" | "number" | "integer" | "boolean" | "object" | "array";
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-1004",
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": "6c6f8eca76a5407f7896a4141ac9d104f75a5970"
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 { bearerFormat, flows, name, scheme, type, openIdConnectUrl } =
17
- securityScheme;
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", { children: "Header parameter name:" }),
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 {
@@ -5,7 +5,12 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
- import type { JSONSchema4, JSONSchema6, JSONSchema7 } from "json-schema";
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?: "string" | "number" | "integer" | "boolean" | "object" | "array";
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?: "string" | "number" | "integer" | "boolean" | "object" | "array";
380
+ type?: SchemaType;
375
381
  allOf?: (SchemaObject | ReferenceObject)[];
376
382
  oneOf?: (SchemaObject | ReferenceObject)[];
377
383
  anyOf?: (SchemaObject | ReferenceObject)[];