@omnigraph/openapi 0.109.26-alpha-20251225185125-05a6537d71f197f158fbc5f255cbff68616ad12f → 0.109.26-alpha-20251230130150-bf5fbd3c8b3712dd47b7bee8773cc1a5a7eee397
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.
|
@@ -311,14 +311,20 @@ async function getJSONSchemaOptionsFromOpenAPIOptions(name, { source, fallbackFo
|
|
|
311
311
|
if ('content' in requestBodyObj) {
|
|
312
312
|
// use json if available, otherwise fall back to the first type
|
|
313
313
|
const contentKeys = Object.keys(requestBodyObj.content);
|
|
314
|
-
const contentKey = contentKeys.find(contentKey => typeof contentKey === 'string' && contentKey.
|
|
314
|
+
const contentKey = contentKeys.find(contentKey => typeof contentKey === 'string' && contentKey.includes('json')) || contentKeys[0];
|
|
315
315
|
const contentSchema = requestBodyObj.content[contentKey]?.schema;
|
|
316
316
|
if (contentSchema && Object.keys(contentSchema).length > 0) {
|
|
317
317
|
operationConfig.requestSchema = contentSchema;
|
|
318
318
|
}
|
|
319
319
|
const examplesObj = requestBodyObj.content[contentKey]?.examples;
|
|
320
320
|
if (examplesObj) {
|
|
321
|
-
|
|
321
|
+
const firstItem = Object.values(examplesObj)[0];
|
|
322
|
+
if (typeof firstItem === 'object' && 'value' in firstItem) {
|
|
323
|
+
operationConfig.requestSample = firstItem.value;
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
operationConfig.requestSample = firstItem;
|
|
327
|
+
}
|
|
322
328
|
}
|
|
323
329
|
if (!operationConfig.headers?.['Content-Type'] && typeof contentKey === 'string') {
|
|
324
330
|
operationConfig.headers = operationConfig.headers || {};
|
|
@@ -306,14 +306,20 @@ export async function getJSONSchemaOptionsFromOpenAPIOptions(name, { source, fal
|
|
|
306
306
|
if ('content' in requestBodyObj) {
|
|
307
307
|
// use json if available, otherwise fall back to the first type
|
|
308
308
|
const contentKeys = Object.keys(requestBodyObj.content);
|
|
309
|
-
const contentKey = contentKeys.find(contentKey => typeof contentKey === 'string' && contentKey.
|
|
309
|
+
const contentKey = contentKeys.find(contentKey => typeof contentKey === 'string' && contentKey.includes('json')) || contentKeys[0];
|
|
310
310
|
const contentSchema = requestBodyObj.content[contentKey]?.schema;
|
|
311
311
|
if (contentSchema && Object.keys(contentSchema).length > 0) {
|
|
312
312
|
operationConfig.requestSchema = contentSchema;
|
|
313
313
|
}
|
|
314
314
|
const examplesObj = requestBodyObj.content[contentKey]?.examples;
|
|
315
315
|
if (examplesObj) {
|
|
316
|
-
|
|
316
|
+
const firstItem = Object.values(examplesObj)[0];
|
|
317
|
+
if (typeof firstItem === 'object' && 'value' in firstItem) {
|
|
318
|
+
operationConfig.requestSample = firstItem.value;
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
operationConfig.requestSample = firstItem;
|
|
322
|
+
}
|
|
317
323
|
}
|
|
318
324
|
if (!operationConfig.headers?.['Content-Type'] && typeof contentKey === 'string') {
|
|
319
325
|
operationConfig.headers = operationConfig.headers || {};
|
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-20251230130150-bf5fbd3c8b3712dd47b7bee8773cc1a5a7eee397",
|
|
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-20251230130150-bf5fbd3c8b3712dd47b7bee8773cc1a5a7eee397",
|
|
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-20251230130150-bf5fbd3c8b3712dd47b7bee8773cc1a5a7eee397",
|
|
16
16
|
"change-case": "^4.1.2",
|
|
17
17
|
"json-machete": "^0.97.6",
|
|
18
18
|
"openapi-types": "^12.1.0",
|