Skip to content

Commit ec7ca12

Browse files
committed
fixes, add JsonSchema
1 parent 8e06b22 commit ec7ca12

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cot-core/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ http-body-util.workspace = true
2929
http-body.workspace = true
3030
http.workspace = true
3131
indexmap.workspace = true
32-
serde.workspace = true
32+
schemars = { workspace = true, optional = true }
33+
serde = { workspace = true, features = ["derive"] }
3334
serde_html_form = { workspace = true, features = ["de", "std"] }
3435
serde_json.workspace = true
3536
serde_path_to_error.workspace = true
@@ -47,3 +48,4 @@ tokio.workspace = true
4748
[features]
4849
default = []
4950
json = []
51+
schemars = ["dep:schemars"]

cot-core/src/html.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ use std::fmt::Write;
5454

5555
use askama::filters::Escaper;
5656
use derive_more::{Deref, Display, From};
57+
use schemars::JsonSchema;
5758
use serde::{Deserialize, Serialize};
5859

5960
/// A type that represents HTML content as a string.
@@ -81,6 +82,7 @@ use serde::{Deserialize, Serialize};
8182
Serialize,
8283
Deserialize,
8384
)]
85+
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
8486
#[serde(transparent)]
8587
pub struct Html(pub String);
8688

cot/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ postgres = ["db", "sea-query/backend-postgres", "sea-query-binder/sqlx-postgres"
113113
mysql = ["db", "sea-query/backend-mysql", "sea-query-binder/sqlx-mysql", "sqlx/mysql"]
114114
redis = ["cache", "dep:deadpool-redis", "dep:redis", "json"]
115115
json = ["dep:serde_json", "cot_core/json"]
116-
openapi = ["json", "dep:aide", "dep:schemars"]
116+
openapi = ["json", "cot_core/schemars", "dep:aide", "dep:schemars"]
117117
swagger-ui = ["openapi", "dep:swagger-ui-redist"]
118118
live-reload = ["dep:tower-livereload"]
119119
cache = ["json"]

0 commit comments

Comments
 (0)