Overview

API Reference for Warp

Installation#

Add the required dependencies to your Cargo.toml:

[dependencies]
scalar_api_reference = { version = "0.1.0", features = ["warp"] }
warp = { version = "0.4", features = ["server"] }
serde_json = "1.0"
tokio = { version = "1.0", features = ["full"] }

Usage#

use scalar_api_reference::warp::routes;
use serde_json::json;
 
#[tokio::main]
async fn main() {
    let configuration = json!({
        // URL to your OpenAPI document
        // Learn more about the configuration: https://scalar.com/products/api-references/configuration
        "url": "https://registry.scalar.com/@scalar/apis/galaxy?format=json",
    });
 
    let scalar = routes("scalar", &configuration);
 
    println!("Server running on http://localhost:3030/scalar");
    warp::serve(scalar)
        .run(([127, 0, 0, 1], 3030))
        .await;
}

Agent#

To enable Agent (AI chat) in production, add an API key to your configuration. To disable it, set "agent": { "disabled": true }. See the Rust integration configuration for details.

let configuration = json!({
    "url": "https://registry.scalar.com/@scalar/apis/galaxy?format=json",
    "agent": { "key": "your-agent-scalar-key" }
});

Note: For Warp, the path should not include leading slashes (e.g., use "scalar" instead of "/scalar"). This is due to Warp's path handling requirements.

Updated

Was this page helpful?