News for hackers. Stuff that matters.
Re:Most RESTful APIs Aren't RESTful by crabmusket on Wednesday July 09, 2025 @06:24PM (#44515320)
Brb, I'm off to invent another language independent IDL for API definitions that is only implemented by 2 of the 5 languages you need to work with.

I'm joking, but I did actually implement essentially that internally. We start with TypeScript files as its type system is good at describing JSON. We go from there to JSON Schema for validation, and from there to the other languages we need.

Re:Most RESTful APIs Aren't RESTful by agumonkey on Wednesday July 09, 2025 @07:18PM (#44515692)
anything I could read to imitate that workflow ?
Re:Most RESTful APIs Aren't RESTful by crabmusket on Wednesday July 09, 2025 @08:16PM (#44516010)
I haven't written anything up - maybe one day - but our stack is `ts-morph` to get some basic metadata out of our "service definition" typescript files, `ts-json-schema-generator` to go from there to JSON Schema, `quicktype-core` to go to other languages.

Schema validation and type generation vary by language. When we need to validate schemas in JS/TS land, we're using `ajv`. Our generation step exports the JSON Schema to a valid JS file, and we load that up with AJV and grab schemas for specific types using `getSchema`.

Re:Most RESTful APIs Aren't RESTful by agumonkey on Thursday July 10, 2025 @03:01AM (#44518132)
Can't thank you enough. I'm gonna try these and see.
Re:Most RESTful APIs Aren't RESTful by crabmusket on Saturday July 12, 2025 @05:31AM (#44540641)
One day I hope to publish this as a tool, or at least parts of it. But you know, that won't put food on the table.
Re:Most RESTful APIs Aren't RESTful by motorest on Thursday July 10, 2025 @01:52AM (#44517720)
> Brb, I'm off to invent another language independent IDL for API definitions that is only implemented by 2 of the 5 languages you need to work with.

Watch out, OpenAPI is now 3 versions deep and supports both JSON and YAML.

Re:Most RESTful APIs Aren't RESTful by actionfromafar on Thursday July 10, 2025 @05:34AM (#44519077)
If younger me had been told, "one day kid, you will miss working with XML", I'd have laughed.

YAML made me miss JSON. JSON made me miss XML.

Re:Most RESTful APIs Aren't RESTful by agumonkey on Thursday July 10, 2025 @07:13AM (#44519675)
The pattern I observe is that in old industries, people who paid the cost, try to come up with a big heavy solution (xml, xsd, xpath), but newcomers will not understand the need, and bail onto simpler ideas (json), until they hit the wall and start to invent their own (jsonschema, jquery).

same goes for java vs php/python

Re:Most RESTful APIs Aren't RESTful by actionfromafar on Thursday July 10, 2025 @07:44AM (#44519897)
Definitely. And often, it's the right call, or the thing wouldn't generate any business value (such as money) at all in a reasonable time.

But boy, how messy spaghetti don't we get for it, sometimes.

(Invent their own, badly, at first. Sigh.)

Re:Most RESTful APIs Aren't RESTful by PaulHoule on Thursday July 10, 2025 @08:26PM (#44527216)
I dunno, I remember the holy trinity of $, % and @ sigils in Perl as my first exposure to JSON-like objects which are the real world's answer to S-Expressions because they address the nameless tuple problem

https://www.codeproject.com/Articles/1186940/Lisps-Mysteriou...