TypeError: json_1.extractPointerFromRef is not a function
See original GitHub issueDescribe the bug Rule ‘oas3-unused-components-schema’ causes an error.
To Reproduce
- Given this OpenAPI document:
openapi: 3.0.1
info:
title: Test
version: v1
description: "Description"
license:
name: None
url: https://www.google.com/legal
servers:
- description: Prism mock server
url: http://localhost:4010
tags:
- name: sessions
paths:
/sessions:
description: Desc
post:
operationId: createSession
description: Creates a new session
requestBody:
content:
application/json:
schema:
type: object
properties:
device:
description: Device information
type: string
required:
- device
responses:
'201':
description: Session has been created successfully
headers:
x-rds-context:
description: Session context data that is shared by all future requests
schema:
type: string
tags:
- sessions
components:
schemas:
ErrorItem:
$ref: https://pastebin.com/raw/8YRYeFUY
- Run this CLI command:
spectral lint openapi.yaml
- See error message:
OpenAPI 3.x detected
Encountered error when running rule 'oas3-unused-components-schema' on node at path '$,components,schemas':
TypeError: json_1.extractPointerFromRef is not a function
undefined
2:6 warning info-contact Info object should contain `contact` object.
43:15 error oas3-schema `ErrorItem` property type should be object
✖ 2 problems (1 error, 1 warning, 0 infos, 0 hints)
Expected behavior
No type errors in the output and something better than undefined
below it would be nice.
Environment:
- Library version: 5.0.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
uncaught TypeError: undefined is not a function when using ...
mymood is undefined so you are not able to do a forEach of something that doesn't exist. Try validating things and avoid null...
Read more >TypeError: response.json is not a function in JavaScript
The "response. json is not a function" error occurs when we call the json() method on an object that is not the Response...
Read more >typeof - JavaScript - MDN Web Docs - Mozilla
The typeof operator returns a string indicating the type of the operand's value.
Read more >Interacting with code — Emscripten 3.1.26-git (dev ...
EXPORTED_FUNCTIONS tells the compiler what we want to be accessible from the compiled code (everything else might be removed if it is not...
Read more >RFC 6901: JavaScript Object Notation (JSON) Pointer
Code Components extracted from this document must include Simplified BSD License text as described ... RFC 6901 JSON Pointer April 2013 Table of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@lehphyro Below the output when running the provided openapi spec against the
development
branch:Looks like the
undefined
thingie has been fixed as well (Probably by #900)No, it’s not, thanks.