We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
path = "..."
Because of syntax difference in regex validation between Validator and schemars, compile error occurs when using regex. In validators,
#[validate(regex(path = *RE_TWO_CHARS))]
While schemars,
#[validate(regex(path = "RE_TWO_CHARS"))]
Sample:
static RE_TWO_CHARS: Lazy<Regex> = Lazy::new(|| Regex::new(r"[a-z]{2}$").unwrap()); #[derive(Deserialize, Debug, Validate, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct SampleJdto { #[validate(regex(path = *RE_TWO_CHARS))] pub project_name: String, }
The text was updated successfully, but these errors were encountered:
regex(path = ...)
This is fixed in schemars 1.0.0-alpha.13 🙂
The schema generated from the sample given in this issue is now:
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "SampleJdto", "type": "object", "properties": { "projectName": { "type": "string", "pattern": "[a-z]{2}$" } }, "required": [ "projectName" ] }
Sorry, something went wrong.
No branches or pull requests
Because of syntax difference in regex validation between Validator and schemars, compile error occurs when using regex.
In validators,
#[validate(regex(path = *RE_TWO_CHARS))]
While schemars,
#[validate(regex(path = "RE_TWO_CHARS"))]
Sample:
The text was updated successfully, but these errors were encountered: