Detect header attributes as name/value pairs.
This commit is contained in:
parent
a035c233be
commit
f0f4f9bd17
@ -96,21 +96,22 @@ impl From<Vec<Field>> for Request {
|
|||||||
has_newtype_body = true;
|
has_newtype_body = true;
|
||||||
field_kind = RequestFieldKind::NewtypeBody;
|
field_kind = RequestFieldKind::NewtypeBody;
|
||||||
}
|
}
|
||||||
"header" => field_kind = RequestFieldKind::Header,
|
|
||||||
"path" => field_kind = RequestFieldKind::Path,
|
"path" => field_kind = RequestFieldKind::Path,
|
||||||
"query" => field_kind = RequestFieldKind::Query,
|
"query" => field_kind = RequestFieldKind::Query,
|
||||||
_ => panic!(
|
_ => panic!("ruma_api! single-word attribute on requests must be: body, path, or query"),
|
||||||
"ruma_api! attribute meta item on requests must be: body, header, path, or query"
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => panic!(
|
Meta::NameValue(name_value) => {
|
||||||
"ruma_api! attribute meta item on requests cannot be a list or name/value pair"
|
match name_value.ident.as_ref() {
|
||||||
),
|
"header" => field_kind = RequestFieldKind::Header,
|
||||||
|
_ => panic!("ruma_api! name/value pair attribute on requests must be: header"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => panic!("ruma_api! attributes on requests must be a single word or a name/value pair"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NestedMeta::Literal(_) => panic!(
|
NestedMeta::Literal(_) => panic!(
|
||||||
"ruma_api! attribute meta item on requests must be: body, header, path, or query"
|
"ruma_api! attributes on requests must be: body, header, path, or query"
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,15 +104,16 @@ impl From<Vec<Field>> for Response {
|
|||||||
has_newtype_body = true;
|
has_newtype_body = true;
|
||||||
field_kind = ResponseFieldKind::NewtypeBody;
|
field_kind = ResponseFieldKind::NewtypeBody;
|
||||||
}
|
}
|
||||||
|
_ => panic!("ruma_api! single-word attribute on responses must be: body"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Meta::NameValue(name_value) => {
|
||||||
|
match name_value.ident.as_ref() {
|
||||||
"header" => field_kind = ResponseFieldKind::Header,
|
"header" => field_kind = ResponseFieldKind::Header,
|
||||||
_ => panic!(
|
_ => panic!("ruma_api! name/value pair attribute on requests must be: header"),
|
||||||
"ruma_api! attribute meta item on responses must be: header"
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => panic!(
|
_ => panic!("ruma_api! attributes on responses must be a single word or a name/value pair"),
|
||||||
"ruma_api! attribute meta item on responses cannot be a list or name/value pair"
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NestedMeta::Literal(_) => panic!(
|
NestedMeta::Literal(_) => panic!(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user