Skip to content

feat!: Implement Serialize, Deserialize, and JsonSchema implementations for cot internal types#575

Merged
ElijahAhianyo merged 7 commits into
masterfrom
elijah/json-impls
May 17, 2026
Merged

feat!: Implement Serialize, Deserialize, and JsonSchema implementations for cot internal types#575
ElijahAhianyo merged 7 commits into
masterfrom
elijah/json-impls

Conversation

@ElijahAhianyo
Copy link
Copy Markdown
Contributor

@ElijahAhianyo ElijahAhianyo commented May 15, 2026

Related issue or discussion

This should allow the use of cot's internal types in structs where schemas::JsonSchema is derived:

#[derive(Debug, Clone, Serialize, schemars::JsonSchema)]
#[model] // needed only for `ForeignKey`
struct Foo {
  id: Auto<i64>,
  limited_str: LimitedString<128>,
  fk: ForeignKey<Bar>,
  email: Email,
  url: Url
}

Description

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / cleanup
  • Performance improvement
  • Other (describe above)

Checklist

  • I've read the contributing guide
  • Tests pass locally (just test-all)
  • Code passes clippy (just clippy)
  • Code is properly formatted (cargo fmt)
  • New tests added (regression test for bugs, coverage for new features)
  • Documentation (both code and site) updated (if applicable)

@github-actions github-actions Bot added the C-lib Crate: cot (main library crate) label May 15, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

🐰 Bencher Report

Branchelijah/json-impls
Testbedgithub-ubuntu-latest
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
empty_router/empty_router📈 view plot
🚷 view threshold
6,635.50 µs
(+8.44%)Baseline: 6,118.81 µs
7,662.80 µs
(86.59%)
json_api/json_api📈 view plot
🚷 view threshold
1,066.50 µs
(-1.01%)Baseline: 1,077.34 µs
1,318.23 µs
(80.90%)
nested_routers/nested_routers📈 view plot
🚷 view threshold
967.29 µs
(-2.73%)Baseline: 994.40 µs
1,200.43 µs
(80.58%)
single_root_route/single_root_route📈 view plot
🚷 view threshold
939.97 µs
(-1.76%)Baseline: 956.85 µs
1,163.46 µs
(80.79%)
single_root_route_burst/single_root_route_burst📈 view plot
🚷 view threshold
15,938.00 µs
(-10.01%)Baseline: 17,711.61 µs
21,188.15 µs
(75.22%)
🐰 View full continuous benchmarking report in Bencher

@ElijahAhianyo ElijahAhianyo changed the title fix!: Implement Serialize, Deserialize, and JsonSchema implementations for cot internal types feat!: Implement Serialize, Deserialize, and JsonSchema implementations for cot internal types May 15, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

❌ Patch coverage is 99.41176% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cot/src/openapi.rs 99.27% 0 Missing and 1 partial ⚠️
Flag Coverage Δ
rust 90.16% <99.41%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cot/src/common_types.rs 69.11% <ø> (ø)
cot/src/db.rs 86.83% <100.00%> (+0.66%) ⬆️
cot/src/openapi.rs 95.60% <99.27%> (+0.84%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ElijahAhianyo ElijahAhianyo requested review from m4tx and seqre May 15, 2026 23:01
Copy link
Copy Markdown
Member

@m4tx m4tx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good to me, but let's improve the error handling before merging.

Comment thread cot/src/db.rs Outdated
Comment thread cot/src/openapi.rs Outdated
@ElijahAhianyo ElijahAhianyo requested a review from m4tx May 17, 2026 14:41
Copy link
Copy Markdown
Member

@m4tx m4tx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

@ElijahAhianyo ElijahAhianyo merged commit d0e43da into master May 17, 2026
43 checks passed
@ElijahAhianyo ElijahAhianyo deleted the elijah/json-impls branch May 17, 2026 23:03
@cotbot cotbot Bot mentioned this pull request May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-lib Crate: cot (main library crate)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants