Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Commit 2716fb0

Browse files
committed
Tweak the schema to use summary instead of description and add tags
1 parent 69a0a7d commit 2716fb0

File tree

5 files changed

+30
-7
lines changed

5 files changed

+30
-7
lines changed

crates/handlers/src/admin/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use aide::{
1616
axum::ApiRouter,
17-
openapi::{OAuth2Flow, OAuth2Flows, OpenApi, SecurityScheme, Server},
17+
openapi::{OAuth2Flow, OAuth2Flows, OpenApi, SecurityScheme, Server, Tag},
1818
};
1919
use axum::{
2020
extract::{FromRef, FromRequestParts, State},
@@ -53,6 +53,11 @@ where
5353
.nest("/api/admin/v1", self::v1::router())
5454
.finish_api_with(&mut api, |t| {
5555
t.title("Matrix Authentication Service admin API")
56+
.tag(Tag {
57+
name: "user".to_owned(),
58+
description: Some("Manage users".to_owned()),
59+
..Tag::default()
60+
})
5661
.security_scheme(
5762
"oauth2",
5863
SecurityScheme::OAuth2 {

crates/handlers/src/admin/v1/users/by_username.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ pub struct UsernamePathParam {
5858

5959
pub fn doc(operation: TransformOperation) -> TransformOperation {
6060
operation
61-
.description("Get a user by its username (localpart)")
61+
.summary("Get a user by its username (localpart)")
62+
.tag("user")
6263
.response_with::<200, Json<SingleResponse<User>>, _>(|t| {
6364
let [sample, ..] = User::samples();
6465
let response =

crates/handlers/src/admin/v1/users/get.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ impl IntoResponse for RouteError {
5252

5353
pub fn doc(operation: TransformOperation) -> TransformOperation {
5454
operation
55-
.description("Get a user")
55+
.summary("Get a user")
56+
.tag("user")
5657
.response_with::<200, Json<SingleResponse<User>>, _>(|t| {
5758
let [sample, ..] = User::samples();
5859
let response = SingleResponse::new_canonical(sample);

crates/handlers/src/admin/v1/users/list.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ impl IntoResponse for RouteError {
100100

101101
pub fn doc(operation: TransformOperation) -> TransformOperation {
102102
operation
103-
.description("List users")
103+
.summary("List users")
104+
.tag("user")
104105
.response_with::<200, Json<PaginatedResponse<User>>, _>(|t| {
105106
let users = User::samples();
106107
let pagination = mas_storage::Pagination::first(users.len());

docs/api/spec.json

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
"paths": {
1919
"/api/admin/v1/users": {
2020
"get": {
21-
"description": "List users",
21+
"tags": [
22+
"user"
23+
],
24+
"summary": "List users",
2225
"parameters": [
2326
{
2427
"in": "query",
@@ -171,7 +174,10 @@
171174
},
172175
"/api/admin/v1/users/{id}": {
173176
"get": {
174-
"description": "Get a user",
177+
"tags": [
178+
"user"
179+
],
180+
"summary": "Get a user",
175181
"parameters": [
176182
{
177183
"in": "path",
@@ -238,7 +244,10 @@
238244
},
239245
"/api/admin/v1/users/by-username/{username}": {
240246
"get": {
241-
"description": "Get a user by its username (localpart)",
247+
"tags": [
248+
"user"
249+
],
250+
"summary": "Get a user by its username (localpart)",
242251
"parameters": [
243252
{
244253
"in": "path",
@@ -631,5 +640,11 @@
631640
"urn:mas:admin"
632641
]
633642
}
643+
],
644+
"tags": [
645+
{
646+
"name": "user",
647+
"description": "Manage users"
648+
}
634649
]
635650
}

0 commit comments

Comments
 (0)