yassun7010 / serde_valid

JSON Schema based validation tool using serde.
MIT License
46 stars 10 forks source link

Implicit dependency on once_cell crate #5

Closed farcaller closed 1 year ago

farcaller commented 1 year ago

It looks like this crate implicitly depends on once_cell being a dependency in

static #pattern_ident : ::once_cell::sync::OnceCell<::regex::Regex> = ::once_cell::sync::OnceCell::new();

But this isn't documented anywhere.

yassun7010 commented 1 year ago

Thank you for your suggestion.

The crate that serde_valid depends on is written in Cargo.toml, but there seems to be a culture in Rust to make it explicit in the documentation.

Do you have any references to the rules for projects and documentation? I would like to study them.

farcaller commented 1 year ago

I don't think it works this way. The macro unwraps not in the context of your crate, but the destination crate which might not have the once_cell dependency (mine didn't).

One option would be to re-export the symbols of once_cell through serde_vaild and then depend on them – because the serde_valid dependency is required to be explicit.

yassun7010 commented 1 year ago

Ah, I see why!

I will try to re-export the once_cell from serde_valid :)

yassun7010 commented 1 year ago

@farcaller I released v1.12.0