ltwlf / json-diff-ts

A diff tool for JavaScript written in TypeScript.
MIT License
81 stars 25 forks source link

improve handling of JSON Path segments that include periods #91

Closed EdVinyard closed 1 year ago

EdVinyard commented 1 year ago

Goal

This PR attempts to improve the produced JSON paths when segments of the path include periods (.).

Context

Stoplight.io has been using json-diff-ts as a test tool, and it's been working great! Thank you!

Because we're using it on OpenAPI documents, we often see periods (.) included in either API paths (e.g., /account/settings.json), in schema names, etc. We primarily use the "flattened" changeset format, which includes a JSON Path that refers to the change. When a period is included, the paths aren't quite as we'd expect them to be.

Using the previous example of a path that includes a period described by flattenChangeset()...

I know that there are many other cases here I haven't covered, such as when the segment also includes open-square-bracket ([), but I hope this will be a minor improvement anyway. Please let me know if there's anything you'd like to see changed to incorporate this.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

EdVinyard commented 1 year ago

Is there anything I can do to either bring this proposal up to the project's standards or help to get it integrated?

EdVinyard commented 1 year ago

@ltwlf , is there anything I can do to either bring this proposal up to the project's standards or help to get it integrated?

ltwlf commented 1 year ago

@EdVinyard thanks for improving the json.diff-ts!