@omnigraph/openapi 0.109.26-alpha-20251221001611-93ae30e23a005f16ee37a5de6c52a65af53d2ffb → 0.109.26-alpha-20251222165409-cc8cf76d99560e294732f3e191afdd001aae41eb
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.
|
@@ -68,7 +68,32 @@ async function getJSONSchemaOptionsFromOpenAPIOptions(name, { source, fallbackFo
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
(0, json_machete_1.handleUntitledDefinitions)(oasOrSwagger);
|
|
71
|
-
|
|
71
|
+
function lookByTitle(map, key) {
|
|
72
|
+
if (map != null) {
|
|
73
|
+
for (const keyInMap in map) {
|
|
74
|
+
const val = map[keyInMap];
|
|
75
|
+
if (val.title === key) {
|
|
76
|
+
return val;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function lookFromMap(map, key) {
|
|
82
|
+
if (map != null) {
|
|
83
|
+
const val = map[key];
|
|
84
|
+
if (val == null) {
|
|
85
|
+
return lookByTitle(map, key);
|
|
86
|
+
}
|
|
87
|
+
return val;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function lookFromMaps(oas, key) {
|
|
91
|
+
return (lookFromMap(oas.components?.schemas, key) ||
|
|
92
|
+
lookFromMap(oas.definitions, key));
|
|
93
|
+
}
|
|
94
|
+
for (const [_name, schema] of Object.entries(oasOrSwagger.components?.schemas ||
|
|
95
|
+
oasOrSwagger.definitions ||
|
|
96
|
+
{})) {
|
|
72
97
|
const mapping = schema.discriminator?.mapping;
|
|
73
98
|
if (mapping) {
|
|
74
99
|
for (const [key, value] of Object.entries(mapping)) {
|
|
@@ -84,7 +109,7 @@ async function getJSONSchemaOptionsFromOpenAPIOptions(name, { source, fallbackFo
|
|
|
84
109
|
continue;
|
|
85
110
|
}
|
|
86
111
|
else {
|
|
87
|
-
const schemaObj = oasOrSwagger
|
|
112
|
+
const schemaObj = lookFromMaps(oasOrSwagger, value);
|
|
88
113
|
if (!schemaObj) {
|
|
89
114
|
logger.warn(`Invalid discriminator mapping: ${value}`);
|
|
90
115
|
continue;
|
|
@@ -63,7 +63,32 @@ export async function getJSONSchemaOptionsFromOpenAPIOptions(name, { source, fal
|
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
handleUntitledDefinitions(oasOrSwagger);
|
|
66
|
-
|
|
66
|
+
function lookByTitle(map, key) {
|
|
67
|
+
if (map != null) {
|
|
68
|
+
for (const keyInMap in map) {
|
|
69
|
+
const val = map[keyInMap];
|
|
70
|
+
if (val.title === key) {
|
|
71
|
+
return val;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function lookFromMap(map, key) {
|
|
77
|
+
if (map != null) {
|
|
78
|
+
const val = map[key];
|
|
79
|
+
if (val == null) {
|
|
80
|
+
return lookByTitle(map, key);
|
|
81
|
+
}
|
|
82
|
+
return val;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function lookFromMaps(oas, key) {
|
|
86
|
+
return (lookFromMap(oas.components?.schemas, key) ||
|
|
87
|
+
lookFromMap(oas.definitions, key));
|
|
88
|
+
}
|
|
89
|
+
for (const [_name, schema] of Object.entries(oasOrSwagger.components?.schemas ||
|
|
90
|
+
oasOrSwagger.definitions ||
|
|
91
|
+
{})) {
|
|
67
92
|
const mapping = schema.discriminator?.mapping;
|
|
68
93
|
if (mapping) {
|
|
69
94
|
for (const [key, value] of Object.entries(mapping)) {
|
|
@@ -79,7 +104,7 @@ export async function getJSONSchemaOptionsFromOpenAPIOptions(name, { source, fal
|
|
|
79
104
|
continue;
|
|
80
105
|
}
|
|
81
106
|
else {
|
|
82
|
-
const schemaObj = oasOrSwagger
|
|
107
|
+
const schemaObj = lookFromMaps(oasOrSwagger, value);
|
|
83
108
|
if (!schemaObj) {
|
|
84
109
|
logger.warn(`Invalid discriminator mapping: ${value}`);
|
|
85
110
|
continue;
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnigraph/openapi",
|
|
3
|
-
"version": "0.109.26-alpha-
|
|
3
|
+
"version": "0.109.26-alpha-20251222165409-cc8cf76d99560e294732f3e191afdd001aae41eb",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"graphql": "*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@graphql-mesh/cross-helpers": "^0.4.11",
|
|
10
|
-
"@graphql-mesh/fusion-composition": "0.8.23-alpha-
|
|
10
|
+
"@graphql-mesh/fusion-composition": "0.8.23-alpha-20251222165409-cc8cf76d99560e294732f3e191afdd001aae41eb",
|
|
11
11
|
"@graphql-mesh/string-interpolation": "^0.5.9",
|
|
12
12
|
"@graphql-mesh/types": "^0.104.18",
|
|
13
13
|
"@graphql-mesh/utils": "^0.104.18",
|
|
14
14
|
"@graphql-tools/utils": "^10.11.0",
|
|
15
|
-
"@omnigraph/json-schema": "0.109.20-alpha-
|
|
15
|
+
"@omnigraph/json-schema": "0.109.20-alpha-20251222165409-cc8cf76d99560e294732f3e191afdd001aae41eb",
|
|
16
16
|
"change-case": "^4.1.2",
|
|
17
17
|
"json-machete": "^0.97.6",
|
|
18
18
|
"openapi-types": "^12.1.0",
|