Skip to content

Path object param check fails in OpenAPI spec #4933

Closed
@hunterpetersen

Description

@hunterpetersen

Issue workflow progress

Progress of the issue based on the Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

When parsing certain OpenAPI specs, the schema options in OpenAPI/omnigraph assume all elements of a Path Item Object are API methods (i.e. GET/POST/UPDATE/DELETE) and does not account for the possibility of the summary and description fields that may be included in this group. This leads to the an attempt to parse these fields as a method and introduces breaking behavior.

To Reproduce
Steps to reproduce the behavior:

Use any OpenAPI spec json/yaml that includes additional fields in the Path Item Object, such as this:
https://github.com/PagerDuty/api-schema/blob/main/reference/REST/openapiv3.json

summary and description are allowable fields in the Path Item Object in accordance with OpenAPI standards, see docs here: https://swagger.io/specification/

Expected behavior

The library should not attempt to parse the summary and description fields as method routes and instead should ignore them.

Environment:

  • OS: macOS Monterey 12.6.1
  • @graphql-mesh/openapi:
  • NodeJS: 14.19.0

Additional context

Extending the ignore method check to also include summary and description fixes the issue:
if (method === 'parameters' || method === 'summary' || method === 'description') { continue; }

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