Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'TypeError: Cannot read property 'parent' of null' when linting from cli #170

Closed
1 of 2 tasks
nulltoken opened this issue Apr 30, 2019 · 2 comments · Fixed by stoplightio/yaml#11
Closed
1 of 2 tasks
Assignees
Labels
released t/bug Something isn't working

Comments

@nulltoken
Copy link
Contributor

I'm submitting a...

  • bug report
  • feature request

What is the current behavior?

Given a following repro/two.yaml file

swagger: '2.0'

info:
  title: Repro two
  description: Endpoint definition
  version: "1.0.0"
  contact:
    name: toto
host: not-example.com
schemes:
  - https
basePath: /repro/two

paths:
  /quotes_requests:
    post:
      summary: Gets nothing either.
      operationId: "12"
      description: Cf. summary
      tags: [yep]
      parameters:
        - name: body
          description: Content.
          in: body
          schema:
            $ref: '#/definitions/AnotherDefinition'
      responses:
        204:
          description: Zip

definitions:
  AnotherDefinition:
    type: object
    properties:
      special:
        description:

linting from the cli returns a error.

$ yarn spectral lint ./repro/two.yaml
yarn run v1.15.2
$ C:\REDACTED\node_modules\.bin\spectral lint ./repro/two.yaml
linting ./repro/two.yaml
OpenAPI 2.0 (Swagger) detected
Encountered error when running rule 'oas2-schema' on node at path '$':
TypeError: Cannot read property 'parent' of null
No errors or warnings found!
Done in 1.01s.

Note: Providing a valued description in the very last node makes the issue disappear.

What is the expected behavior?

Either:

  • Remove the error message if it's not supposed to happen
  • Provide a more user-friendly/actionable error message (if another error is blocked from popping up by this one)

What is the motivation / use case for changing the behavior?

N/A

Please tell us about your environment:

  • Version: @stoplight/spectral/2.0.6
  • Framework: win32-x64 node-v10.14.2
  • Language: all
@nulltoken
Copy link
Contributor Author

@P0lip ❤️

@P0lip P0lip added t/bug Something isn't working released and removed released labels May 1, 2019
@P0lip
Copy link
Contributor

P0lip commented May 1, 2019

Released in 2.1.1

@tbarn tbarn added released t/bug Something isn't working and removed t/bug Something isn't working labels May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants