Skip to content

Api and Handler overhaul - #136

Merged
BLuedtke merged 128 commits into
masterfrom
api-and-handler-overhaul
Sep 25, 2025
Merged

Api and Handler overhaul#136
BLuedtke merged 128 commits into
masterfrom
api-and-handler-overhaul

Conversation

@BLuedtke

@BLuedtke BLuedtke commented Sep 1, 2025

Copy link
Copy Markdown
Collaborator

Closes #128.

Alright, the big overhaul, moving to an OpenAPI-documented API with a REST-like interface, most importantly with JSON as a response format for all endpoints (2 old debug endpoints have been left as-is).

A lot of other stuff was also adjusted - some optimizations, some additional safety checks, and so on. Maybe this should have been multiple smaller PRs, but the API overhaul means we have to touch almost everything anyways.

The changes were tested with the python client and the web clients. Pretty much all "happy paths" have probably been tested, and also a few unhappy paths were we could trigger them easily.
There is however a little bit of stuff left to test in the Javascript parts, so one or two more test sessions are needed there.

Note that get_signal_details is intentionally not implemented at this point - for now its more important to get this API update out there.
Also, some new TODOs have been added; I just think the PR is getting too big already, and all the TODOs that are not trivially done or crucial to SWTbahn operation can wait.

Another note: We changed size_t to unsigned int (or similar) where easily done, because the older raspberry pi's (32bit...) have a different type defined for that than on x86-64, which makes print format specifiers annoying.

Big question is of course, how do we actually review this. It's probably/maybe too much code to do piece by piece.
Maybe we should focus on the new files added (specifically for json building and communication stuff), and how they are used.
The JS client stuff should go last, as some changes might still be required there.

@BLuedtke BLuedtke self-assigned this Sep 1, 2025
@BLuedtke BLuedtke linked an issue Sep 1, 2025 that may be closed by this pull request
@BLuedtke
BLuedtke requested a review from eyip002 September 1, 2025 15:55

@eyip002 eyip002 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good and substantial work! I'm glad so see that the responses are now in JSON. Admittedly, I did not look at every single line, but I scanned for obvious code smells. I let you do some more testing to iron out any hidden bugs before finalising the merge.

Comment thread client/swtbahn Outdated
Comment thread client/swtbahn
Comment thread client/swtbahn
Comment thread client/swtbahn
Comment thread client/swtbahn
Comment thread server/src/handler_admin.c
Comment thread server/src/handler_admin.c
Comment thread server/src/handler_controller.c Outdated
Comment thread server/src/handler_driver.c
Comment thread server/src/handler_driver.c Outdated

@eyip002 eyip002 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can merge when you are ready 👍

@BLuedtke
BLuedtke merged commit f8d467e into master Sep 25, 2025
1 check passed
@BLuedtke
BLuedtke deleted the api-and-handler-overhaul branch September 25, 2025 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API formatting

3 participants