Skip to content

Commit

Permalink
Ignore non-method fields in Path Object Item (#4934)
Browse files Browse the repository at this point in the history
* path object summary/desc fix

* fix(openapi): ignore non method objects under paths

---------

Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com>
  • Loading branch information
hunterpetersen and ardatan committed Mar 31, 2023
1 parent 870de5d commit cc754db
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/happy-melons-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@omnigraph/openapi': patch
---

Ignore non object path fields
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export async function getJSONSchemaOptionsFromOpenAPIOptions(
const pathObj = oasOrSwagger.paths[relativePath];
const pathParameters = pathObj.parameters;
for (const method in pathObj) {
if (method === 'parameters' || method === 'servers') {
if (method === 'parameters' || method === 'summary' || method === 'description' || method === 'servers') {
continue;
}
const methodObj = pathObj[method as OpenAPIV2.HttpMethods] as
Expand Down
7 changes: 7 additions & 0 deletions packages/loaders/openapi/tests/fixtures/basket.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
},
"paths": {
"/basket": {
"summary": "Get basket",
"description": "Get basket",
"servers": [
{
"url": "https://api.example.com"
}
],
"post": {
"requestBody": {
"content": {
Expand Down

0 comments on commit cc754db

Please sign in to comment.