Hacker News new | ask | show | jobs
by Sytten 638 days ago
The code generators for OpenAPI are rarely good compared to what you find in GraphQL in my experience. The Swagger Generator / OpenAPI Generator (why the fork...) that is the "standard" is kinda of a mess.

In rust Oxide had to write their own [1] which is actually decent, but you really need to know it exists.

[1] https://github.com/oxidecomputer/progenitor

3 comments

Part of the problem is that OpenAPI depends on JSON Schema and JSON Schema is a runtime constraint system, not a data definition system [1]. That shows up in the diagram with the three colors crammed into the "Interface Modeling and Validation" area because the boundary between those three ends up being very weird. And there's no standard for using JSON Schema as a data definition system... people just started kinda doing stuff.

I've been advocating for finding a better data definition system for Moonwalk (and yes, that's my name on the post-2016 JSON Schema drafts- it's a great runtime constraint system, and it could still be useful for that purpose alongside a system more tailored to data definition).

[1] https://modern-json-schema.com/json-schema-is-a-constraint-s...

There's a lot of new companies that have started to address this issue. One of which I work at: https://www.speakeasy.com/

I genuinely think that the quality is beyond what exists in the GraphQl ecosystem.

How is Swagger a mess? It produces perfectly readable documentation and testing mechanisms.

Barebones? Sure. But far from "a mess".