docusaurus-theme-openapi-docs 0.0.0-957 → 0.0.0-959

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.
@@ -53,6 +53,7 @@ function Authorization() {
53
53
  { label: "Bearer Token", key: a.key + "-bearer" },
54
54
  react_1.default.createElement(FormTextInput_1.default, {
55
55
  placeholder: "Bearer Token",
56
+ password: true,
56
57
  value: data[a.key].token ?? "",
57
58
  onChange: (e) => {
58
59
  const value = e.target.value;
@@ -73,6 +74,7 @@ function Authorization() {
73
74
  { label: "Bearer Token", key: a.key + "-oauth2" },
74
75
  react_1.default.createElement(FormTextInput_1.default, {
75
76
  placeholder: "Bearer Token",
77
+ password: true,
76
78
  value: data[a.key].token ?? "",
77
79
  onChange: (e) => {
78
80
  const value = e.target.value;
@@ -136,6 +138,7 @@ function Authorization() {
136
138
  { label: `${a.key}`, key: a.key + "-apikey" },
137
139
  react_1.default.createElement(FormTextInput_1.default, {
138
140
  placeholder: `${a.key}`,
141
+ password: true,
139
142
  value: data[a.key].apiKey ?? "",
140
143
  onChange: (e) => {
141
144
  const value = e.target.value;
@@ -316,7 +316,10 @@ const PropertyDiscriminator = ({
316
316
  const DiscriminatorNode = ({ discriminator, schema, schemaType }) => {
317
317
  let discriminatedSchemas = {};
318
318
  let inferredMapping = {};
319
- const discriminatorProperty = schema.properties[discriminator.propertyName];
319
+ // default to empty object if no parent-level properties exist
320
+ const discriminatorProperty = schema.properties
321
+ ? schema.properties[discriminator.propertyName]
322
+ : {};
320
323
  if (schema.allOf) {
321
324
  const mergedSchemas = mergeAllOf(schema);
322
325
  if (mergedSchemas.oneOf || mergedSchemas.anyOf) {
@@ -342,15 +345,23 @@ const DiscriminatorNode = ({ discriminator, schema, schemaType }) => {
342
345
  }
343
346
  const subProperties = subSchema.properties || mergedSubSchema.properties;
344
347
  if (subProperties[discriminator.propertyName]) {
345
- schema.properties[discriminator.propertyName] = {
346
- ...schema.properties[discriminator.propertyName],
347
- ...subProperties[discriminator.propertyName],
348
- };
349
- if (subSchema.required && !schema.required) {
350
- schema.required = subSchema.required;
348
+ if (schema.properties) {
349
+ schema.properties[discriminator.propertyName] = {
350
+ ...schema.properties[discriminator.propertyName],
351
+ ...subProperties[discriminator.propertyName],
352
+ };
353
+ if (subSchema.required && !schema.required) {
354
+ schema.required = subSchema.required;
355
+ }
356
+ // Avoid duplicating property
357
+ delete subProperties[discriminator.propertyName];
358
+ } else {
359
+ schema.properties = {};
360
+ schema.properties[discriminator.propertyName] =
361
+ subProperties[discriminator.propertyName];
362
+ // Avoid duplicating property
363
+ delete subProperties[discriminator.propertyName];
351
364
  }
352
- // Avoid duplicating property
353
- delete subProperties[discriminator.propertyName];
354
365
  }
355
366
  });
356
367
  const name = discriminator.propertyName;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docusaurus-theme-openapi-docs",
3
3
  "description": "OpenAPI theme for Docusaurus.",
4
- "version": "0.0.0-957",
4
+ "version": "0.0.0-959",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -34,7 +34,7 @@
34
34
  "@types/file-saver": "^2.0.5",
35
35
  "@types/lodash": "^4.14.176",
36
36
  "concurrently": "^5.2.0",
37
- "docusaurus-plugin-openapi-docs": "0.0.0-957",
37
+ "docusaurus-plugin-openapi-docs": "0.0.0-959",
38
38
  "docusaurus-plugin-sass": "^0.2.3",
39
39
  "eslint-plugin-prettier": "^5.0.1"
40
40
  },
@@ -75,5 +75,5 @@
75
75
  "engines": {
76
76
  "node": ">=14"
77
77
  },
78
- "gitHead": "d4ac46d93a12ce4ae40663857ed0df2b1a95c0dd"
78
+ "gitHead": "3a3bd9331c6dd9a859e98613248e6772ac398df8"
79
79
  }
@@ -48,6 +48,7 @@ function Authorization() {
48
48
  <FormItem label="Bearer Token" key={a.key + "-bearer"}>
49
49
  <FormTextInput
50
50
  placeholder="Bearer Token"
51
+ password
51
52
  value={data[a.key].token ?? ""}
52
53
  onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
53
54
  const value = e.target.value;
@@ -69,6 +70,7 @@ function Authorization() {
69
70
  <FormItem label="Bearer Token" key={a.key + "-oauth2"}>
70
71
  <FormTextInput
71
72
  placeholder="Bearer Token"
73
+ password
72
74
  value={data[a.key].token ?? ""}
73
75
  onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
74
76
  const value = e.target.value;
@@ -130,6 +132,7 @@ function Authorization() {
130
132
  <FormItem label={`${a.key}`} key={a.key + "-apikey"}>
131
133
  <FormTextInput
132
134
  placeholder={`${a.key}`}
135
+ password
133
136
  value={data[a.key].apiKey ?? ""}
134
137
  onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
135
138
  const value = e.target.value;
@@ -317,7 +317,10 @@ const DiscriminatorNode: React.FC<DiscriminatorNodeProps> = ({
317
317
  let discriminatedSchemas: any = {};
318
318
  let inferredMapping: any = {};
319
319
 
320
- const discriminatorProperty = schema.properties![discriminator.propertyName];
320
+ // default to empty object if no parent-level properties exist
321
+ const discriminatorProperty = schema.properties
322
+ ? schema.properties![discriminator.propertyName]
323
+ : {};
321
324
 
322
325
  if (schema.allOf) {
323
326
  const mergedSchemas = mergeAllOf(schema) as SchemaObject;
@@ -350,21 +353,28 @@ const DiscriminatorNode: React.FC<DiscriminatorNodeProps> = ({
350
353
 
351
354
  const subProperties = subSchema.properties || mergedSubSchema.properties;
352
355
  if (subProperties[discriminator.propertyName]) {
353
- schema.properties![discriminator.propertyName] = {
354
- ...schema.properties![discriminator.propertyName],
355
- ...subProperties[discriminator.propertyName],
356
- };
357
- if (subSchema.required && !schema.required) {
358
- schema.required = subSchema.required;
356
+ if (schema.properties) {
357
+ schema.properties![discriminator.propertyName] = {
358
+ ...schema.properties![discriminator.propertyName],
359
+ ...subProperties[discriminator.propertyName],
360
+ };
361
+ if (subSchema.required && !schema.required) {
362
+ schema.required = subSchema.required;
363
+ }
364
+ // Avoid duplicating property
365
+ delete subProperties[discriminator.propertyName];
366
+ } else {
367
+ schema.properties = {};
368
+ schema.properties[discriminator.propertyName] =
369
+ subProperties[discriminator.propertyName];
370
+ // Avoid duplicating property
371
+ delete subProperties[discriminator.propertyName];
359
372
  }
360
- // Avoid duplicating property
361
- delete subProperties[discriminator.propertyName];
362
373
  }
363
374
  });
364
375
 
365
376
  const name = discriminator.propertyName;
366
377
  const schemaName = getSchemaName(discriminatorProperty);
367
-
368
378
  // Default case for discriminator without oneOf/anyOf/allOf
369
379
  return (
370
380
  <PropertyDiscriminator