docusaurus-theme-openapi-docs 0.0.0-1109 → 0.0.0-1130

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.
Files changed (69) hide show
  1. package/lib/index.js +2 -0
  2. package/lib/theme/ApiExplorer/Accept/index.js +2 -1
  3. package/lib/theme/ApiExplorer/Authorization/index.js +12 -18
  4. package/lib/theme/ApiExplorer/Body/FormBodyItem/index.d.ts +3 -1
  5. package/lib/theme/ApiExplorer/Body/FormBodyItem/index.js +61 -29
  6. package/lib/theme/ApiExplorer/Body/index.js +4 -6
  7. package/lib/theme/ApiExplorer/ContentType/index.js +2 -1
  8. package/lib/theme/ApiExplorer/FormItem/_FormItem.scss +0 -5
  9. package/lib/theme/ApiExplorer/FormItem/index.d.ts +1 -4
  10. package/lib/theme/ApiExplorer/FormItem/index.js +2 -26
  11. package/lib/theme/ApiExplorer/FormLabel/_FormLabel.scss +4 -0
  12. package/lib/theme/ApiExplorer/FormLabel/index.d.ts +9 -0
  13. package/lib/theme/ApiExplorer/FormLabel/index.js +50 -0
  14. package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +4 -1
  15. package/lib/theme/ApiExplorer/FormMultiSelect/index.js +97 -19
  16. package/lib/theme/ApiExplorer/FormSelect/index.d.ts +6 -1
  17. package/lib/theme/ApiExplorer/FormSelect/index.js +96 -15
  18. package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +4 -1
  19. package/lib/theme/ApiExplorer/FormTextInput/index.js +71 -1
  20. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +4 -1
  21. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +11 -3
  22. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +4 -1
  23. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +4 -1
  24. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +4 -1
  25. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +4 -1
  26. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +4 -1
  27. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +4 -1
  28. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +4 -1
  29. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +4 -1
  30. package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +0 -9
  31. package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +5 -0
  32. package/lib/theme/ApiExplorer/ParamOptions/index.js +27 -3
  33. package/lib/theme/ApiExplorer/Request/_Request.scss +11 -0
  34. package/lib/theme/ApiExplorer/Request/index.js +9 -3
  35. package/lib/theme/ApiExplorer/Response/_Response.scss +11 -0
  36. package/lib/theme/ApiExplorer/Response/index.js +2 -1
  37. package/lib/theme/ApiExplorer/Server/index.d.ts +4 -1
  38. package/lib/theme/ApiExplorer/Server/index.js +6 -3
  39. package/lib/theme/Schema/index.js +83 -7
  40. package/lib/theme/styles.scss +1 -0
  41. package/package.json +4 -3
  42. package/src/index.ts +2 -0
  43. package/src/theme/ApiExplorer/Accept/index.tsx +2 -1
  44. package/src/theme/ApiExplorer/Authorization/index.tsx +27 -33
  45. package/src/theme/ApiExplorer/Body/FormBodyItem/index.tsx +44 -26
  46. package/src/theme/ApiExplorer/Body/index.tsx +7 -8
  47. package/src/theme/ApiExplorer/ContentType/index.tsx +2 -1
  48. package/src/theme/ApiExplorer/FormItem/_FormItem.scss +0 -5
  49. package/src/theme/ApiExplorer/FormItem/index.tsx +2 -16
  50. package/src/theme/ApiExplorer/FormLabel/_FormLabel.scss +4 -0
  51. package/src/theme/ApiExplorer/FormLabel/index.tsx +43 -0
  52. package/src/theme/ApiExplorer/FormMultiSelect/index.tsx +40 -20
  53. package/src/theme/ApiExplorer/FormSelect/index.tsx +41 -15
  54. package/src/theme/ApiExplorer/FormTextInput/index.tsx +15 -1
  55. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +13 -2
  56. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +12 -1
  57. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +12 -1
  58. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +12 -1
  59. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +12 -1
  60. package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +0 -9
  61. package/src/theme/ApiExplorer/ParamOptions/index.tsx +65 -9
  62. package/src/theme/ApiExplorer/Request/_Request.scss +11 -0
  63. package/src/theme/ApiExplorer/Request/index.tsx +11 -6
  64. package/src/theme/ApiExplorer/Response/_Response.scss +11 -0
  65. package/src/theme/ApiExplorer/Response/index.tsx +3 -2
  66. package/src/theme/ApiExplorer/Server/index.tsx +10 -3
  67. package/src/theme/Schema/index.tsx +97 -7
  68. package/src/theme/styles.scss +1 -0
  69. package/tsconfig.tsbuildinfo +1 -1
