News for hackers. Stuff that matters.
Re:HTTPie Desktop: cross-platform API testing client for humans by wg0 on Monday October 09, 2023 @12:39AM (#37816979)
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.
Re:HTTPie Desktop: cross-platform API testing client for humans by herrherrmann on Monday October 09, 2023 @02:41AM (#37817617)
You can start writing multiple OpenAPI files and merge them with tools like openapi-merger (https://www.npmjs.com/package/openapi-merger). Is that maybe what you want?
Re:HTTPie Desktop: cross-platform API testing client for humans by freshteapot on Monday October 09, 2023 @06:20AM (#37818848)
* 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/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

Re:HTTPie Desktop: cross-platform API testing client for humans by verdverm on Monday October 09, 2023 @11:06AM (#37821224)
I use CUE(lang) for things like this
Re:HTTPie Desktop: cross-platform API testing client for humans by wg0 on Tuesday October 10, 2023 @01:35PM (#37835007)
Beautiful. Didn't know something like this exists. Reminds me of Katai[0]

[0]. https://kaitai.io/

Re:HTTPie Desktop: cross-platform API testing client for humans by verdverm on Tuesday October 10, 2023 @01:53PM (#37835230)
CUE 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 We have a TUI where you can explore and work with CUE, JSON, Yaml