News for hackers. Stuff that matters.
Re: by rad_gruchalski on Monday March 25, 2024 @07:08PM (#39822298)
You can write an OpenAPI spec in JSON. You can use Jsonnet to generate your spec from whatever input you need.
Re: by madeofpalk on Monday March 25, 2024 @07:59PM (#39822702)
JSON is a different kind of yuck to have to author by hand, especially in the volume an api spec tends to be.
Re: by rad_gruchalski on Monday March 25, 2024 @08:47PM (#39823071)
Yes, so use Jsonnet or generate it from some intermediate representation using some alternative method. What’s the problem?
Re: by paholg on Monday March 25, 2024 @09:58PM (#39823541)
Why though when I can just generate it from my actual code and not have to maintain two copies of my api spec?
Re: by lttlrck on Tuesday March 26, 2024 @06:23AM (#39826081)
Jsonnet introduces another (flawed) language?
Re: by refulgentis on Monday March 25, 2024 @09:31PM (#39823396)
I don't like writing structured formats by hand either - at some point, you either need to, as they say in France, split or get off your seat

Either don't write it by hand, i.e. use a generator for the structured format, as the comments advocate for and article is about.

Or, just say you'll never have a spec.