Add try_build test testing new type body fields are declared last
This commit is contained in:
parent
b68b63ab8d
commit
f00bad3895
@ -3,4 +3,5 @@ fn ui() {
|
|||||||
let t = trybuild::TestCases::new();
|
let t = trybuild::TestCases::new();
|
||||||
t.pass("tests/ui/01-api-sanity-check.rs");
|
t.pass("tests/ui/01-api-sanity-check.rs");
|
||||||
t.compile_fail("tests/ui/02-invalid-path.rs");
|
t.compile_fail("tests/ui/02-invalid-path.rs");
|
||||||
|
t.pass("tests/ui/03-move-value.rs");
|
||||||
}
|
}
|
||||||
|
37
ruma-api/tests/ui/03-move-value.rs
Normal file
37
ruma-api/tests/ui/03-move-value.rs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
use ruma_api::ruma_api;
|
||||||
|
use ruma_identifiers::UserId;
|
||||||
|
|
||||||
|
ruma_api! {
|
||||||
|
metadata: {
|
||||||
|
description: "Does something.",
|
||||||
|
method: POST,
|
||||||
|
name: "my_endpoint",
|
||||||
|
path: "/_matrix/foo/:bar/",
|
||||||
|
rate_limited: false,
|
||||||
|
requires_authentication: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
request: {
|
||||||
|
#[ruma_api(body)]
|
||||||
|
pub q2: Vec<u8>,
|
||||||
|
|
||||||
|
#[ruma_api(path)]
|
||||||
|
pub bar: String,
|
||||||
|
|
||||||
|
#[ruma_api(query)]
|
||||||
|
pub baz: UserId,
|
||||||
|
|
||||||
|
#[ruma_api(header = CONTENT_TYPE)]
|
||||||
|
pub world: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
response: {
|
||||||
|
#[ruma_api(body)]
|
||||||
|
pub q2: Vec<u8>,
|
||||||
|
|
||||||
|
#[ruma_api(header = CONTENT_TYPE)]
|
||||||
|
pub world: String,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
x
Reference in New Issue
Block a user