Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
640ef44
fix: simplify utoipa-gen feature gates to fix jiff_0_2 (#1575)
siku2 Jun 28, 2026
fb812a1
fix: workaround time/cookie incompatibility (#1577)
jayvdb Jun 30, 2026
205fe71
fix: emit vec![] instead of array literals to avoid large stack array…
Drifter-J Jul 5, 2026
5b25257
Add OpenAPI 3.2 support (#1555)
pjankiewicz Aug 9, 2026
58632b1
docs: add examples and changelog for PR-1555 (#1590)
Drifter-J Aug 9, 2026
c607078
feat: support generic types with `IntoParams` (#1588)
jack-ullery Aug 10, 2026
e092565
feat(gen): allow opting into OpenAPI 3.2 output via the version attri…
Drifter-J Aug 10, 2026
b66879a
feat(gen): support item_schema attribute for streaming/SSE response t…
Drifter-J Aug 10, 2026
e8a26bb
Recursively discover flattened fields in maps (#1582)
nipunn1313 Aug 24, 2026
5db2ccb
Refactor documentation in lib.rs (#1581)
Its-Just-Nans Aug 24, 2026
0a5951b
chore: Update CHANGELOG.md (#1596)
Drifter-J Aug 24, 2026
1436f78
Bump base64 from 22.1 to 23.1 (#1595)
tdelmas Sep 3, 2026
fbe6639
Upgrade utoipa-gen to syn 3 (#1597)
jakobhellermann Sep 3, 2026
0f601fe
feature: support extensions in utoipa::ToSchema named structs (#1593)
Firflei Sep 16, 2026
69af040
Re-enable actix auto_into_responses Result test (#1603)
snaggen Sep 16, 2026
14e2a90
Update next release versions (#1618)
juhaku Sep 22, 2026
baa4d04
Remove support for expression ignore in `ToSchema` and `IntoParams` (…
juhaku Sep 22, 2026
7ebfd23
Fix publish crate version bash substitution pattern
juhaku Sep 23, 2026
e1d8964
Fix min properties schema generation (#1623)
juhaku Sep 23, 2026
4225d2e
Fix utoipa-swagger-ui build (#1624)
juhaku Sep 23, 2026
186da6c
Fix unsigned integer known format serialization (#1554)
MukundaKatta Sep 24, 2026
65d5232
Accept `expr` for attr for `title` and `names` (#1524)
omid Sep 24, 2026
26e6713
Fix format
juhaku Sep 24, 2026
2dfe23d
Add missing utoipa-gen snapshots for rename-expression derives (#1625)
Copilot Sep 25, 2026
a32c8e6
Mark Option fields with deserialize_with as required (#1627)
HardMax71 Sep 27, 2026
2ec67b8
Support `merge` in `OpenApi` derive (#1628)
juhaku Sep 28, 2026
67be1db
Merge juhaku/utoipa master into fork (upstream 6.0.0)
gaspb Sep 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/publish/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fi
echo "$token" | cargo login
while read -r module; do
# crate=$(echo "$ref" | sed 's|-[0-9]*\.[0-9]*\.[0-9].*||')
crate=${ref/-[0-9]\.[0-9]\.[0-9]*/}
crate=${ref/-[0-9]*\.[0-9]*\.[0-9]*/}
if [[ "$crate" != "$module" ]]; then
echo "Module: $module does not match to release crate: $crate, skipping release for module"
continue
Expand Down
14 changes: 14 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ members = [
"utoipa-actix-web",
]

# cookie 0.18.1 (via rocket_http) does not compile against time 0.3.52+
# (Parsable::parse gained a defaults argument). Cap until cookie releases a fix.
# Keeps `just test` / fresh resolves working without committing Cargo.lock.
[workspace.dependencies]
time = { version = ">=0.3, <0.3.52" }

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(doc_cfg)'] }

[workspace.lints.clippy]
# Enforced to guard against regressions of large stack allocations in generated
# code (see https://github.com/juhaku/utoipa/issues/1454).
large_stack_arrays = "deny"

# Crates published to crates.io under the meteroid-oss fork, in dependency order.
# The core three (`-config`, `-gen`, `meteroid-utoipa`) carry the fork's custom
# features (e.g. `tagged_discriminator`); `-axum` and `-scalar` are the framework
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Add dependency declaration to `Cargo.toml`.

```toml
[dependencies]
utoipa = "5"
utoipa = "6"
```

## Examples
Expand Down
26 changes: 13 additions & 13 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ This fork publishes five crates to crates.io, in dependency order:

| crates.io name | path | import as (unchanged) | version |
| ------------------------ | ---------------- | --------------------- | ------- |
| `meteroid-utoipa-config` | `utoipa-config/` | `utoipa_config` | 0.1.2 |
| `meteroid-utoipa-gen` | `utoipa-gen/` | `utoipa_gen` | 5.6.0 |
| `meteroid-utoipa` | `utoipa/` | `utoipa` | 5.6.0 |
| `meteroid-utoipa-axum` | `utoipa-axum/` | `utoipa_axum` | 0.2.0 |
| `meteroid-utoipa-scalar` | `utoipa-scalar/` | `utoipa_scalar` | 0.3.0 |
| `meteroid-utoipa-config` | `utoipa-config/` | `utoipa_config` | 0.1.3 |
| `meteroid-utoipa-gen` | `utoipa-gen/` | `utoipa_gen` | 6.0.0 |
| `meteroid-utoipa` | `utoipa/` | `utoipa` | 6.0.0 |
| `meteroid-utoipa-axum` | `utoipa-axum/` | `utoipa_axum` | 0.3.0 |
| `meteroid-utoipa-scalar` | `utoipa-scalar/` | `utoipa_scalar` | 0.4.0 |

The crates.io **package** names are prefixed with `meteroid-`, but the **library**
names are kept (`utoipa`, `utoipa_gen`, `utoipa_config`, `utoipa_axum`,
`utoipa_scalar`). Downstream code therefore stays a drop-in with upstream:

```toml
[dependencies]
meteroid-utoipa = "5"
meteroid-utoipa = "6"
```

```rust
Expand Down Expand Up @@ -67,9 +67,9 @@ you probably forgot to bump the `Cargo.toml` version(s).

The crates have different versions, but you only pick **one** tag, and it's
just a trigger — it does not decide what gets published (that comes from each
crate's `Cargo.toml`). Use the **`meteroid-utoipa` version**, e.g. `v5.6.0`. That
crate's `Cargo.toml`). Use the **`meteroid-utoipa` version**, e.g. `v6.0.0`. That
is the crate you and downstream depend on, so the release *is* "meteroid-utoipa
5.6.0". The others ride along automatically:
6.0.0". The others ride along automatically:

- `meteroid-utoipa-gen` moves **in lockstep** with `meteroid-utoipa` (same number —
the derive-macro crate and its runtime are a matched pair), so it is covered.
Expand All @@ -87,11 +87,11 @@ are independent of upstream `utoipa` — there is no collision on crates.io. Bum
only the crates that carry a change of the fork's own (versus upstream
juhaku/utoipa):

- `meteroid-utoipa-gen` and `meteroid-utoipa` currently diverge from upstream 5.5.0
by two opt-in, backward-compatible features (`tagged_discriminator` and flatten
support in `IntoParams`), hence the minor bump to **5.6.0**.
- `meteroid-utoipa-config` is unchanged from upstream, so it stays at **0.1.2**.
- `meteroid-utoipa-axum` (**0.2.0**) and `meteroid-utoipa-scalar` (**0.3.0**) are
- `meteroid-utoipa-gen` and `meteroid-utoipa` track upstream 6.0.0 plus two opt-in,
backward-compatible features (`tagged_discriminator` and flatten support in
`IntoParams`), and are published as **6.0.0**.
- `meteroid-utoipa-config` is unchanged from upstream, so it matches it at **0.1.3**.
- `meteroid-utoipa-axum` (**0.3.0**) and `meteroid-utoipa-scalar` (**0.4.0**) are
the framework bindings, unchanged from upstream; they only depend on the renamed
core. Bump them when their own `Cargo.toml` changes.

Expand Down
2 changes: 2 additions & 0 deletions examples/actix-web-multipart/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ version = "0.1.0"
edition = "2021"

[dependencies]
# cookie (actix/rocket) does not build with time 0.3.52+; drop when cookie is fixed
time = { version = ">=0.3, <0.3.52" }
actix-web = "4"
actix-multipart = "0.7"
utoipa = { path = "../../utoipa", features = ["actix_extras"] }
Expand Down
2 changes: 2 additions & 0 deletions examples/actix-web-multiple-api-docs-with-scopes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ authors = [
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# cookie (actix/rocket) does not build with time 0.3.52+; drop when cookie is fixed
time = { version = ">=0.3, <0.3.52" }
actix-web = "4"
serde = { version = "1.0", features = ["derive"] }
env_logger = "0.11.0"
Expand Down
2 changes: 2 additions & 0 deletions examples/actix-web-scopes-binding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ version = "0.1.0"
edition = "2021"

[dependencies]
# cookie (actix/rocket) does not build with time 0.3.52+; drop when cookie is fixed
time = { version = ">=0.3, <0.3.52" }
actix-web = "4"
serde = { version = "1.0", features = ["derive"] }
env_logger = "0.11.0"
Expand Down
2 changes: 2 additions & 0 deletions examples/generics-actix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ authors = [
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# cookie (actix/rocket) does not build with time 0.3.52+; drop when cookie is fixed
time = { version = ">=0.3, <0.3.52" }
actix-web = "4"
env_logger = "0.10.0"
geo-types = { version = "0.7", features = ["serde"] }
Expand Down
22 changes: 22 additions & 0 deletions examples/openapi-3_2-sse/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "openapi-3_2-sse"
description = "Axum example documenting a Server-Sent Events (SSE) endpoint using OpenAPI 3.2"
version = "0.1.0"
edition = "2021"
license = "MIT"
authors = ["Drifter-J <latenytcoffee@gmail.com>"]

[dependencies]
axum = "0.8.0"
futures-util = "0.3"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1.17", features = ["full"] }
tokio-stream = "0.1"
utoipa = { path = "../../utoipa", features = ["axum_extras", "uuid"] }
utoipa-axum = { path = "../../utoipa-axum" }
utoipa-swagger-ui = { path = "../../utoipa-swagger-ui", features = ["axum"] }
uuid = { version = "1", features = ["serde", "v4"] }
rand = "0.8"

[workspace]
15 changes: 15 additions & 0 deletions examples/openapi-3_2-sse/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# openapi-3_2-sse

This example demonstrates documenting a Server-Sent Events endpoint using `utoipa`'s
OpenAPI 3.2 support: opting in to `openapi: "3.2.0"` output and describing the
`text/event-stream` response with the new `itemSchema` media type keyword.

Run with:
```bash
cargo run
```

Then either:

- Browse to `http://localhost:8080/swagger-ui/` to inspect the generated OpenAPI 3.2 document, or
- Stream events directly with `curl -N http://localhost:8080/pets/events`
124 changes: 124 additions & 0 deletions examples/openapi-3_2-sse/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
//! Server-Sent Events (SSE) example documented with OpenAPI 3.2.
//!
//! OpenAPI 3.2 adds support for streaming/sequential media types such as `text/event-stream`,
//! `application/jsonl` and `application/json-seq`.
//! Refer to [Announcing OpenAPI v3.2](https://www.openapis.org/blog/2025/09/23/announcing-openapi-v3-2)
//!
//! This example shows how to:
//!
//! - opt in to `utoipa`'s OpenAPI 3.2 output via the `#[openapi(version = "3.2.0")]` derive attribute
//! - describe a `text/event-stream` SSE endpoint using the new `itemSchema` media type keyword
//! introduced in OpenAPI 3.2, so consumers know the shape of each event pushed down the stream
//! - serve the endpoint for real with axum's [`axum::response::sse::Sse`] type

use std::convert::Infallible;
use std::time::Duration;

use axum::response::sse::{Event, KeepAlive, Sse};
use futures_util::stream::Stream;
use rand::Rng;
use serde::Serialize;
use tokio_stream::StreamExt;
use utoipa::{OpenApi, ToSchema};
use utoipa_axum::router::OpenApiRouter;
use utoipa_axum::routes;
use utoipa_swagger_ui::SwaggerUi;
use uuid::Uuid;

/// A single pet status update pushed to subscribers of the `/pets/events` stream.
#[derive(Serialize, ToSchema)]
struct PetEvent {
/// Identifier of the pet the event relates to.
pet_id: Uuid,
/// New status of the pet, e.g. `"adopted"`, `"vaccinated"` or `"groomed"`.
status: String,
}

/// Stream status updates for pets as Server-Sent Events.
///
/// The `text/event-stream` response describes the shape of each streamed event with the
/// `item_schema` attribute, which maps to OpenAPI 3.2's `itemSchema` media type keyword. Because
/// `item_schema = PetEvent` produces a `$ref`, `PetEvent` is registered as a reusable component via
/// `#[openapi(components(schemas(PetEvent)))]` on [`ApiDoc`].
#[utoipa::path(
get,
path = "/pets/events",
responses(
(
status = 200,
description = "Stream of pet status updates",
content_type = "text/event-stream",
item_schema = PetEvent,
)
)
)]
async fn pet_events() -> Sse<impl Stream<Item = Result<Event, Infallible>>> {
let uuids = [Uuid::new_v4(), Uuid::new_v4(), Uuid::new_v4()];
let statuses = ["vaccinated", "groomed", "adopted"];
// Emit a finite number of events (one per second) so clients that buffer the whole
// response body
let stream = tokio_stream::iter(0u64..10)
.map(move |i| {
let mut rng = rand::thread_rng();
let uuid_idx = rng.gen_range(0..3);
let event = PetEvent {
pet_id: uuids[uuid_idx],
status: statuses[(i % statuses.len() as u64) as usize].to_string(),
};
Ok(Event::default().json_data(&event).unwrap())
})
.throttle(Duration::from_secs(1));

Sse::new(stream).keep_alive(KeepAlive::new().interval(Duration::from_secs(15)))
}

/// Opt the whole document in to OpenAPI 3.2 output with `version = "3.2.0"`
#[derive(OpenApi)]
#[openapi(version = "3.2.0", components(schemas(PetEvent)))]
struct ApiDoc;

#[tokio::main]
async fn main() {
let (router, api) = OpenApiRouter::with_openapi(ApiDoc::openapi())
.routes(routes!(pet_events))
.split_for_parts();

let router = router.merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", api));

let listener = tokio::net::TcpListener::bind("127.0.0.1:8080")
.await
.unwrap();
axum::serve(listener, router.into_make_service())
.await
.unwrap();
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn sse_response_documents_item_schema() {
let (_, api) = OpenApiRouter::<()>::with_openapi(ApiDoc::openapi())
.routes(routes!(pet_events))
.split_for_parts();

let json = serde_json::to_value(&api).unwrap();

assert_eq!(
json["openapi"],
serde_json::json!("3.2.0"),
"expected document to opt in to OpenAPI 3.2, got: {}",
json["openapi"]
);

let content = &json["paths"]["/pets/events"]["get"]["responses"]["200"]["content"]
["text/event-stream"];

assert_eq!(
content["itemSchema"]["$ref"],
serde_json::json!("#/components/schemas/PetEvent"),
"expected text/event-stream response to carry an itemSchema $ref to PetEvent, got: {content:#}"
);
}
}
2 changes: 2 additions & 0 deletions examples/raw-json-actix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ authors = [
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# cookie (actix/rocket) does not build with time 0.3.52+; drop when cookie is fixed
time = { version = ">=0.3, <0.3.52" }
actix-web = "4"
env_logger = "0.10.0"
serde_json = "1.0"
Expand Down
2 changes: 2 additions & 0 deletions examples/rocket-todo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ authors = ["Elli Example <example@example.com>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# cookie (actix/rocket) does not build with time 0.3.52+; drop when cookie is fixed
time = { version = ">=0.3, <0.3.52" }
rocket = { version = "0.5", features = ["json"] }
utoipa = { path = "../../utoipa", features = ["rocket_extras"] }
utoipa-swagger-ui = { path = "../../utoipa-swagger-ui", features = [
Expand Down
2 changes: 2 additions & 0 deletions examples/simple-x-extensions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ version = "0.1.0"
edition = "2021"

[dependencies]
# cookie (actix/rocket) does not build with time 0.3.52+; drop when cookie is fixed
time = { version = ">=0.3, <0.3.52" }
actix-web = "4"
env_logger = "0"
utoipa = { path = "../../utoipa", features = [ "yaml" ] }
Expand Down
24 changes: 15 additions & 9 deletions examples/simple-x-extensions/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,19 @@ impl utoipa::Modify for ApiModify {
extend_servers(&mut openapi.servers, "[Modify] openapi");

fn extend_parameters(
parameters: &mut Option<Vec<utoipa::openapi::path::Parameter>>,
parameters: &mut Option<Vec<utoipa::openapi::RefOr<utoipa::openapi::path::Parameter>>>,
text: &str,
) {
parameters
.get_or_insert(Vec::new())
.iter_mut()
.for_each(|i| {
.filter_map(|parameter| match parameter {
utoipa::openapi::RefOr::T(parameter) => Some(parameter),
utoipa::openapi::RefOr::Ref(_) => None,
})
.for_each(|parameter| {
extend(
&mut i.extensions,
&mut parameter.extensions,
format!("{text}>Parameters>item").as_str(),
);
});
Expand Down Expand Up @@ -114,16 +118,18 @@ impl utoipa::Modify for ApiModify {
);
}
});
if let Some(request_body) = &mut operation.request_body {
if let Some(utoipa::openapi::RefOr::T(request_body)) = &mut operation.request_body {
extend(
&mut request_body.extensions,
format!("{text}>RequestBody").as_str(),
);
request_body.content.iter_mut().for_each(|(_, i)| {
extend(
&mut i.extensions,
format!("{text}>RequestBody>Content").as_str(),
);
request_body.content.iter_mut().for_each(|(_, content)| {
if let utoipa::openapi::RefOr::T(content) = content {
extend(
&mut content.extensions,
format!("{text}>RequestBody>Content").as_str(),
);
}
});
}
}
Expand Down
2 changes: 2 additions & 0 deletions examples/todo-actix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ authors = ["Example <example@example.com>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# cookie (actix/rocket) does not build with time 0.3.52+; drop when cookie is fixed
time = { version = ">=0.3, <0.3.52" }
actix-web = "4"
serde = { version = "1.0", features = ["derive"] }
env_logger = "0.11"
Expand Down
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test *crates='utoipa utoipa-gen utoipa-swagger-ui utoipa-redoc utoipa-rapidoc ut

$cargo $cargo_command -p utoipa-gen --test path_derive_auto_into_responses --features auto_into_responses,utoipa/uuid,uuid,utoipa/macros
$cargo $cargo_command -p utoipa-gen --test path_derive_actix --test path_parameter_derive_actix --features actix_extras,utoipa/uuid,uuid,utoipa/chrono,chrono,utoipa/time,time,utoipa/macros
$cargo $cargo_command -p utoipa-gen --test path_derive_auto_into_responses_actix --features actix_extras,auto_into_responses,utoipa/uuid,uuid,utoipa/macros
$cargo $cargo_command -p utoipa-gen --test path_derive_auto_into_responses_actix --features actix_extras,auto_into_responses,utoipa/auto_into_responses,utoipa/uuid,uuid,utoipa/macros

$cargo $cargo_command -p utoipa-gen --test path_derive_rocket --features rocket_extras,utoipa/macros

Expand Down Expand Up @@ -77,7 +77,7 @@ coverage:
# Generate workspace documentation (requires nightly toolchain). Output is written to target/doc/
doc:
cargo +nightly doc -Z unstable-options --workspace --no-deps \
--features actix_extras,openapi_extensions,yaml,uuid,ulid,url,non_strict_integers,actix-web,axum,rocket,macros,config \
--features actix_extras,openapi_extensions,yaml,uuid,ulid,url,non_strict_integers,actix-web,axum,rocket,macros,config,vendored \
--config 'build.rustdocflags = ["--cfg", "doc_cfg"]'

# Update vendored Swagger UI to the given version. Usage: `just update-swagger-ui 5.18.2`
Expand Down
Loading
Loading