News for hackers. Stuff that matters.
Re:AsyncAPI vs. OpenAPI: Answers to Your Burning Questions by dnautics on Thursday September 09, 2021 @12:38PM (#28471598)
let me give an example of how I wanted to use this. For fun I was working on the backend for Dogehouse (open source clubhouse clone) for a while, and for whatever reason the creator wanted the entire API to go over websockets. Ok, well, sounds like a fun thing to play around with [0]. Maintaining API consistency between the FE and BE was... very challenging, because there was very little discipline in the FE, because it was mostly into/junior programmers with not a lot of experience with API change management and feature discipline, testing, etc. So I really wanted to use AsyncAPI to create a contract between the FE and BE to be able to enforce that discipline - by auto-generating validators that get injected into the code and raise hell if invalid content is pushed by either FE or BE.

It wasn't really ready for that yet at the time, but I think over time AsyncAPI will be the way to go.

[0] in retrospect probably would have been better as a normal MVC app with only the chat and audio parts over ws, but... Again, not my project.

Re:AsyncAPI vs. OpenAPI: Answers to Your Burning Questions by panabee on Thursday September 09, 2021 @03:27PM (#28473627)
would you mind sharing what you mean by auto-generated validators that get injected into the code?
Re:AsyncAPI vs. OpenAPI: Answers to Your Burning Questions by dnautics on Thursday September 09, 2021 @06:42PM (#28475540)
I'll be open sourcing one I'm building for openApi at work in a few months, in the meantime, I have compile-time generated jsonschema validators here:

https://hexdocs.pm/exonerate/Exonerate.html

In elixir parlance checking the schemas for REST (or in the case of asyncAPI, ws) transactions will happen based on a "plug" which injects the validation into the processing pipeline.

Re:AsyncAPI vs. OpenAPI: Answers to Your Burning Questions by panabee on Thursday September 09, 2021 @09:28PM (#28476765)
thanks for sharing.