Release KSON 0.2.0¶
We're excited to announce the beta release of KSON 0.2.0! The most important addition is the KsonValue to the Public API, which allows users to easily walk and analyze the AST of a KSON-document. Another new feature in this release is the classic formatting style, essentially JSON with comments. The rest of the features are fixes and improvements, all of them will be described in more detail below.
feat: KsonValue¶
Every correct KSON-document is a KsonValue; internally we have been using KsonValue's for custom validations. For example, the indent validator, schema validations, and duplicate key validations are all executed on the KsonValue.
By adding this to the public API, running your own custom validations on a KSON-document, with exact locations for each node, becomes easier.
See PR 227 for the implementation details.
feat: VS Code Improvements¶
With the exposed KsonValue we were able to enhance the Language Server. In PR 228 we've added support for DocumentSymbols and DocumentHighlighting to the LSP.
The DocumentHighlighting highlights the locations of the sibling keys, given the location of your cursor. DocumentSymbols analyzes the symbols in the document and allows for a proper analysis of the document, which results in improved collapsing and navigation.
feat: Classic Formatting Style¶
KSON is a superset of JSON. Adding the classic formatting style reinforces that idea. In classic formatting, a document is formatted as JSON with comments preserved.
It's been added to the public API and added to the different tools that format KSON-documents, see PR 229.
feat: Dogfooding KSON for CircleCI¶
Small or big, exciting either way. The first KSON-document used in a production grade codebase is our CircleCI config. Initially we created this in YAML, now it's possible to update the CI in KSON. The only caveat here is that each run we need to transpile it to YAML, since CircleCI does not accept KSON input (yet).
improvement: Indent Validation Improvements¶
The indent validator shows deceptive indenting. Since whitespace is not significant in KSON it's possible to get a document where the indentation does not properly reflect the structure. It's been introduced in PR 157, but did not capture deceptive indentation in the following document:
deceptive_object:
# deceptive indent: nested under `deceptive_object`
key: x
list: -
# deceptive indent: nested under `list: - ` list
key: x
improvement: Json Schema Error Messages¶
It's important for us to give helpful, clear and precise error messages. In PR 236 the error messages for const and anyOf sub schema's have been improved.
fix: Yaml Transpile¶
We fell for the Norway Problem. Yikes. While transpiling from KSON to YAML; special YAML values like 'no', were not quoted. See the fix in 3d1d9bb.
fix: Kson Embed Block Escaping¶
Escaping is hard. In embed blocks we escape the delimiters. So an embed block with a $-delimiter will need to either switch to a %-delimiter, or escape $$. We made a small mistake, where:
fix: KsonValue equals¶
We toyed with having a stricter equals in d05967d, by implementing dataEquals(). In practice, we had it right initially: KsonValue equals should be implemented as a logical equals based on the underlying value.
This makes a KsonValue tree much more ergonomic to work with because the values really then become values that can be compared as such.