Disallow multiple ruma_api(body) attributes in one request / response
This commit is contained in:
parent
47267cc2ba
commit
c8f1342144
@ -144,6 +144,11 @@ impl From<Vec<Field>> for Request {
|
||||
Meta::Word(ident) => {
|
||||
match &ident.to_string()[..] {
|
||||
"body" => {
|
||||
assert!(
|
||||
!has_newtype_body,
|
||||
"ruma_api! body attribute can only be used once per request definition"
|
||||
);
|
||||
|
||||
has_newtype_body = true;
|
||||
field_kind = RequestFieldKind::NewtypeBody;
|
||||
}
|
||||
|
@ -116,6 +116,10 @@ impl From<Vec<Field>> for Response {
|
||||
ident == "body",
|
||||
"ruma_api! single-word attribute on responses must be: body"
|
||||
);
|
||||
assert!(
|
||||
!has_newtype_body,
|
||||
"ruma_api! body attribute can only be used once per response definition"
|
||||
);
|
||||
|
||||
has_newtype_body = true;
|
||||
field_kind = ResponseFieldKind::NewtypeBody;
|
||||
|
Loading…
x
Reference in New Issue
Block a user