Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Documents using reserved API Element names as schema ids fail parsing #508

Description

@kylef

For example:

openapi: 3.0.3
info:
  title: API
  version: v1
paths:
  '/':
    get:
      summary: Hello
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  "$ref": "#/components/schemas/member"
components:
  schemas:
    member:
      type: object
      properties:
        id:
          type: string

Where member is the element name of a member element, the parser fails on this input:

TypeError: Cannot read property 'element' of undefined
    at isParseResult (/Users/kyle/Projects/apiaryio/api-elements.js/packages/openapi3-parser/lib/predicates.js:12:42)
    at /Users/kyle/Projects/apiaryio/api-elements.js/node_modules/ramda/src/internal/_pipe.js:3:14
    at /Users/kyle/Projects/apiaryio/api-elements.js/node_modules/ramda/src/internal/_arity.js:11:19
    at _ifElse (/Users/kyle/Projects/apiaryio/api-elements.js/node_modules/ramda/src/ifElse.js:39:22)
    at f1 (/Users/kyle/Projects/apiaryio/api-elements.js/node_modules/ramda/src/internal/_curry1.js:19:17)
    at transformMember (/Users/kyle/Projects/apiaryio/api-elements.js/packages/openapi3-parser/lib/parser/parseObject.js:125:32)
    at ParseResult.<anonymous> (/Users/kyle/Projects/apiaryio/api-elements.js/node_modules/minim/lib/primitives/ArrayElement.js:323:23)
    at Array.map (<anonymous>)
    at ParseResult.map (/Users/kyle/Projects/apiaryio/api-elements.js/node_modules/minim/lib/primitives/ArrayElement.js:70:25)
    at ParseResult.fantasy-land/chain (/Users/kyle/Projects/apiaryio/api-elements.js/node_modules/minim/lib/primitives/ArrayElement.js:323:8)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingopenapi3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions