Skip to content

methodObj sometimes a string #4993

@philipheinser

Description

@philipheinser

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @omnigraph/[email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/@omnigraph/openapi/cjs/getJSONSchemaOptionsFromOpenAPIOptions.js b/node_modules/@omnigraph/openapi/cjs/getJSONSchemaOptionsFromOpenAPIOptions.js
index 2582e65..38b4f3b 100644
--- a/node_modules/@omnigraph/openapi/cjs/getJSONSchemaOptionsFromOpenAPIOptions.js
+++ b/node_modules/@omnigraph/openapi/cjs/getJSONSchemaOptionsFromOpenAPIOptions.js
@@ -63,6 +63,12 @@ async function getJSONSchemaOptionsFromOpenAPIOptions(name, { source, fallbackFo
                 continue;
             }
             const methodObj = pathObj[method];
+
+            if(typeof methodObj !== 'object') {
+                logger.warn(`Skipping ${method} ${relativePath} because it is not an object`);
+                continue;
+            }
+
             const operationConfig = {
                 method: method.toUpperCase(),
                 path: relativePath,

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions