1
0
Fork 0
ruma/crates/ruma-common/tests/it/api/ui/serde-flatten-response-body.rs
Kévin Commaille c2db18e3ae api: Require authentication type to be in scope
Instead of only supporting the types in ruma_common::api::auth_scheme.

This allows to use custom types. This is also necessary to complete the
implementation of `OutgoingRequest::add_authentication` of
`ServerSignatures`, we need to use the `XMatrix` type in
ruma-federation-api. One solution is to move `ServerSignatures` to that
crate.
2025-10-20 18:15:11 +02:00

32 lines
618 B
Rust

#![allow(unexpected_cfgs)]
use ruma_common::{
api::{auth_scheme::NoAuthentication, request, response},
metadata,
};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CustomResponseBody {
pub bar: String,
}
metadata! {
method: GET, // An `http::Method` constant. No imports required.
rate_limited: false,
authentication: NoAuthentication,
history: {
unstable => "/_matrix/some/endpoint",
}
}
#[request]
pub struct Request;
#[response]
pub struct Response {
#[serde(flatten)]
pub foo: CustomResponseBody,
}
fn main() {}