API First / Keep REST API in sync between client and server
I'm looking for best practices, here's the situation:
- Backend REST API: Laravel
- Frontend: Ionic Angular
Two different teams developing each, so the first idea was to write a common OpenAPI yaml definition, and from that both projects could generate the services/controllers/routes/models/requests/responses.
So first we started with https://github.com/OpenAPITools/openapi-generator
The Laravel stub generator seemed to be the weak link, not the angular one, for a robust application it was far not suitable.
The question is, that we would still prefer to use the stub generator, any advice for using it:
- It does not generate formrequest validators with types
- The responses are skipped also, we would use JsonResource
- It generates the Controllers, but says do not modify it, re-running the stub generation overwrites everything, so how shall we use it?
After a short PoC we turned around, and tried the other way. Writing the code, then generate the common yaml, becouse the Angular guys could use nicely, the stub generator. But we could not generate any OpenAPI specs, with proper types, from the code, so the 3rd worst option was to somehow generate an Apidoc, the https://github.com/mpociot/laravel-apidoc-generator seems to handle nicely the validators, it's not having problem with Controller Service Repository layers, and generates, well let's say just enough documentation of course with manual documentation in Php side, and manual integration from Angular side.
If there's not ideal stub generator it's fine, but could someone write some best practices for summarizing the changelog of the API for a remote team? For now any API change we make, it's not trivial for the other team what has been changed and where, even we use versioning, but they still need to check for failed automated tests and manually check everything.
Please or to participate in this conversation.