Skip to content

parseWithPointers undefined pointers #119

Open
@manchuwook

Description

Just putting the demo code after adding the dependency in package.json, result.pointers is undefined.

Context

import { parseWithPointers, safeParse, safeStringify } from "@stoplight/json";

const result = parseWithPointers(`{
    "hello": "world",
    "address": {
      "street": 123
    }
  }`);

console.log(result.data);
console.log(result.pointers);
(node:44456) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
{ hello: 'world', address: { street: 123 } }
undefined

Current Behavior

It gives undefined

Expected Behavior

It should have a source map with multiple paths

Possible Workaround/Solution

Steps to Reproduce

  1. Install package @stoplight/json
  2. Mix first example code with second example code
  3. Run node ./sample.mjs

Environment

{ //... other settings
  "dependencies": {
    "@apidevtools/swagger-parser": "^10.1.0",
    "@openapi-contrib/json-schema-to-openapi-schema": "^2.2.4",
    "@openapitools/openapi-generator-cli": "^2.5.2",
    "@stoplight/json": "^3.20.1",
    "@stoplight/json-schema-merge-allof": "^0.7.8",
    "@stoplight/json-schema-ref-parser": "^9.2.2",
    "fs-extra": "^11.1.0",
    "json-schema-merge-allof": "^0.8.1",
    "json-schema-to-jsdoc": "^1.1.0",
    "node-glob": "^1.2.0",
    "openapi-types": "^12.1.0",
    "uuid": "^9.0.0"
  },
  "devDependencies": {
    "@types/node": "^18.11.18"
  }
}

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions