@omnigraph/openapi 0.109.7 → 0.109.9-alpha-20250521155934-2fbf68b9f412aa05247a14ac6344ef7ff6f435e8
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.
|
@@ -327,7 +327,14 @@ async function getJSONSchemaOptionsFromOpenAPIOptions(name, { source, fallbackFo
|
|
|
327
327
|
operationConfig.headers = operationConfig.headers || {};
|
|
328
328
|
operationConfig.headers.Accept = methodObj.produces.join(', ');
|
|
329
329
|
}
|
|
330
|
-
|
|
330
|
+
/**
|
|
331
|
+
* The OAS rule is that 204 responses should not specify a content key.
|
|
332
|
+
* But in the real world, it happens that some specifications present 204 responses with an
|
|
333
|
+
* empty content key.
|
|
334
|
+
*
|
|
335
|
+
* @see https://swagger.io/docs/specification/v3_0/describing-responses/#empty-response-body
|
|
336
|
+
*/
|
|
337
|
+
if ('content' in responseObj && Object.keys(responseObj.content).length !== 0) {
|
|
331
338
|
const responseObjForStatusCode = {
|
|
332
339
|
oneOf: [],
|
|
333
340
|
};
|
|
@@ -438,13 +445,13 @@ async function getJSONSchemaOptionsFromOpenAPIOptions(name, { source, fallbackFo
|
|
|
438
445
|
const xLinkObj = schemaObj.properties?.[hateOasConfig.linkObjectIdentifier]?.[hateOasConfig.linkObjectExtensionIdentifier]?.find(link => link[hateOasConfig.linkNameIdentifier] === linkName);
|
|
439
446
|
if (xLinkObj) {
|
|
440
447
|
const xLinkHref = xLinkObj[hateOasConfig.linkPathIdentifier];
|
|
441
|
-
const cleanXLinkHref = xLinkHref.replace(/{[^}]+}/g, '');
|
|
448
|
+
const cleanXLinkHref = xLinkHref.replace(/{[^}]+}/g, '{}');
|
|
442
449
|
const deferred = (0, utils_2.createDeferred)();
|
|
443
450
|
function findActualOperationAndPath(possibleName, possibleOasDoc, possibleMethodObjFieldMap) {
|
|
444
451
|
let actualOperation;
|
|
445
452
|
let actualPath;
|
|
446
453
|
for (const path in possibleOasDoc.paths) {
|
|
447
|
-
const cleanPath = path.replace(/{[^}]+}/g, '');
|
|
454
|
+
const cleanPath = path.replace(/{[^}]+}/g, '{}');
|
|
448
455
|
if (cleanPath === cleanXLinkHref) {
|
|
449
456
|
actualPath = path;
|
|
450
457
|
actualOperation = possibleOasDoc.paths[path][method];
|
|
@@ -324,7 +324,14 @@ export async function getJSONSchemaOptionsFromOpenAPIOptions(name, { source, fal
|
|
|
324
324
|
operationConfig.headers = operationConfig.headers || {};
|
|
325
325
|
operationConfig.headers.Accept = methodObj.produces.join(', ');
|
|
326
326
|
}
|
|
327
|
-
|
|
327
|
+
/**
|
|
328
|
+
* The OAS rule is that 204 responses should not specify a content key.
|
|
329
|
+
* But in the real world, it happens that some specifications present 204 responses with an
|
|
330
|
+
* empty content key.
|
|
331
|
+
*
|
|
332
|
+
* @see https://swagger.io/docs/specification/v3_0/describing-responses/#empty-response-body
|
|
333
|
+
*/
|
|
334
|
+
if ('content' in responseObj && Object.keys(responseObj.content).length !== 0) {
|
|
328
335
|
const responseObjForStatusCode = {
|
|
329
336
|
oneOf: [],
|
|
330
337
|
};
|
|
@@ -435,13 +442,13 @@ export async function getJSONSchemaOptionsFromOpenAPIOptions(name, { source, fal
|
|
|
435
442
|
const xLinkObj = schemaObj.properties?.[hateOasConfig.linkObjectIdentifier]?.[hateOasConfig.linkObjectExtensionIdentifier]?.find(link => link[hateOasConfig.linkNameIdentifier] === linkName);
|
|
436
443
|
if (xLinkObj) {
|
|
437
444
|
const xLinkHref = xLinkObj[hateOasConfig.linkPathIdentifier];
|
|
438
|
-
const cleanXLinkHref = xLinkHref.replace(/{[^}]+}/g, '');
|
|
445
|
+
const cleanXLinkHref = xLinkHref.replace(/{[^}]+}/g, '{}');
|
|
439
446
|
const deferred = createDeferred();
|
|
440
447
|
function findActualOperationAndPath(possibleName, possibleOasDoc, possibleMethodObjFieldMap) {
|
|
441
448
|
let actualOperation;
|
|
442
449
|
let actualPath;
|
|
443
450
|
for (const path in possibleOasDoc.paths) {
|
|
444
|
-
const cleanPath = path.replace(/{[^}]+}/g, '');
|
|
451
|
+
const cleanPath = path.replace(/{[^}]+}/g, '{}');
|
|
445
452
|
if (cleanPath === cleanXLinkHref) {
|
|
446
453
|
actualPath = path;
|
|
447
454
|
actualOperation = possibleOasDoc.paths[path][method];
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnigraph/openapi",
|
|
3
|
-
"version": "0.109.
|
|
3
|
+
"version": "0.109.9-alpha-20250521155934-2fbf68b9f412aa05247a14ac6344ef7ff6f435e8",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"graphql": "*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@graphql-mesh/cross-helpers": "^0.4.10",
|
|
10
|
-
"@graphql-mesh/fusion-composition": "^0.8.
|
|
10
|
+
"@graphql-mesh/fusion-composition": "^0.8.7",
|
|
11
11
|
"@graphql-mesh/string-interpolation": "^0.5.8",
|
|
12
12
|
"@graphql-mesh/types": "^0.104.3",
|
|
13
13
|
"@graphql-mesh/utils": "^0.104.3",
|