From d14359d859226c8504f635dad0933498b8fe3c84 Mon Sep 17 00:00:00 2001 From: Hunter Petersen Date: Tue, 22 Nov 2022 10:34:14 -0800 Subject: [PATCH 1/2] path object summary/desc fix --- .../openapi/src/getJSONSchemaOptionsFromOpenAPIOptions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/loaders/openapi/src/getJSONSchemaOptionsFromOpenAPIOptions.ts b/packages/loaders/openapi/src/getJSONSchemaOptionsFromOpenAPIOptions.ts index a4cbe3dd42ff4..a00ebe53df055 100644 --- a/packages/loaders/openapi/src/getJSONSchemaOptionsFromOpenAPIOptions.ts +++ b/packages/loaders/openapi/src/getJSONSchemaOptionsFromOpenAPIOptions.ts @@ -105,7 +105,7 @@ export async function getJSONSchemaOptionsFromOpenAPIOptions( const pathObj = oasOrSwagger.paths[relativePath]; const pathParameters = pathObj.parameters; for (const method in pathObj) { - if (method === 'parameters') { + if (method === 'parameters' || method === 'summary' || method === 'description') { continue; } const methodObj = pathObj[method] as OpenAPIV2.OperationObject | OpenAPIV3.OperationObject; From 0a75faf41aed6e4d795eec74f585efa2640b8cd3 Mon Sep 17 00:00:00 2001 From: Arda TANRIKULU Date: Fri, 31 Mar 2023 08:44:14 +0300 Subject: [PATCH 2/2] fix(openapi): ignore non method objects under paths --- .changeset/happy-melons-vanish.md | 5 +++++ packages/loaders/openapi/tests/fixtures/basket.json | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 .changeset/happy-melons-vanish.md diff --git a/.changeset/happy-melons-vanish.md b/.changeset/happy-melons-vanish.md new file mode 100644 index 0000000000000..5946161ad6fdb --- /dev/null +++ b/.changeset/happy-melons-vanish.md @@ -0,0 +1,5 @@ +--- +'@omnigraph/openapi': patch +--- + +Ignore non object path fields diff --git a/packages/loaders/openapi/tests/fixtures/basket.json b/packages/loaders/openapi/tests/fixtures/basket.json index 016d88c2501f3..10f860f2a5b3b 100644 --- a/packages/loaders/openapi/tests/fixtures/basket.json +++ b/packages/loaders/openapi/tests/fixtures/basket.json @@ -6,6 +6,13 @@ }, "paths": { "/basket": { + "summary": "Get basket", + "description": "Get basket", + "servers": [ + { + "url": "https://api.example.com" + } + ], "post": { "requestBody": { "content": {