Doc Comments
Forward Rust /// doc comments as JSDoc in the generated TypeScript — giving you editor tooltips and
inline documentation on the TypeScript side.
# metaxy.config.toml
[codegen]
preserve_docs = trueor via CLI
metaxy generate --preserve-docsExample
/// Returns the current server time.
#[rpc_query]
async fn time() -> TimeResponse { /* ... */ }
/// A timestamp with a human-readable message.
#[derive(Serialize)]
struct TimeResponse {
/// Unix timestamp in seconds.
timestamp: u64,
/// Formatted message for display.
message: String,
}
/// Supported user roles.
#[derive(Serialize)]
enum Role {
/// Read-only access.
Viewer,
/// Can create and edit content.
Editor,
/// Full access including user management.
Admin,
}/** A timestamp with a human-readable message. */
export interface TimeResponse {
/** Unix timestamp in seconds. */
timestamp: number;
/** Formatted message for display. */
message: string;
}
/**
* Supported user roles.
* - `"Viewer"` — Read-only access.
* - `"Editor"` — Can create and edit content.
* - `"Admin"` — Full access including user management.
*/
export type Role = "Viewer" | "Editor" | "Admin";
export type Procedures = {
queries: {
/** Returns the current server time. */
time: { input: void; output: TimeResponse };
};
};Doc comments are preserved on procedures, structs, struct fields, enums, and enum variants.
Disabled by default (preserve_docs = false).