Skip to content

Conversation

@Tuntii
Copy link
Owner

@Tuntii Tuntii commented Jan 29, 2026

This pull request removes all RustAPI and Actix-web HTTP benchmark servers and related micro-benchmarks from the repository. The change eliminates both the code and documentation for these benchmarks, as well as their references in the workspace configuration.

Removal of HTTP Benchmark Servers and Workspace References:

  • Removed the bench-server (RustAPI) and actix-bench-server (Actix-web) benchmark servers, including their Cargo.toml files and all source code (benches/bench_server/Cargo.toml, benches/bench_server/src/main.rs, benches/actix_bench_server/Cargo.toml, benches/actix_bench_server/src/main.rs). [1] [2] [3] [4]
  • Updated the workspace members in Cargo.toml to comment out the benchmark server crates, removing them from the workspace build.

Removal of Micro-benchmarks:

  • Deleted the routing and JSON serialization/deserialization micro-benchmark files (benches/routing_bench.rs, benches/json_bench.rs). [1] [2]

Documentation Cleanup:

  • Removed the benchmark documentation and comparison table from benches/README.md.

Deleted all benchmark server crates, micro-benchmarks, and related files from the benches directory. Updated Cargo.toml to comment out benchmark members. This reduces workspace complexity and removes external benchmark dependencies.
Refactored OpenAPI schema handling to inline simple types (primitives, empty objects, enums) instead of always referencing components in rustapi-core. Updated the OpenAPI demo example to a minimal hello world, and added a 'Zero-Config OpenAPI' recipe to the documentation. Documentation and summary files were updated to reflect the new recipe and modern usage patterns.
Copilot AI review requested due to automatic review settings January 29, 2026 15:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request removes benchmark servers/micro-benchmarks from the workspace and introduces a “native” OpenAPI path by replacing utoipa-centric schema handling with first-party Schema/ToSchema/IntoParams types and derive macros, alongside related docs updates.

Changes:

  • Removed benchmark crates, scripts, and docs; commented out benchmark members in the workspace.
  • Added a native OpenAPI schema model (schema.rs) and updated response/extractor modifiers to use structured schemas instead of JSON blobs.
  • Added new ToSchema and IntoParams derive macros and introduced cookbook documentation for zero-config OpenAPI.

Reviewed changes

Copilot reviewed 40 out of 41 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
docs/cookbook/src/recipes/zero_config_openapi.md New recipe documenting macro-based auto OpenAPI generation.
docs/cookbook/src/recipes/crud_resource.md Updates recipe to use RustApi::auto() (example snippet currently malformed).
docs/cookbook/src/crates/rustapi_openapi.md Adds link to the new zero-config OpenAPI recipe.
docs/cookbook/src/SUMMARY.md Adds the new recipe to the cookbook navigation.
crates/rustapi-view/src/view.rs Switches HTML schema from inline JSON to structured Schema.
crates/rustapi-toon/src/negotiate.rs Switches response schemas from inline JSON to structured Schema.
crates/rustapi-toon/src/llm_response.rs Switches response schemas from inline JSON to structured Schema.
crates/rustapi-toon/src/extractor.rs Switches request/response schemas from inline JSON to structured Schema.
crates/rustapi-rs/examples/openapi_demo.rs Adds an OpenAPI demo example (currently references utoipa in the example).
crates/rustapi-openapi/src/v31/spec.rs Updates OpenAPI 3.1 schema registration to use crate::ToSchema.
crates/rustapi-openapi/src/spec.rs Replaces JSON-value schemas with RefOr<Schema>, adds ParameterIn, and updates registration APIs.
crates/rustapi-openapi/src/schemas.rs Drops utoipa derives and adds manual ToSchema impls for error schemas.
crates/rustapi-openapi/src/schema.rs New native schema model + primitive ToSchema implementations.
crates/rustapi-openapi/src/lib.rs Exposes new schema module and removes utoipa re-exports from the public API.
crates/rustapi-openapi/Cargo.toml Removes utoipa dependency; adds optional uuid feature/dependency.
crates/rustapi-macros/src/schema.rs New #[derive(ToSchema)] proc-macro implementation.
crates/rustapi-macros/src/params.rs New #[derive(IntoParams)] proc-macro implementation.
crates/rustapi-macros/src/lib.rs Wires up new derive macros; schema attribute docs still reference utoipa/Schema.
crates/rustapi-core/src/sse.rs Switches SSE schema from inline JSON to structured Schema.
crates/rustapi-core/src/response.rs Migrates response schema handling to ToSchema + RefOr<Schema>.
crates/rustapi-core/src/extract.rs Migrates extractor OpenAPI modifiers to ToSchema/IntoParams + structured schemas.
crates/rustapi-core/src/app.rs Migrates path param schema inference to structured schemas; test messages/comments need cleanup.
benches/toon_bench/src/lib.rs Removed benchmark placeholder crate file.
benches/toon_bench/benches/toon_bench.rs Removed TOON benchmarks.
benches/toon_bench/Cargo.toml Removed TOON benchmark crate manifest.
benches/test_body.json Removed benchmark fixture.
benches/rustapi_bench/src/lib.rs Removed benchmark placeholder crate file.
benches/rustapi_bench/benches/websocket_bench.rs Removed WebSocket benchmarks.
benches/rustapi_bench/benches/middleware_bench.rs Removed middleware benchmarks.
benches/rustapi_bench/benches/extractor_bench.rs Removed extractor benchmarks.
benches/rustapi_bench/Cargo.toml Removed RustAPI benchmark crate manifest.
benches/run_benchmarks.ps1 Removed benchmark runner script.
benches/routing_bench.rs Removed routing micro-benchmarks.
benches/json_bench.rs Removed JSON micro-benchmarks.
benches/bench_server/src/main.rs Removed RustAPI benchmark server.
benches/bench_server/Cargo.toml Removed RustAPI benchmark server manifest.
benches/actix_bench_server/src/main.rs Removed Actix benchmark server.
benches/actix_bench_server/Cargo.toml Removed Actix benchmark server manifest.
benches/README.md Removed benchmark documentation.
Cargo.toml Comments out benchmark workspace members.
Cargo.lock Removes dependencies pulled in by deleted benchmark crates and utoipa usage.
Comments suppressed due to low confidence (2)

