Repository navigation
Commit 7d55b91
Add OpenAPI 3.2 support with webhooks and enhanced components (#6)
* fix: simplify utoipa-gen feature gates to fix jiff_0_2 (juhaku#1575)
fix: simplify utoipa-gen feature gates to fix jiff_0_2
Enabling the "jiff_0_2" feature on its own would not correctly enable
the more
elaborate is_primitive branch because it was mistakenly omitted from the
feature gate list.
Rather than merely fixing the feature gate list, this commit simplifies
the
logic to make such a mistake impossible in the future.
* fix: workaround time/cookie incompatibility (juhaku#1577)
* fix: workaround time/cookie incompatibility
* Also fix examples
* fix: emit vec![] instead of array literals to avoid large stack arrays (juhaku#1580)
* Fix stack overflow
* fix: emit vec![] instead of array literals to avoid large stack arrays
Wide structs/enums generated huge `[..]` array literals in ToSchema/IntoParams,
tripping clippy::large_stack_arrays and overflowing the stack. Make the Array
tokenizer emit vec![] and deny the lint so it doesn't regress again (juhaku#1454).
* chore: not really testing so just smoke test
---------
Co-authored-by: Rafał Mikrut <mikrutrafal@protonmail.com>
Co-authored-by: Jaye Park <jaye.park@helsing.ai>
* Add OpenAPI 3.2 support (juhaku#1555)
* Add OpenAPI 3.2 support
* Fix OpenAPI 3.2 CI failures
* ci: re-trigger build after upstream time 0.3.48 yank
The 2026-06-12 CI run resolved time 0.3.48 (the repo intentionally does not
commit a root Cargo.lock, so CI takes the latest deps). time 0.3.48 shipped an
E0119 trait-coherence regression that broke the cookie crate, failing the
utoipa-gen and examples jobs (and cancelling utoipa via fail-fast).
time 0.3.48 has since been yanked and 0.3.49 published. This empty commit
re-runs CI to pick up the fixed resolution; verified locally that the full
utoipa-gen matrix and example compilation pass with time 0.3.49.
* Address review feedback on OpenAPI 3.2 support
- Keep `Version31` as the default OpenApiVersion; `Version32` is now opt-in
(no deprecation). Reverts the default-output version back to 3.1.0 so the
change is non-breaking until 3.2 tooling support is widespread.
- Add `OpenApiBuilder::openapi(..)` so 3.2 output can be opted into.
- Rename `self_url` field/builder to `self_uri` to match the spec wording.
- Simplify `OpenApiVersion` deserialize with slice `matches!` patterns.
- Drop redundant non-empty check when merging `additional_operations`.
- Use `RefOr::T(parameter.into())` instead of the double `.into().into()`.
- Tidy `HttpBuilder::deprecated` formatting.
- Revert the actix `#[utoipa::path]` doc examples from `rust,ignore` back to
`rust` (they pass under the `actix_extras` feature CI runs).
* docs: add examples and changelog for PR-1555 (juhaku#1590)
* docs: add examples and changelog
* test: fix empty description being omitted
* chore: change parameters to refs
* feat: support generic types with `IntoParams` (juhaku#1588)
* add example for IntoParams with generic argument
* add automated test
* working example of generic params
it breaks everything else which is a bummer
* fix implementation with into_params
* update unit tests to pin behavior
* minor code cleaning
* remove example code
I assume a reviewer might call this superfluous. This code was useful for testing locally.
* shorten code
* fix warning
* add basic changelog
* feat(gen): allow opting into OpenAPI 3.2 output via the version attribute (juhaku#1591)
* feat(gen): support item_schema attribute for streaming/SSE response types (juhaku#1592)
* feat(gen): support item_schema attribute for streaming/SSE response types
* chore: update sse example to use programmatic openapi 3.2 version mapping
* chore: use openapi version attribute
As juhaku#1591 is merged, I can remove `api.openapi = utoipa::openapi::OpenApiVersion::Version32;` from the example to replace with `#[openapi(version = "3.2.0", components(schemas(PetEvent)))]`.
* Recursively discover flattened fields in maps (juhaku#1582)
* Recursively discover flattened fields in maps
This allows the discovered fields to appear in component.schemas without
having to explicitly list it as a workaround.
Fixes juhaku#1330
* Use assert_value
* Apply suggestion from @CommanderStorm
Co-authored-by: Frank Elsinga <frank@elsinga.de>
---------
Co-authored-by: Frank Elsinga <frank@elsinga.de>
* Refactor documentation in lib.rs (juhaku#1581)
Updated documentation comments to remove commented-out code.
* chore: Update CHANGELOG.md (juhaku#1596)
Add the following entry in utoipa-gen/CHANGELOG.md
* Recursively discover flattened fields in maps for `#[serde(flatten)]`. (juhaku#1582)
* Bump base64 from 22.1 to 23.1 (juhaku#1595)
* Upgrade utoipa-gen to syn 3 (juhaku#1597)
* feature: support extensions in utoipa::ToSchema named structs (juhaku#1593)
* Re-enable actix auto_into_responses Result test (juhaku#1603)
The test was commented out as failing to compile. It was missing imports,
and the justfile did not enable `utoipa/auto_into_responses`, which gates
the `IntoResponses` impl for `Result<T, E>`.
* Update next release versions (juhaku#1618)
* Remove support for expression ignore in `ToSchema` and `IntoParams` (juhaku#1619)
This commit removes support for expression style ignore attribute from `ToSchema` and `IntoParams` macro. This is to fix issue where ignore sometimes did not ignore values, because it was evaluated in runtime and function reference ignore can be evaluated only during runtime but we need to evaluate this at build time thus removing the possibility to define function reference as ignore attribute value.
## Breaking
Following syntax demonstrates what was allowed before, but will be not available in new version 6.
```rust
// before allowed
fn ignore_always() -> bool {
true
}
#[derive(ToSchema)]
struct Value {
#[schema(ignore = ignore_always)]
field: String
}
```
* Fix publish crate version bash substitution pattern
* Fix min properties schema generation (juhaku#1623)
This bug has been around since `utoipa-gen 5.1.3` where the
`#[schema(min_properties=...)]` gets generated as `max_properties`
attribute.
Closes juhaku#1622
* Fix utoipa-swagger-ui build (juhaku#1624)
Utoipa-swagger-ui build failed to build with `cache` feature on because
sha2 crate had updated its `generic-array` to `hybrid-array` dependency
breaking the existing implementation hex formatting. More details here:
RustCrypto/hybrid-array#201
* Fix unsigned integer known format serialization (juhaku#1554)
Fix unsigned integers know format serialization. They used falsely `kebab-case` instead of `lowercase`.
Now type like `UInt16` will render `uint16` instead of `u-int16`.
---------
Co-authored-by: Juha Kukkonen <juha7kukkonen@gmail.com>
* Accept `expr` for attr for `title` and `names` (juhaku#1524)
Implements rust expression support for `names` and `title` attributes:
```rust
const STRUCT_TITLE: &str = "Post Title";
let schema = api_doc! {
#[schema(title = STRUCT_TITLE)]
struct Post {
id: i64,
description: String,
}
};
const NEW_NAME: &str = "renamed_field";
#[derive(IntoParams)]
#[into_params(parameter_in = Path, names(NEW_NAME))]
struct Filter(
#[allow(unused)]
(),
);
```
---------
Co-authored-by: Juha Kukkonen <juha7kukkonen@gmail.com>
* Fix format
* Add missing utoipa-gen snapshots for rename-expression derives (juhaku#1625)
Add missing snapshots for `utoipa-gen` test using newly supported expression in title and name.
```rust
const NEW_NAME: &str = "renamed_field";
#[derive(IntoParams)]
#[into_params(parameter_in = Path, names(NEW_NAME))]
struct Filter(());
```
---------
Co-authored-by: juhaku <26358664+juhaku@users.noreply.github.com>
* Mark Option fields with deserialize_with as required (juhaku#1627)
Serde only treats a missing Option field as None when the field has no deserialize_with or with attribute. With one of those and no default, a missing field is an error, so ToSchema and IntoParams should list the field as required. It stays nullable.
* Support `merge` in `OpenApi` derive (juhaku#1628)
Add support for `merge` in `OpenApi` derive
Keep nest and merge as separate derive attributes, but parse their common
api and tags arguments through OpenApiReference. List merge in the
unexpected-attribute diagnostic and cover merge precedence in tests.
---------
Co-authored-by: Martin Moreira de Jesus <martin.moreira-de-jesus@protonmail.com>
---------
Co-authored-by: Simon <simon@siku2.io>
Co-authored-by: John Vandenberg <jayvdb@gmail.com>
Co-authored-by: Jaye <latenytcoffee@gmail.com>
Co-authored-by: Rafał Mikrut <mikrutrafal@protonmail.com>
Co-authored-by: Jaye Park <jaye.park@helsing.ai>
Co-authored-by: Paweł Jankiewicz <p.jankiewicz@gmail.com>
Co-authored-by: Jack Ullery <46848683+jack-ullery@users.noreply.github.com>
Co-authored-by: Nipunn Koorapati <nipunn1313@gmail.com>
Co-authored-by: Frank Elsinga <frank@elsinga.de>
Co-authored-by: n4n5 <git@n4n5.dev>
Co-authored-by: Tom <1955774+tdelmas@users.noreply.github.com>
Co-authored-by: Jakob Hellermann <jakob.hellermann@protonmail.com>
Co-authored-by: Til Blechschmidt <til@blechschmidt.de>
Co-authored-by: Mattias Eriksson <6420639+snaggen@users.noreply.github.com>
Co-authored-by: Juha Kukkonen <juha7kukkonen@gmail.com>
Co-authored-by: Mukunda Rao Katta <mukunda.vjcs6@gmail.com>
Co-authored-by: Omid Rad <omid@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: juhaku <26358664+juhaku@users.noreply.github.com>
Co-authored-by: Max Azatian <66359507+HardMax71@users.noreply.github.com>
Co-authored-by: Martin Moreira de Jesus <martin.moreira-de-jesus@protonmail.com>1 parent 35249a1 commit 7d55b91
133 files changed
Lines changed: 3625 additions & 595 deletions
File tree
- .github/actions/publish
- examples
- actix-web-multipart
- actix-web-multiple-api-docs-with-scopes
- actix-web-scopes-binding
- generics-actix
- openapi-3_2-sse
- src
- raw-json-actix
- rocket-todo
- simple-x-extensions
- src
- todo-actix
- utoipa-actix-web
- src
- testdata
- utoipa-axum
- src
- utoipa-config
- config-test-crate
- utoipa-gen
- src
- component
- features
- schema
- path
- response
- tests
- snapshots
- utoipa-rapidoc
- src
- utoipa-redoc
- src
- utoipa-scalar
- src
- utoipa-swagger-ui-vendored
- utoipa-swagger-ui
- src
- utoipa
- src
- openapi
- snapshots
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
19 | 33 | | |
20 | 34 | | |
21 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
0 commit comments