docusaurus-plugin-openapi-docs 0.0.0-573 → 0.0.0-574

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.
@@ -114,6 +114,19 @@ async function loadAndResolveSpec(specUrlOrObject) {
114
114
  // Force dereference ?
115
115
  // bundleOpts["dereference"] = true;
116
116
  const { bundle: { parsed }, } = await (0, openapi_core_1.bundle)(bundleOpts);
117
+ //Pre-processing before resolving JSON refs
118
+ if (parsed.components) {
119
+ for (let [component, type] of Object.entries(parsed.components)) {
120
+ if (component === "schemas") {
121
+ for (let [schemaKey, schemaValue] of Object.entries(type)) {
122
+ const title = schemaValue["title"];
123
+ if (!title) {
124
+ schemaValue.title = schemaKey;
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
117
130
  const resolved = await resolveJsonRefs(parsed);
118
131
  // Force serialization and replace circular $ref pointers
119
132
  // @ts-ignore
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-573",
4
+ "version": "0.0.0-574",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -68,5 +68,5 @@
68
68
  "engines": {
69
69
  "node": ">=14"
70
70
  },
71
- "gitHead": "a584334c8e04f672fd778d6e80836f6d5b18611a"
71
+ "gitHead": "a0e1aa8a02e04184438688baeb587e6e92df312e"
72
72
  }
@@ -128,6 +128,21 @@ export async function loadAndResolveSpec(specUrlOrObject: object | string) {
128
128
  const {
129
129
  bundle: { parsed },
130
130
  } = await bundle(bundleOpts);
131
+
132
+ //Pre-processing before resolving JSON refs
133
+ if (parsed.components) {
134
+ for (let [component, type] of Object.entries(parsed.components) as any) {
135
+ if (component === "schemas") {
136
+ for (let [schemaKey, schemaValue] of Object.entries(type) as any) {
137
+ const title: string | undefined = schemaValue["title"];
138
+ if (!title) {
139
+ schemaValue.title = schemaKey;
140
+ }
141
+ }
142
+ }
143
+ }
144
+ }
145
+
131
146
  const resolved = await resolveJsonRefs(parsed);
132
147
 
133
148
  // Force serialization and replace circular $ref pointers