clawspec_core/_tutorial/mod.rs
1//! # Tutorial: Getting Started with Clawspec
2//!
3//! Welcome to the Clawspec tutorial! This guide will walk you through using Clawspec
4//! to generate OpenAPI specifications from your test code.
5//!
6//! ## Learning Path
7//!
8//! This tutorial is organized into chapters that build upon each other:
9//!
10//! 1. **[Introduction][chapter_0]** - What is Clawspec and why use it
11//! 2. **[Getting Started][chapter_1]** - Setting up the client and making your first request
12//! 3. **[Request Building][chapter_2]** - POST requests, path and query parameters
13//! 4. **[Response Handling][chapter_3]** - Processing responses and error handling
14//! 5. **[Advanced Parameters][chapter_4]** - Headers, cookies, and parameter styles
15//! 6. **[OpenAPI Customization][chapter_5]** - Tags, descriptions, and metadata
16//! 7. **[Redaction][chapter_6]** - Stable examples with dynamic value redaction
17//! 8. **[Test Integration][chapter_7]** - Using TestClient for end-to-end testing
18//!
19//! ## Quick Example
20//!
21//! Here's a taste of what you'll learn:
22//!
23//! ```rust,no_run
24//! use clawspec_core::ApiClient;
25//! use serde::{Deserialize, Serialize};
26//! use utoipa::ToSchema;
27//!
28//! #[derive(Serialize, ToSchema)]
29//! struct CreateUser { name: String }
30//!
31//! #[derive(Deserialize, ToSchema)]
32//! struct User { id: u64, name: String }
33//!
34//! # #[tokio::main]
35//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
36//! // Create a client
37//! let mut client = ApiClient::builder()
38//! .with_host("api.example.com")
39//! .build()?;
40//!
41//! // Make a request - schema is captured automatically
42//! let user: User = client
43//! .post("/users")?
44//! .json(&CreateUser { name: "Alice".to_string() })?
45//! .await?
46//! .as_json()
47//! .await?;
48//!
49//! // Generate OpenAPI specification
50//! let spec = client.collected_openapi().await;
51//! println!("{}", spec.to_pretty_json()?);
52//! # Ok(())
53//! # }
54//! ```
55//!
56//! Ready to start? Head to [Chapter 0: Introduction][chapter_0]!
57
58pub mod chapter_0;
59pub mod chapter_1;
60pub mod chapter_2;
61pub mod chapter_3;
62pub mod chapter_4;
63pub mod chapter_5;
64pub mod chapter_6;
65pub mod chapter_7;