Move move-value test decl into logical mods for each

This commit is contained in:
Devin Ragotzy 2020-07-29 08:43:22 -04:00
parent 47b6adb524
commit 71e537d123

View File

@ -1,49 +1,51 @@
use ruma_api::ruma_api;
use ruma_identifiers::UserId;
// This tests that the "body" fields are moved after all other fields because they
// consume the request/response.
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct Foo;
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: Foo,
#[ruma_api(path)]
pub bar: String,
#[ruma_api(query)]
pub baz: UserId,
#[ruma_api(header = CONTENT_TYPE)]
pub world: String,
}
response: {
#[ruma_api(raw_body)]
pub q2: Vec<u8>,
#[ruma_api(header = CONTENT_TYPE)]
pub world: String,
}
}
mod raw_body_request {
mod newtype_body {
use ruma_api::ruma_api;
use ruma_identifiers::UserId;
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct Foo;
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: Foo,
#[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: Foo,
#[ruma_api(header = CONTENT_TYPE)]
pub world: String,
}
}
}
mod newtype_raw_body {
use ruma_api::ruma_api;
use ruma_identifiers::UserId;
ruma_api! {
metadata: {
description: "Does something.",
@ -69,8 +71,8 @@ mod raw_body_request {
}
response: {
#[ruma_api(body)]
pub q2: Foo,
#[ruma_api(raw_body)]
pub q2: Vec<u8>,
#[ruma_api(header = CONTENT_TYPE)]
pub world: String,