JSON as a Kson compilation target - #92
Merged
Merged
Conversation
In working towards adding Json as a compile target, which _never_ allows comments, it highlighted that `preserveComments` isn't really a "Core" configuration, but rather a CompileTarget-specific choice So: refactor to better reflect this and be ready for future CompileTargets
Introduce a new compilation target for JSON, allowing Kson to parse and compile to JSON format.
holodorum
force-pushed
the
json-transpiler
branch
from
April 2, 2025 23:04
344c360 to
6911392
Compare
Since Json does not support comments, we can set `preserveComments` to `false` for all instances of its CompileTarget config
Unlike for Yaml, where no official/blessed cross-platform parser exists that I know of, Kotlinx.serialization provides a cross-platform JSON parser. So, we don't need to restrict our tests' Json validation to just our JVM tests like we do with Yaml. This should just run redundant checks on each platform, but a good general goal is to write multiplatform code whenever possible, and plus: I'm very curious if this will ever fail some day exposing some surprising difference in Json parsing across our supported platforms.
Contributor
|
This is fantastic, @holodorum, thanks so much. Very excited to have this in. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the same vein as the work done in "YAML as a Kson compilation target" we now added JSON as a compilation target too.
The heart of the work is done in 34dd09e, with 625e66e performing a preparatory refactor