3 ms·
After years of development - Now I prefer declarative approach. Specs first, generate the code from it and implement required Interfaces. One great too for tha
by wg0 2y ago
After years of development - Now I prefer declarative approach. Specs first, generate the code from it and implement required Interfaces.
One great too for that is TypeSpec[0].
This also allows thinking about the API first and ensures that what's documented is what's implemented.
[0] https://typespec.io https://typespec.io
- monsieurbanana 2y ago> Now I prefer declarative approach Doesn't most people? Until you're no longer in the happy path of whatever you use to generate code.
- wg0 2y agoNah. Has not happened.
- RainyDayTmrw 2y agoBeing able to retrofit declarations/specifications to existing code, both for maintaining backwards compatibility and reducing rework, is very valuable, though.
- lvncelot 2y agoI'm also really happy with spec first. We're using openapi-generator[1] to generate types from a yaml schema (inverting the more standard approach of generating the yaml) in our Typescript (mostly Nest.js) backends, and export those types as packages for use in our frontends. [1] https://github.com/OpenAPITools/openapi-generator https://github.com/OpenAPITools/openapi-generator