Skip to content

Clearer JSON API #5278

@paul-fornage

Description

@paul-fornage

Is your feature request related to a problem? Please describe.
I am writing a WLED OpenAPI spec so that interfaces can be implemented in any language, but after going back to my old rust library from the v14 era, almost everything has changed.

The spec would also allow for auto-generated documentation, as the docs are massively incomplete and out of date.

Describe the solution you'd like
This is more an RFC than a feature request, I could totally understand this not being the right call, but I am proposing a way to define the JSON structure in the WLED source code more clearly, instead of manually ser/deser the json object for every field.

I think having some single source of structure would make it much easier for consumer (me, I'm being selfish)

To be clear, I'm not suggesting OpenAPI generating the serialize/deserialize code, or the structure, but having some source of truth like a classic c struct that consumer can at least reference and easily diff for changes would be very useful.

It would obviously take implementing to know for sure, but I think doing it this way could also speed it up, as the keys are all known at compile time, and the JSON wouldn't have to be handled dynamically.

Describe alternatives you've considered
Coping and just doing it manually. Unfortunately I don't have the motivation to do this task (and maintain it, I have done it once before). It's not technically challenging and very tedious, and I only need the API when I'm doing specific projects.

Alternatively changes could trigger an AI workflow to update the struct based on the diff, which would definitely make it easier, or also without AI, but I assume you wouldn't want to dissuade contributors by making them write/manage docs.

Additional context
I might find some time to provide a demo PR, but I would want some hint that there is interest.

I am working on a project to use computer vision to map LEDs to a 3d pointcloud (like Matt parker's similar video) and needing to use the API for basic stuff (I have implemented DDP libraries for actual LED control in python and rust already), but trying to write robust and future proof code is hard with the current arrangement.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions