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

parseWithPointers undefined pointers #119

Open
manchuwook opened this issue Jan 25, 2023 · 0 comments
Open

parseWithPointers undefined pointers #119

manchuwook opened this issue Jan 25, 2023 · 0 comments

Comments

@manchuwook
Copy link

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"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant