Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #[schemars(with = ...)] alongside #[serde(transparent)] #67

Merged
merged 3 commits into from
Mar 21, 2021
Merged

Fix #[schemars(with = ...)] alongside #[serde(transparent)] #67

merged 3 commits into from
Mar 21, 2021

Conversation

dimbleby
Copy link
Contributor

@dimbleby dimbleby commented Dec 27, 2020

#typedef is not allowed in that position:

error: struct is not supported in `trait`s or `impl`s

(diff is easier to read ignoring whitespace: append ?w=1 to the url).

I'd love a patch release including this fix, if that's possible.

(My motivation is that I want a string field that has a pattern, so I'm doing something like:

#[serde(transparent)]
pub struct StringWithMyPattern(#[schemars(schema_with = "string_with_my_pattern")] pub String);

I see that #12 considers cleaner approaches - something like #[schemars(pattern = "regex")] would be good for me. I considered trying to make progress on implementing that, but to be honest I wasn't sure how to get started)

@dimbleby
Copy link
Contributor Author

dimbleby commented Dec 27, 2020

Ugh, underscore_const_names was stabilized in 1.37.0.

Do I need to find another way to write this, or can I just bump the minimum supported version?

@dimbleby
Copy link
Contributor Author

I see that #68 is failing CI at 1.36 for the same reason

@GREsau GREsau merged commit c4ef7ba into GREsau:master Mar 21, 2021
@GREsau
Copy link
Owner

GREsau commented Mar 21, 2021

Thanks @dimbleby!

@dimbleby dimbleby deleted the transparent-interactions branch March 21, 2021 13:58
@GREsau GREsau added this to the v0.8.1 milestone Mar 21, 2021
@GREsau
Copy link
Owner

GREsau commented Mar 23, 2021

This is now in the latest version on crates.io - https://crates.io/crates/schemars/0.8.1

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