@@ -44,6 +44,80 @@ const mergeAllOf = (allOf: any) => {
44
44
  return mergedSchemas ?? {};
45
45
  };
46
46
 
47
+ /**
48
+ * Recursively searches for a property in a schema, including nested
49
+ * oneOf, anyOf, and allOf structures. This is needed for discriminators
50
+ * where the property definition may be in a nested schema.
51
+ */
52
+ const findProperty = (
53
+ schema: SchemaObject,
54
+ propertyName: string
55
+ ): SchemaObject | undefined => {
56
+ // Check direct properties first
57
+ if (schema.properties?.[propertyName]) {
58
+ return schema.properties[propertyName];
59
+ }
60
+
61
+ // Search in oneOf schemas
62
+ if (schema.oneOf) {
63
+ for (const subschema of schema.oneOf) {
64
+ const found = findProperty(subschema as SchemaObject, propertyName);
65
+ if (found) return found;
66
+ }
67
+ }
68
+
69
+ // Search in anyOf schemas
70
+ if (schema.anyOf) {
71
+ for (const subschema of schema.anyOf) {
72
+ const found = findProperty(subschema as SchemaObject, propertyName);
73
+ if (found) return found;
74
+ }
75
+ }
76
+
77
+ // Search in allOf schemas
78
+ if (schema.allOf) {
79
+ for (const subschema of schema.allOf) {
80
+ const found = findProperty(subschema as SchemaObject, propertyName);
81
+ if (found) return found;
82
+ }
83
+ }
84
+
85
+ return undefined;
86
+ };
87
+
88
+ /**
89
+ * Recursively searches for a discriminator in a schema, including nested
90
+ * oneOf, anyOf, and allOf structures.
91
+ */
92
+ const findDiscriminator = (schema: SchemaObject): any | undefined => {
93
+ if (schema.discriminator) {
94
+ return schema.discriminator;
95
+ }
96
+
97
+ if (schema.oneOf) {
98
+ for (const subschema of schema.oneOf) {
99
+ const found = findDiscriminator(subschema as SchemaObject);
100
+ if (found) return found;
101
+ }
102
+ }
103
+
104
+ if (schema.anyOf) {
105
+ for (const subschema of schema.anyOf) {
106
+ const found = findDiscriminator(subschema as SchemaObject);
107
+ if (found) return found;
108
+ }
109
+ }
110
+
111
+ if (schema.allOf) {
112
+ for (const subschema of schema.allOf) {
113
+ const found = findDiscriminator(subschema as SchemaObject);
114
+ if (found) return found;
115
+ }
116
+ }
117
+
118
+ return undefined;
119
+ };
120
+
47
121
  interface MarkdownProps {
48
122
  text: string | undefined;
49
123
  }
