feat(js-yaml): update our main YAML parser to v4.1.0

Closes #6804
This commit is contained in:
Vladimir Gorej
2021-08-06 15:48:38 +02:00
parent 770e748f14
commit 3248428e96
5 changed files with 118 additions and 49 deletions

View File

@@ -2,7 +2,7 @@ import YAML from "js-yaml"
export const parseYamlConfig = (yaml, system) => {
try {
return YAML.safeLoad(yaml)
return YAML.load(yaml)
} catch(e) {
if (system) {
system.errActions.newThrownErr( new Error(e) )

View File

@@ -62,7 +62,7 @@ export const parseToJson = (str) => ({specActions, specSelectors, errActions}) =
try {
str = str || specStr()
errActions.clear({ source: "parser" })
json = YAML.safeLoad(str)
json = YAML.load(str)
} catch(e) {
// TODO: push error to state
console.error(e)

View File

@@ -648,7 +648,7 @@ const getYamlSampleSchema = (schema, config, contentType, exampleOverride) => {
const jsonExample = getStringifiedSampleForSchema(schema, config, contentType, exampleOverride)
let yamlString
try {
yamlString = YAML.safeDump(YAML.safeLoad(jsonExample), {
yamlString = YAML.dump(YAML.load(jsonExample), {
lineWidth: -1 // don't generate line folds
})