Skip to content

Commit

Permalink
feat(js-yaml): update our main YAML parser to v4.1.0
Browse files Browse the repository at this point in the history
Closes #6804
  • Loading branch information
char0n committed Aug 9, 2021
1 parent 770e748 commit 3248428
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 49 deletions.
159 changes: 114 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -70,7 +70,7 @@
"ieee754": "^1.2.1",
"immutable": "^3.x.x",
"js-file-download": "^0.4.12",
"js-yaml": "^3.13.1",
"js-yaml": "=4.1.0",
"lodash": "^4.17.21",
"memoizee": "^0.4.15",
"prop-types": "^15.7.2",
Expand Down
2 changes: 1 addition & 1 deletion src/core/plugins/configs/helpers.js
Expand Up @@ -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) )
Expand Down
2 changes: 1 addition & 1 deletion src/core/plugins/spec/actions.js
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/core/utils.js
Expand Up @@ -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
})
Expand Down

0 comments on commit 3248428

Please sign in to comment.