crates/rustapi-macros/src/lib.rs:75

  • The #[rustapi_rs::schema] docs still refer to deriving Schema from utoipa::ToSchema and the example uses #[derive(Serialize, Schema)]. With the new native schema system and ToSchema derive, this documentation is now outdated and likely confuses users about which derive macro/trait to use.
/// Auto-register a schema type for zero-config OpenAPI.
///
/// Attach this to a `struct` or `enum` that also derives `Schema` (utoipa::ToSchema).
/// This ensures the type is registered into RustAPI's OpenAPI components even if it is
/// only referenced indirectly (e.g. as a nested field type).
///
/// ```rust,ignore
/// use rustapi_rs::prelude::*;
///
/// #[rustapi_rs::schema]
/// #[derive(Serialize, Schema)]
/// struct UserInfo { /* ... */ }

crates/rustapi-core/src/app.rs:1248

  • The comment // Integer patterns is duplicated back-to-back, which looks like an accidental copy/paste. Please remove the extra line.
    // Integer patterns
    // Integer patterns
    let is_integer = lower == "page"

Comment on lines +38 to +42
// In main.rs
RustApi::auto() // Automatic registration!
.run("127.0.0.1:8080")
.await?

Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code snippet is no longer valid Rust as written: it contains a bare chain ending with .await? outside of any async main/function, and the ? requires a compatible Result return type. Consider showing a complete #[tokio::main] async fn main() -> Result<...> example (or drop the ? and show .await).

Copilot uses AI. Check for mistakes.
Comment on lines +11 to +14
//! ## Run
//! ```bash
//! cargo run -p hello-world
//! ```
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The run instructions in the doc comment appear incorrect for an example target: cargo run -p hello-world doesn’t match this file’s location/name. Consider updating to the standard Cargo example invocation used elsewhere in this crate (e.g., cargo run -p rustapi-rs --example openapi_demo).

Copilot uses AI. Check for mistakes.
Comment on lines +1447 to 1452
rustapi_openapi::SchemaRef::T(s) => {
assert_eq!(s.schema_type, Some(SchemaType::String));
assert_eq!(s.format, Some("uuid".to_string()));
}
_ => panic!("Expected inline schema for uuid"),
}
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These panic messages still say “Expected inline schema …”, but the match arms now expect SchemaRef::T(...). Updating the messages will make failures clearer and avoid confusion during debugging.

Copilot uses AI. Check for mistakes.
Comment on lines 24 to 28
use rustapi_rs::prelude::*;
use serde::Serialize;

#[derive(Serialize, utoipa::ToSchema)]
struct Message {
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example references utoipa::ToSchema, but the crate is moving toward the native ToSchema derive provided by RustAPI. Using utoipa here makes the example inconsistent with the rest of the docs and can mislead users about which derive to use.

Copilot uses AI. Check for mistakes.
}

/// Convert a schema type string to an OpenAPI schema reference
/// Convert a schema type string to an OpenAPI schema reference
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s a duplicated doc comment line here (same sentence repeated twice). Please remove the duplicate to keep docs clean.

Suggested change
/// Convert a schema type string to an OpenAPI schema reference

Copilot uses AI. Check for mistakes.
Comment on lines +974 to +988
let schema_ref = match ref_or_schema {
SchemaRef::Ref(r) => SchemaRef::Ref(r),
SchemaRef::T(s) => {
let should_inline = match s.schema_type {
Some(rustapi_openapi::schema::SchemaType::Array)
| Some(rustapi_openapi::schema::SchemaType::Boolean)
| Some(rustapi_openapi::schema::SchemaType::Integer)
| Some(rustapi_openapi::schema::SchemaType::Number)
| Some(rustapi_openapi::schema::SchemaType::String) => true,
Some(rustapi_openapi::schema::SchemaType::Object) => {
s.properties.as_ref().map_or(true, |p| p.is_empty())
&& s.enum_values.as_ref().map_or(true, |e| e.is_empty())
}
None => true,
};
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The should_inline heuristic (match on SchemaType + object property checks) is repeated in multiple places (e.g., ValidatedJson<T>, Json<T>, Created<T>). Consider extracting this into a shared helper (e.g., in rustapi_openapi or a local fn) to avoid divergence and make future schema decisions consistent.

Copilot uses AI. Check for mistakes.
Refactored the 401 Unauthorized response in AuthUser's OperationModifier to use the new Reference struct for schema references. Also added a use statement for rustapi_openapi::schema::Reference. Added initial release notes for RustAPI 0.2.0.
@Tuntii Tuntii added enhancement New feature or request invalid This doesn't seem right wontfix This will not be worked on labels Jan 29, 2026
@Tuntii Tuntii closed this Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request invalid This doesn't seem right wontfix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants