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

KLE needs a JSON schema #321

Open
Joebeazelman opened this issue Oct 24, 2022 · 3 comments
Open

KLE needs a JSON schema #321

Joebeazelman opened this issue Oct 24, 2022 · 3 comments

Comments

@Joebeazelman
Copy link

I'm trying to implement a small program to read KLE JSON files. It would be incredibly useful if a JSON schema describing the structure of the JSON objects existed. JSON schema lets you generate the boilerplate object types as code. This would make it much easier for developers to integrate with KLE. QMK has one, but I wasn't able to get anywhere with it and the layout seemed incomplete.

@ijprest
Copy link
Owner

ijprest commented Oct 25, 2022

It's not a schema, but if you want to read/parse KLE's files, check out: https://github.com/ijprest/kle-serial

@Joebeazelman
Copy link
Author

Joebeazelman commented Oct 26, 2022

Perhaps I should clarify that I am not using JS nor TypeScript. I was able to create a schema from the class definitions you provided in kle-serial. I then used it to generate a C# class for deserializing the keyboard objects. It doesn't, however, work for the raw files downloaded from the KLE site.

Fortunately, I was able to find kle-serial, which converts the files into a more readable format. The converter works almost flawlessly, but I encountered an issue where the first key only has 5 elements in the array field of the first key:

adamws/kle-serial#23 (comment)

I can't tell if the source of the issue is from the KLE source file or from the conversion tool.

It would be great if users could download the normalized json format without having to go through a conversion process. I'm contributing the jsonschema file in zip format. Please feel free to do as you like.

KLE.jsonschema.zip

@adamws
Copy link

adamws commented Dec 22, 2022

I think that this is expected, labels are split with "\n" https://github.com/ijprest/kle-serial/blob/master/index.ts#L119 (and then reordered) so you won't get constant length labels array after conversion. As far as my tool considered, I don't see an issue.

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

No branches or pull requests

3 participants