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

Fix YAML parsing for keys with dots and slashes #1690

Merged
merged 2 commits into from
Apr 24, 2020
Merged

Conversation

andresmgot
Copy link
Contributor

@andresmgot andresmgot commented Apr 23, 2020

Description of the change

So there are two issues when parsing a YAML that have . and /:

  • . were interpreted as objects so if the key was a.b, it was interpreted as a: {b:}
  • / is escaped as ~1 to avoid interpreting them as objects and we were not replacing that back.

I have modified our code to simply use / as the notification for objects (e.g. a.b.c -> a/b/c) which is the default for JSON patch. I have also added a step to unescape the character ~1.

Applicable issues

}

function unescapePath(path: string[]): string[] {
// jsonpath scapes slashes to not mistake then with objects so we need to revert that
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo "scapes"

@andresmgot andresmgot merged commit 9ed7320 into master Apr 24, 2020
@andresmgot andresmgot deleted the fixYamlPath branch April 24, 2020 08:15
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

Successfully merging this pull request may close these issues.

Don't need Yaml to automatically convert to json
2 participants