-
Notifications
You must be signed in to change notification settings - Fork 50
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
Non-JVM targets are not supported #232
Comments
Hi @unredundant, yep, unfortunately kaml currently only supports JVM targets. I'd love to support other targets, but that's a long way down my current list of priorities. If you (or anyone else reading this) is interested in submitting a PR, there are three possible options I see for implementing this:
Options 1 or 2 are preferable over option 3 as they would give a consistent experience across all targets. And option 1 is preferable over option 2 as it would mean less code to maintain in this library. |
Any idea how Him188/yamlkt does it? According to https://github.com/Kotlin/kotlinx.serialization/tree/master/formats#yaml-multiplatform it is YAML multiplatform but looking through their build config, I haven't found any hint of what they are using as parser on JS/Native. |
They've written their own YAML parser, but the feature set is limited. From their readme:
|
Omg, instead of contributing to this awesome project and help with writing a parser, they have written their own serializer. |
Stumbled over this, that might be a help: https://github.com/jurgc11/yakl according to the description it's a pure port of SnakeYAML (And also the classic +1 for this feature) |
Thanks for sharing @rohdef. Looks interesting but sadly also looks abandoned (there's been no changes for over two years). If nothing else, it's at least a starting point or source of inspiration. |
While https://github.com/Him188/yamlkt was created after https://github.com/charleskorn/kaml, I'd argue that In any case, it's indeed a bit unfortunate that engineering resources of people interested in YAML support for kotlinx-serialization is now divided across two projects. So, one should consider what's more effort: Adding more platforms to |
@sschuberth I partly agree. I think the best approach would be to have a pure Kotlin YAML parser and separately from that, a YAML plugin for kotlinx-serialization that uses that YAML parser.
|
This issue has been automatically marked as stale because it has not had any activity in the last 60 days. It will automatically be closed if no further activity occurs in the next seven days to enable maintainers to focus on the most important issues. |
This issue has been automatically closed because it has not had any recent activity. |
@charleskorn Can we keep this open? |
I'm considering porting snakeyaml-engine to multiplatform. Started a thread in https://kotlinlang.slack.com/archives/C7A1U5PTM/p1684498259191979?thread_ts=1684498259.191979&cid=C7A1U5PTM |
That would be really cool. I don't have much time to help out with the porting, but let me know once you've got something ready and I can give it a go in kaml. |
For those who want to follow the port, see https://github.com/krzema12/snakeyaml-engine-kmp. |
Here's a WIP integration with the multiplatform port of snakeyaml-engine #437. I need to pause working on it, but it potentially requires minimal effort to push to a mergeable state. |
kaml 0.55.0 with experimental Kotlin/JS support has just been released! Feel free to give it a spin and give feedback. |
Could we get Kotlin Native support? |
@russellbanks definitely doable, do you feel like contributing to https://github.com/krzema12/snakeyaml-engine-kmp? Should be as simple as adding more Kotlin targets, without actual source code change. CC @aSemy Edit: actually, the snakeyaml KMP port already supports some native targets, so just kaml needs an adjustment. |
K/N support is definitely possible. In principle all that's needed is to move the jsMain code that was added in #437 into commonMain. Hopefully it just works, with minimal changes. |
@charleskorn I think we can try switching kaml fully to https://github.com/krzema12/snakeyaml-engine-kmp, also for the JVM. Then it will be simple to handle virtually all possible Kotlin targets, and we'll be able to close this issue. |
Yes, I think snakeyaml-engine-kmp will work well. Some notes
|
WIP in #507 |
I have to drop working on this, sorry! Feel free to take over. |
Looking good, switching to the KMP implementation of YAML engine (#507) has been merged and released, kudos to @aSemy for picking it up! We're now waiting for feedback from the JVM consumers to ensure there was no regression, and in parallel working on introducing more targets. Starting with enabling more targets in snakeyaml-engine-kmp (krzema12/snakeyaml-engine-kmp#141). |
The main motivation for this is pushing charleskorn/kaml#232 further. I'd like this library to be truly multiplatform, and work with all targets supported by Kotlin. --------- Co-authored-by: Adam <897017+aSemy@users.noreply.github.com>
snakeyaml-engine-kmp 2.7.5 is released that supports all available Kotlin targets, apart from some unpopular ones. The next step is to make kaml build and release with these targets as well. |
Just wanted to give you all a shoutout for the awesome work! I've been using KAML on -and off for many years, and glad to see it evolve to KMP 👏 👏 I have a KMP use-case for this in OpenAPI-kt to parse Incredible work, including all the amazing work in snakeyaml-engine-kmp. 👏 👏 |
Describe the bug
Hey, TBH I'm not sure if this is a bug or just not implemented yet, I'm very new to Kotlin Multiplatform :) I'm trying to leverage Kaml to deserialize some YAML files in a MPP project, but it seems like trying to leverage Kaml in
commonMain
is not implemented yet when targeting non-JVM applications.Reproduction repo
So, this is the repo I am currently trying to convert to multiplatform https://github.com/unredundant/satisfaketion. More specifically, the
generators
module. I can't actually push the code b/c I have some (clearly too lofty) git hooks that prevent me from pushing a broken gradle build and I'm too lazy to delete them 😅 If it would really help I can temporarily remove them and push the code. But effectively, I have a gradle build file like thiswhich leads to the error posted above.
Steps to reproduce
WeepProfit?Expected behaviour
I'm not sure this is expected behavior, but it would be nice if this was supported :)
Actual behaviour
Stacktrace sadness :(
Version information
Any other information
No response
The text was updated successfully, but these errors were encountered: