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

Should be able to add an attribute after expanding an array #19

Open
erikerikson opened this issue Mar 23, 2018 · 0 comments
Open

Should be able to add an attribute after expanding an array #19

erikerikson opened this issue Mar 23, 2018 · 0 comments
Labels

Comments

@erikerikson
Copy link

erikerikson commented Mar 23, 2018

Executed:

const Yawn = require('yawn-yaml/cjs')

const input = `
a:
  - b
c:
  d: e
`
const original = new Yawn(input)
const json = original.json

json.a.push('z')

json.c.f = {}
json.c.f.g = 'h'

console.log(JSON.stringify(json, null, 2))

original.json = json
console.log(original.yaml)

Expected:

{
  "a": [
    "b",
    "z"
  ],
  "c": {
    "d": "e",
    "f": {
      "g": "h"
    }
  }
}

a:
  - b
  - z
c:
  d: e
  f:
    g: h

Observed:

{
  "a": [
    "b",
    "z"
  ],
  "c": {
    "d": "e",
    "f": {
      "g": "h"
    }
  }
}

~/node_modules/yaml-js/lib/scanner.js:504
throw new exports.ScannerError(null, null, 'mapping values are not allowed here', this.get_mark());
^
mapping values are not allowed here
on line 8, column 12
at ScannerError.YAMLError [as constructor] (~/node_modules/yaml-js/lib/errors.js:70:46)
at ScannerError.MarkedYAMLError [as constructor] (~/node_modules/yaml-js/lib/errors.js:90:45)
at new ScannerError (~/node_modules/yaml-js/lib/scanner.js:23:49)
at Constructor.__dirname.Scanner.Scanner.fetch_value (~/node_modules/yaml-js/lib/scanner.js:504:19)
at Constructor.__dirname.Scanner.Scanner.fetch_more_tokens (~/node_modules/yaml-js/lib/scanner.js:214:21)
at Constructor.__dirname.Scanner.Scanner.check_token (~/node_modules/yaml-js/lib/scanner.js:115:14)
at Constructor.__dirname.Parser.Parser.parse_block_mapping_key (~/node_modules/yaml-js/lib/parser.js:421:16)
at Constructor.__dirname.Parser.Parser.check_event (~/node_modules/yaml-js/lib/parser.js:61:48)
at Constructor.__dirname.Composer.Composer.compose_mapping_node (~/node_modules/yaml-js/lib/composer.js:248:20)
at Constructor.__dirname.Composer.Composer.compose_node (~/node_modules/yaml-js/lib/composer.js:160:21)

Process finished with exit code 1
@mohsen1 mohsen1 added the bug label Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants