Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!

Home Page:https://kno.wled.ge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add OpenApi support (formerly Swagger)

RobThree opened this issue · comments

It would be really cool if the json api also served a (static) swagger.json file which would make 'discovering' and more importantly implementing the API a lot simpler (automatic client generation on most plaforms and languages). It also serves as (machine readable) documentation. Adding a (also static) swagger-UI would be extra bonuspoints.

Basic steps:

  • Write the swagger.json
  • handle the /json/swagger.json request by serving the static file (I guess here somehwere)
  • (Optional) Also serve the required (static) swagger-ui files

Ofcourse, this would mean that when changes are made to the api this document needs to be kept in sync. But I do really think it would be worth the effort.

This would require some storage, naturally, but the files can be saved pre-gzipped (or brotli or whatever is hot nowadays) and served as-is (with the correct headers).

I could (help with) write the swagger.json file, but I'm not sure on the other two steps. If anyone is interested in helping or teaming up I would love to prepare a PR. But if there's no interest then I won't make all these efforts in the first place. So: is there interest?