How do their APIs compare?
How do their APIs compare?
About juhaku/utoipa · 2 messages · last activity 8/14/2026
I should clarify: these two repositories don't really have comparable "APIs" in the same sense — they serve very different purposes and are built in different languages with different usage models. Let me lay out what's actually visible from the data before comparing.
juhaku/utoipa — a compile-time documentation generation API
utoipa's "API" is a set of Rust proc-macros and traits that developers annotate their code with, so OpenAPI specs are generated at compile time. Key surface elements visible in the retrieved data:
#[derive(ToSchema)]— turns a Rust struct into an OpenAPI schema component, e.g. thePetstruct example [README.md:L145-L150].#[utoipa::path(...)]— an attribute macro applied to handler functions to describe an HTTP operation (method, path, responses, params), as in theget_pet_by_idexample [README.md:L157-L172].#[derive(OpenApi)]with#[openapi(paths(...))]** — aggregates annotated paths/schemas into a top-levelOpenApidocument type [README.md:L175-L176].OpenApi::openapi()— the generated static method that produces the actual spec object, which can be serialized viato_pretty_json()[README.md:L179].Modifytrait andOpenApiBuilder— a runtime API for mutating the generated spec after the fact, e.g.doc.info.title = ...or convertingOpenApiintoOpenApiBuilder[utoipa-gen/README.md:L281-L298].- Companion crates expose their own small APIs, e.g.
utoipa-config::Config::new().alias_for(...).write_to_file()for build-time type aliasing [utoipa-config/README.md:L36-L44], andutoipa-rapidoc::RapiDoc::with_openapi(...).path(...)as aService/router integration point for frameworks like actix-web, rocket, and axum [utoipa-rapidoc/src/lib.rs:L84-L120].
So utoipa's "API" is fundamentally a declarative, macro-driven, compile-time contract: you write Rust, macros parse attribute syntax (see the Example parser handling summary, description, value, data_value, serialized_value, external_value keys [utoipa-gen/src/path/example.rs:L22-L83]), and the output is a static OpenAPI document plus optional runtime mutation hooks.
ultraworkers/claw-code — a runtime query/session engine API
claw-code's exposed surface is Python classes with imperative, stateful methods, not a spec-generation macro system:
QueryEngineRuntime.route(prompt, limit=5)— routes a prompt against mirrored commands/tools and returns a formatted text report of matches [src/QueryEngine.py:L7-L17].- A larger, stateful engine (implied by
src/query_engine.py) exposes methods likesubmit_message,stream_submit_message(a generator yielding typed event dicts:message_start,command_match,tool_match,permission_denial,message_delta,message_stop) [src/query_engine.py:L116-L133], plus session/transcript management methodscompact_messages_if_needed,replay_user_messages,flush_transcript, andpersist_session[src/query_engine.py:L95-L108]. - There's also a large catalog of "mirrored" command/tool metadata in JSON reference data (
commands_snapshot.json,tools_snapshot.json,archive_surface_snapshot.json), which look like documentation/inventory artifacts describing a much larger TypeScript CLI (archive/claude_code_ts_snapshot) rather than a live API surface [src/reference_data/archive_surface_snapshot.json:L1-L39, src/reference_data/commands_snapshot.json:L141-L180].
The comparison
| Aspect | utoipa | claw-code |
|---|---|---|
| Nature of "API" | Compile-time macros/derives + generated static types | Runtime Python classes/methods with mutable state |
| Consumer | Rust backend developers annotating handlers | Something driving a conversational/tool-routing session (prompt → matched commands/tools → streamed events) |
| Output | An OpenApi struct serializable to JSON/YAML | Streamed event dic |
Want to ask your own question?
Open chat for juhaku/utoipaPublic Q&A. Generated by RepoPilot from the actual source of juhaku/utoipa. AI answers can be incomplete or stale — verify before relying on them.