Skip to content

Mapping key syntax error parsed as if there is no issue #418

@shockey

Description

@shockey

js-yaml appears to be treating badly-formed mapping keys as if they're well-formed.

This was originally raised as a Swagger-Editor issue (swagger-api/swagger-editor#1740).

Example

var jsYaml = require("js-yaml")

const str = `
myObj:
  a: "something"
  b: "some other thing" c: "third thing"
`

jsYaml.safeLoad(str)

Expected result

An error, maybe something along the lines of bad indentation of a mapping entry at line 4, column 24?

Actual result

{  
  myObj:{  
    a:'something',
    b:'some other thing',
    c:'third thing'
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions