Skip to content

Commit a35cb76

Browse files
committed
Remove the nullable transform
1 parent 4f75fe4 commit a35cb76

File tree

2 files changed

+372
-366
lines changed

2 files changed

+372
-366
lines changed

crates/handlers/src/admin/mod.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use mas_router::{
2929
UrlBuilder,
3030
};
3131
use mas_templates::{ApiDocContext, Templates};
32-
use schemars::transform::{AddNullable, RecursiveTransform};
32+
use schemars::transform::AddNullable;
3333
use tower_http::cors::{Any, CorsLayer};
3434

3535
mod call_context;
@@ -173,8 +173,14 @@ where
173173

174174
aide::generate::in_context(|ctx| {
175175
ctx.schema = schemars::generate::SchemaGenerator::new(
176-
schemars::generate::SchemaSettings::openapi3()
177-
.with_transform(RecursiveTransform(AddNullable::default())),
176+
schemars::generate::SchemaSettings::openapi3().with(|settings| {
177+
// Remove the transform which adds nullable fields, as it's not
178+
// valid with OpenAPI 3.1. For some reason, aide/schemars output
179+
// an OpenAPI 3.1 schema with this nullable transform.
180+
settings
181+
.transforms
182+
.retain(|transform| !transform.is::<AddNullable>());
183+
}),
178184
);
179185
});
180186

0 commit comments

Comments
 (0)