One definition. HTTP server, Dart SDK and TypeScript SDK — all at once.
In onedef, the struct is the API contract and spec.
type GetUserAPI struct {
onedef.GET `path:"/users/{id}"`
Request struct{ ID string }
Response User
}
func (h *GetUserAPI) Handle(ctx context.Context) error {
h.Response = db.FindUser(h.Request.ID)
return nil
}This single struct gives you:
GET /users/{id}— registered, path param parsed, response serialized- Dart SDK —
curl localhost:8080/onedef/sdk/dart - TypeScript SDK —
curl localhost:8080/onedef/sdk/ts(TODO)
Change the struct. Everything updates. Synchronization cannot break — structurally.
TL;DR: The paradigm shift in the LLM era isn't using LLM as a tool — it's making your project a tool for LLM.
Read more in WHY_ONEDEF.md.