3 ms·
On the subject of APIs, anyone knows how to split Open API 3.0 specs into separate files? I'm using swagger-cli but it is abandoned lately.
by wg0 3y ago
On the subject of APIs, anyone knows how to split Open API
3.0 specs into separate files? I'm using swagger-cli but it is abandoned lately.
- herrherrmann 3y agoYou can start writing multiple OpenAPI files and merge them with tools like openapi-merger (https://www.npmjs.com/package/openapi-merger https://www.npmjs.com/package/openapi-merger). Is that maybe what you want?
- freshteapot 3y ago* I note this is not splitting one large one into small, but the actually starting with smaller ones, as the other commenter suggested I store different api logic in their own files. Then I use yq to stitch them all together. After which, I use openapi-generator to make a yaml output. https://gist.github.com/freshteapot/3637e8d2b5ecdf01b7d252468eaaa45b https://gist.github.com/freshteapot/3637e8d2b5ecdf01b7d25246... - yq version 3.4.1 (Worth noting, the example uses an out of date yq, so a few modifictaions might be needed) https://github.com/mikefarah/yq https://github.com/mikefarah/yq
- verdverm 3y agoI use CUE(lang) for things like this
- wg0 3y agoBeautiful. Didn't know something like this exists. Reminds me of Katai[0] [0]. https://kaitai.io/ https://kaitai.io/
- verdverm 3y agoCUE is indeed a beautiful language, will get those mind juices flowing for sure! There is more work to be done on the codec implementation, but if you just want to split yaml/json across files, CUE is a great option You might also like my project, built on CUE: https://github.com/hofstadter-io/hof https://github.com/hofstadter-io/hof We have a TUI where you can explore and work with CUE, JSON, Yaml