@@ -313,6 +387,11 @@ const Properties: React.FC<SchemaProps> = ({
313
387
  discriminator["mapping"] = inferredMapping;
314
388
  }
315
389
  if (Object.keys(schema.properties as {}).length === 0) {
390
+ // Hide placeholder only for discriminator cleanup artifacts; preserve
391
+ // empty object rendering for schemas that intentionally define no properties.
392
+ if (discriminator) {
393
+ return null;
394
+ }
316
395
  return (
317
396
  <SchemaItem
318
397
  collapsible={false}
@@ -442,10 +521,9 @@ const DiscriminatorNode: React.FC<DiscriminatorNodeProps> = ({
442
521
  let discriminatedSchemas: any = {};
443
522
  let inferredMapping: any = {};
444
523
 
445
- // default to empty object if no parent-level properties exist
446
- const discriminatorProperty = schema.properties
447
- ? schema.properties![discriminator.propertyName]
448
- : {};
524
+ // Search for the discriminator property in the schema, including nested structures
525
+ const discriminatorProperty =
526
+ findProperty(schema, discriminator.propertyName) ?? {};
449
527
 
450
528
  if (schema.allOf) {
451
529
  const mergedSchemas = mergeAllOf(schema) as SchemaObject;
@@ -997,12 +1075,24 @@ const SchemaNode: React.FC<SchemaProps> = ({
997
1075
  return null;
998
1076
  }
999
1077
 
1000
- if (schema.discriminator) {
1001
- const { discriminator } = schema;
1078
+ // Resolve discriminator recursively so nested oneOf/anyOf/allOf compositions
1079
+ // can still render discriminator tabs.
1080
+ let workingSchema = schema;
1081
+ const resolvedDiscriminator =
1082
+ schema.discriminator ?? findDiscriminator(schema);
1083
+ if (schema.allOf && !schema.discriminator && resolvedDiscriminator) {
1084
+ workingSchema = mergeAllOf(schema) as SchemaObject;
1085
+ }
1086
+ if (!workingSchema.discriminator && resolvedDiscriminator) {
1087
+ workingSchema.discriminator = resolvedDiscriminator;
1088
+ }
1089
+
1090
+ if (workingSchema.discriminator) {
1091
+ const { discriminator } = workingSchema;
1002
1092
  return (
1003
1093
  <DiscriminatorNode
1004
1094
  discriminator={discriminator}
1005
- schema={schema}
1095
+ schema={workingSchema}
1006
1096
  schemaType={schemaType}
1007
1097
  />
1008
1098
  );
@@ -9,6 +9,7 @@
9
9
  @use "./ApiExplorer/FloatingButton/FloatingButton";
10
10
  @use "./ApiExplorer/FormFileUpload/FormFileUpload";
11
11
  @use "./ApiExplorer/FormItem/FormItem";
12
+ @use "./ApiExplorer/FormLabel/FormLabel";
12
13
  @use "./ApiExplorer/FormMultiSelect/FormMultiSelect";
13
14
  @use "./ApiExplorer/FormSelect/FormSelect";
14
15
  @use "./ApiExplorer/FormTextInput/FormTextInput";
@@ -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/types.d.ts","./src/markdown/createDescription.ts","./src/markdown/schema.ts","./src/markdown/utils.test.ts","./src/markdown/utils.ts","./src/theme/translationIds.ts","./src/theme/ApiExplorer/buildPostmanRequest.ts","./src/theme/ApiExplorer/index.tsx","./src/theme/ApiExplorer/persistenceMiddleware.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/json2xml.d.ts","./src/theme/ApiExplorer/Body/resolveSchemaWithSelections.ts","./src/theme/ApiExplorer/Body/slice.ts","./src/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.tsx","./src/theme/ApiExplorer/Body/FormBodyItem/index.tsx","./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/SchemaSelection/index.ts","./src/theme/ApiExplorer/SchemaSelection/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/Example/index.tsx","./src/theme/Markdown/index.d.ts","./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.9.3"}
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.d.ts","./src/markdown/createDescription.ts","./src/markdown/schema.ts","./src/markdown/utils.test.ts","./src/markdown/utils.ts","./src/theme/translationIds.ts","./src/theme/ApiExplorer/buildPostmanRequest.ts","./src/theme/ApiExplorer/index.tsx","./src/theme/ApiExplorer/persistenceMiddleware.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/json2xml.d.ts","./src/theme/ApiExplorer/Body/resolveSchemaWithSelections.ts","./src/theme/ApiExplorer/Body/slice.ts","./src/theme/ApiExplorer/Body/FileArrayFormBodyItem/index.tsx","./src/theme/ApiExplorer/Body/FormBodyItem/index.tsx","./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/FormLabel/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/SchemaSelection/index.ts","./src/theme/ApiExplorer/SchemaSelection/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/Example/index.tsx","./src/theme/Markdown/index.d.ts","./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.9.3"}