Skip to content

feat: added support for num types + dev tools fixes - #1578

Open
Dzordzu wants to merge 8 commits into
juhaku:masterfrom
Dzordzu:num-support
Open

feat: added support for num types + dev tools fixes#1578
Dzordzu wants to merge 8 commits into
juhaku:masterfrom
Dzordzu:num-support

Conversation

@Dzordzu

@Dzordzu Dzordzu commented Jul 3, 2026

Copy link
Copy Markdown

Changes

Added support for

std::num::{NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroIsize, NonZeroUsize};

Added non_strict_integers to test targets

It was failing on the master. Better to have it tested.

Added bacon + nextest to configs

It's a better dev experience ;)

Why?

Because these types are used by typify. And they are in the stdlib

Notes

@Dzordzu Dzordzu changed the title feat: added support for num types feat: added support for num types + updated toolchain Jul 4, 2026
@Dzordzu Dzordzu changed the title feat: added support for num types + updated toolchain feat: added support for num types, fixed non_strict_integers testing and updated toolchain Jul 4, 2026
@Dzordzu Dzordzu changed the title feat: added support for num types, fixed non_strict_integers testing and updated toolchain feat: added support for num types + toolchain fixes Jul 4, 2026
@Dzordzu Dzordzu changed the title feat: added support for num types + toolchain fixes feat: added support for num types + dev tools fixes Jul 4, 2026
Comment thread utoipa/src/lib.rs

#[cfg(feature = "non_strict_integers")]
#[test]
fn test_partial_schema_non_strict_integers() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add the respective new cases here too?
I know that this is not going to change the correctness, but more as a way to know that we are not going to regress on this 😉

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

@CommanderStorm CommanderStorm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks

Comment thread utoipa/src/lib.rs
Comment on lines +1691 to +1696
assert_compact_json_snapshot!(NonZeroI8::schema(), @r#"{"type": "integer", "format": "int8"}"#);
assert_compact_json_snapshot!(NonZeroI16::schema(), @r#"{"type": "integer", "format": "int16"}"#);
assert_compact_json_snapshot!(NonZeroI32::schema(), @r#"{"type": "integer", "format": "int32"}"#);
assert_compact_json_snapshot!(NonZeroI64::schema(), @r#"{"type": "integer", "format": "int64"}"#);
assert_compact_json_snapshot!(NonZeroI128::schema(), @r#"{"type": "integer"}"#);
assert_compact_json_snapshot!(NonZeroIsize::schema(), @r#"{"type": "integer"}"#);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On second thought:
Would this be better modeled by the union of an integer with an exclusive minimum and one with an exclusive maxium of 0?

I don't have a strong oppinion on this..

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hm. Not a bad idea tbh. Will try to do it today!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sorry for the delay. I'll try to implement this in the upcoming days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants