Add some doc comments
This commit is contained in:
parent
7914593d89
commit
d99a96fc8a
4 changed files with 22 additions and 11 deletions
|
@ -22,7 +22,6 @@ pub struct ValidationAttrs {
|
|||
|
||||
impl ValidationAttrs {
|
||||
pub fn new(attrs: &[syn::Attribute], errors: &Ctxt) -> Self {
|
||||
// TODO allow setting "validate" attributes through #[schemars(...)]
|
||||
ValidationAttrs::default()
|
||||
.populate(attrs, "schemars", false, errors)
|
||||
.populate(attrs, "validate", true, errors)
|
||||
|
|
|
@ -489,11 +489,7 @@ fn expr_for_struct(
|
|||
.map(|field| {
|
||||
let (ty, type_def) = type_for_field_schema(field);
|
||||
|
||||
let required = if field.validation_attrs.required {
|
||||
quote!(Some(true))
|
||||
} else {
|
||||
quote!(None)
|
||||
};
|
||||
let required = field.validation_attrs.required;
|
||||
|
||||
let args = quote!(gen, #required);
|
||||
let mut schema_expr = quote_spanned! {ty.span()=>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue