-
-
Notifications
You must be signed in to change notification settings - Fork 1
Native OpenAPI 3.1 Generator #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Replaced `utoipa` dependency with a native, lightweight OpenAPI 3.1 implementation in `rustapi-openapi`. - Implemented `RustApiSchema` trait and `#[derive(Schema)]` macro for native JSON Schema generation. - Updated `rustapi-core` to use the new schema system and `BTreeMap` for deterministic output. - Replaced bundled Swagger UI with a CDN-based lightweight HTML handler. - Added comprehensive design documentation in `docs/native_openapi.md`. - Ensured backwards compatibility for `RustApi::auto()` and basic schema derivation. Co-authored-by: Tuntii <121901995+Tuntii@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this 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 PR replaces the external utoipa dependency with a fully native OpenAPI 3.1 generator for RustAPI. The change introduces a new schema trait (RustApiSchema) with a procedural macro (#[derive(Schema)]), replaces v31 OpenAPI types with a unified OpenApiSpec structure using BTreeMap for deterministic ordering, and switches from bundled Swagger UI assets to CDN-based loading.
Changes:
- Removed utoipa dependency and replaced with native implementation
- Unified OpenAPI 3.1 types (removed separate v31 module)
- Implemented
#[derive(Schema)]macro for schema generation - Switched Swagger UI from bundled assets to CDN
Reviewed changes
Copilot reviewed 22 out of 26 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docs/native_openapi.md | New architecture documentation for native OpenAPI implementation |
| crates/rustapi-openapi/src/v31/* | Removed legacy v31 module (webhooks, tests, schema, spec, mod) |
| crates/rustapi-openapi/src/schema.rs | New native schema implementation with RustApiSchema trait |
| crates/rustapi-openapi/src/spec.rs | Unified OpenAPI spec using BTreeMap for deterministic output |
| crates/rustapi-openapi/src/swagger.rs | Simplified Swagger UI using CDN instead of bundled assets |
| crates/rustapi-macros/src/derive_schema.rs | New Schema derive macro implementation |
| crates/rustapi-core/src/*.rs | Updated to use new RustApiSchema trait |
| Cargo.toml files | Removed utoipa dependency, added rustapi-macros dependency |
| s.reference = Some(reference); | ||
| s | ||
| }, | ||
| ::rustapi_openapi::schema::SchemaRef::Inline(v) => { |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Inline case at lines 70-73 discards the value v and creates an empty schema. This loses potentially important schema information. Consider parsing or converting the inline value, or at minimum add a comment explaining why it's intentionally discarded.
| ::rustapi_openapi::schema::SchemaRef::Inline(v) => { | |
| ::rustapi_openapi::schema::SchemaRef::Inline(v) => { | |
| // Inline schemas are currently not converted into JsonSchema2020 | |
| // when building object properties. We intentionally discard `v` | |
| // here and return an empty schema to preserve existing behavior. | |
| let _ = v; |
- Replaced utoipa dependency with a native rustapi-openapi implementation. - Implemented OpenApiSpec, Operation, Components using BTreeMap for deterministic output (OpenAPI 3.1). - Implemented #[derive(Schema)] in rustapi-macros targeting RustApiSchema trait. - Updated rustapi-core extractors and response modifiers to use the native schema system. - Replaced embedded Swagger UI assets with a lightweight CDN-based HTML handler. - Updated benchmarks and tests to reflect the changes. - Fixed dependency issues in bench-server. Co-authored-by: Tuntii <121901995+Tuntii@users.noreply.github.com>
- Fix `rustapi-openapi/src/spec.rs` linting issues (imports reordering). - Update `rustapi-toon`, `rustapi-view`, and `rustapi-ws` to align with new `rustapi-openapi` types (BTreeMap, Option wrappers, missing fields). - Initialize `MediaType` with `example: None`. - Initialize `ResponseSpec` with `headers: BTreeMap::new()`. - Wrap `schema` in `Some(...)`. - Use `BTreeMap` instead of `HashMap` for content maps. Co-authored-by: Tuntii <121901995+Tuntii@users.noreply.github.com>
Deleted all benchmark server crates, micro-benchmarks, and related scripts from the benches directory. Also removed benchmark server members from the Cargo workspace. This streamlines the repository by eliminating benchmarking infrastructure.
…extras
- Formatting: Fixed formatting in `crates/rustapi-view/src/view.rs` to match `cargo fmt`.
- Compilation:
- Updated `crates/rustapi-extras/src/jwt/mod.rs` to match `rustapi-openapi` changes.
- Used `BTreeMap` instead of `HashMap` for `ResponseSpec` content.
- Initialized `MediaType` with missing `example: None`.
- Wrapped schema value in `Some(...)`.
- Initialized `ResponseSpec` with `headers: BTreeMap::new()`.
Co-authored-by: Tuntii <121901995+Tuntii@users.noreply.github.com>
- Deleted `benches/` directory. - Removed benchmark crates from `Cargo.toml`. Co-authored-by: Tuntii <121901995+Tuntii@users.noreply.github.com>
- Verified that previous fixes for `rustapi-toon`, `rustapi-view`, and `rustapi-ws` compile correctly with `cargo check --workspace --tests`. - Verified formatting with `cargo fmt`. - No new code changes were required as the previous submission successfully addressed the compilation errors. This submission is to trigger a fresh CI run on the corrected codebase. Co-authored-by: Tuntii <121901995+Tuntii@users.noreply.github.com>
…ates
- Fix `clippy::large_enum_variant` in `rustapi-openapi`:
- Box `JsonSchema2020` in `SchemaRef::Schema`.
- Box `OAuthFlows` in `SecurityScheme::Oauth2`.
- Fix `clippy::new_without_default` in `rustapi-openapi`:
- Implement `Default` for `SchemaCtx`.
- Update `rustapi-macros/src/derive_schema.rs` to dereference boxed `SchemaRef::Schema` variants.
- Update `rustapi-openapi/src/schema.rs` to dereference boxed schemas in `Vec`, `Option`, and `HashMap` implementations.
- Ensure `rustapi-extras` and `rustapi-view` are aligned with the `rustapi-openapi` changes (already addressed in previous steps, verified here).
Co-authored-by: Tuntii <121901995+Tuntii@users.noreply.github.com>
Replaces the utoipa dependency with a native OpenAPI 3.1 generator, introducing the RustApiSchema trait and #[derive(Schema)] macro for compile-time schema generation. Updates documentation, migration guides, and examples to reflect the new architecture, including support for JSON Schema 2020-12, deterministic output via BTreeMap, and CDN-based Swagger UI. All extractors and OpenApiSpec internals are refactored to use the new schema system, and a comprehensive migration guide is added.
Adjusted line breaks and indentation in spec.rs and native_openapi_demo.rs to enhance code clarity and maintain consistent formatting. No functional changes were made.
- Fixed formatting in `crates/rustapi-openapi/src/spec.rs` and `crates/rustapi-rs/examples/native_openapi_demo.rs` by running `cargo fmt --all`. - Removed trailing whitespace in `crates/rustapi-macros/src/derive_schema.rs` that was causing `rustfmt` to fail. Co-authored-by: Tuntii <121901995+Tuntii@users.noreply.github.com>
Tuntii
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…napi-7665294518381585970 Native OpenAPI 3.1 Generator fbfff75
This PR replaces the external
utoipadependency with a fully native OpenAPI 3.1 generator owned by RustAPI.Key Changes:
rustapi-openapito define OpenAPI 3.1 structs (Spec, Operation, Schema, etc.) usingBTreeMapto ensure deterministic output ordering.RustApiSchematrait and implemented#[derive(Schema)]inrustapi-macros. This handles struct, enum, and primitive mapping to JSON Schema 2020-12.rustapi-coreextractors (Json,Query,Path) and response types (Created,ApiError) to implementRustApiSchemaand populate the new OpenAPI spec directly.utoipa-swagger-ui(and local asset bundling) with a simple HTML handler that loads Swagger UI from unpkg CDN.utoipafrom all Cargo.toml files.Verification:
rustapi-corepass with the new implementation.PR created automatically by Jules for task 7665294518381585970 started by @Tuntii