1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

Tweak the schema to use summary instead of description and add tags

This commit is contained in:
Quentin Gliech
2024-07-26 17:19:15 +02:00
parent 3f947025e2
commit cdecac735e
5 changed files with 30 additions and 7 deletions

View File

@ -14,7 +14,7 @@
use aide::{
axum::ApiRouter,
openapi::{OAuth2Flow, OAuth2Flows, OpenApi, SecurityScheme, Server},
openapi::{OAuth2Flow, OAuth2Flows, OpenApi, SecurityScheme, Server, Tag},
};
use axum::{
extract::{FromRef, FromRequestParts, State},
@ -53,6 +53,11 @@ where
.nest("/api/admin/v1", self::v1::router())
.finish_api_with(&mut api, |t| {
t.title("Matrix Authentication Service admin API")
.tag(Tag {
name: "user".to_owned(),
description: Some("Manage users".to_owned()),
..Tag::default()
})
.security_scheme(
"oauth2",
SecurityScheme::OAuth2 {

View File

@ -58,7 +58,8 @@ pub struct UsernamePathParam {
pub fn doc(operation: TransformOperation) -> TransformOperation {
operation
.description("Get a user by its username (localpart)")
.summary("Get a user by its username (localpart)")
.tag("user")
.response_with::<200, Json<SingleResponse<User>>, _>(|t| {
let [sample, ..] = User::samples();
let response =

View File

@ -52,7 +52,8 @@ impl IntoResponse for RouteError {
pub fn doc(operation: TransformOperation) -> TransformOperation {
operation
.description("Get a user")
.summary("Get a user")
.tag("user")
.response_with::<200, Json<SingleResponse<User>>, _>(|t| {
let [sample, ..] = User::samples();
let response = SingleResponse::new_canonical(sample);

View File

@ -100,7 +100,8 @@ impl IntoResponse for RouteError {
pub fn doc(operation: TransformOperation) -> TransformOperation {
operation
.description("List users")
.summary("List users")
.tag("user")
.response_with::<200, Json<PaginatedResponse<User>>, _>(|t| {
let users = User::samples();
let pagination = mas_storage::Pagination::first(users.len());