Skip to content
This repository has been 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

Open
kylef opened this issue Jul 4, 2020 · 0 comments
Open
Labels
bug Something isn't working openapi3

Comments

@kylef
Copy link
Member

kylef commented Jul 4, 2020

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)
@kylef kylef added bug Something isn't working openapi3 labels Jul 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working openapi3
Projects
None yet
Development

No branches or pull requests

1 participant