You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-31 09:24:31 +03:00
Tweak the schema to use summary instead of description and add tags
This commit is contained in:
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
use aide::{
|
use aide::{
|
||||||
axum::ApiRouter,
|
axum::ApiRouter,
|
||||||
openapi::{OAuth2Flow, OAuth2Flows, OpenApi, SecurityScheme, Server},
|
openapi::{OAuth2Flow, OAuth2Flows, OpenApi, SecurityScheme, Server, Tag},
|
||||||
};
|
};
|
||||||
use axum::{
|
use axum::{
|
||||||
extract::{FromRef, FromRequestParts, State},
|
extract::{FromRef, FromRequestParts, State},
|
||||||
@ -53,6 +53,11 @@ where
|
|||||||
.nest("/api/admin/v1", self::v1::router())
|
.nest("/api/admin/v1", self::v1::router())
|
||||||
.finish_api_with(&mut api, |t| {
|
.finish_api_with(&mut api, |t| {
|
||||||
t.title("Matrix Authentication Service admin API")
|
t.title("Matrix Authentication Service admin API")
|
||||||
|
.tag(Tag {
|
||||||
|
name: "user".to_owned(),
|
||||||
|
description: Some("Manage users".to_owned()),
|
||||||
|
..Tag::default()
|
||||||
|
})
|
||||||
.security_scheme(
|
.security_scheme(
|
||||||
"oauth2",
|
"oauth2",
|
||||||
SecurityScheme::OAuth2 {
|
SecurityScheme::OAuth2 {
|
||||||
|
@ -58,7 +58,8 @@ pub struct UsernamePathParam {
|
|||||||
|
|
||||||
pub fn doc(operation: TransformOperation) -> TransformOperation {
|
pub fn doc(operation: TransformOperation) -> TransformOperation {
|
||||||
operation
|
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| {
|
.response_with::<200, Json<SingleResponse<User>>, _>(|t| {
|
||||||
let [sample, ..] = User::samples();
|
let [sample, ..] = User::samples();
|
||||||
let response =
|
let response =
|
||||||
|
@ -52,7 +52,8 @@ impl IntoResponse for RouteError {
|
|||||||
|
|
||||||
pub fn doc(operation: TransformOperation) -> TransformOperation {
|
pub fn doc(operation: TransformOperation) -> TransformOperation {
|
||||||
operation
|
operation
|
||||||
.description("Get a user")
|
.summary("Get a user")
|
||||||
|
.tag("user")
|
||||||
.response_with::<200, Json<SingleResponse<User>>, _>(|t| {
|
.response_with::<200, Json<SingleResponse<User>>, _>(|t| {
|
||||||
let [sample, ..] = User::samples();
|
let [sample, ..] = User::samples();
|
||||||
let response = SingleResponse::new_canonical(sample);
|
let response = SingleResponse::new_canonical(sample);
|
||||||
|
@ -100,7 +100,8 @@ impl IntoResponse for RouteError {
|
|||||||
|
|
||||||
pub fn doc(operation: TransformOperation) -> TransformOperation {
|
pub fn doc(operation: TransformOperation) -> TransformOperation {
|
||||||
operation
|
operation
|
||||||
.description("List users")
|
.summary("List users")
|
||||||
|
.tag("user")
|
||||||
.response_with::<200, Json<PaginatedResponse<User>>, _>(|t| {
|
.response_with::<200, Json<PaginatedResponse<User>>, _>(|t| {
|
||||||
let users = User::samples();
|
let users = User::samples();
|
||||||
let pagination = mas_storage::Pagination::first(users.len());
|
let pagination = mas_storage::Pagination::first(users.len());
|
||||||
|
@ -18,7 +18,10 @@
|
|||||||
"paths": {
|
"paths": {
|
||||||
"/api/admin/v1/users": {
|
"/api/admin/v1/users": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "List users",
|
"tags": [
|
||||||
|
"user"
|
||||||
|
],
|
||||||
|
"summary": "List users",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"in": "query",
|
"in": "query",
|
||||||
@ -171,7 +174,10 @@
|
|||||||
},
|
},
|
||||||
"/api/admin/v1/users/{id}": {
|
"/api/admin/v1/users/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Get a user",
|
"tags": [
|
||||||
|
"user"
|
||||||
|
],
|
||||||
|
"summary": "Get a user",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"in": "path",
|
"in": "path",
|
||||||
@ -238,7 +244,10 @@
|
|||||||
},
|
},
|
||||||
"/api/admin/v1/users/by-username/{username}": {
|
"/api/admin/v1/users/by-username/{username}": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Get a user by its username (localpart)",
|
"tags": [
|
||||||
|
"user"
|
||||||
|
],
|
||||||
|
"summary": "Get a user by its username (localpart)",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"in": "path",
|
"in": "path",
|
||||||
@ -631,5 +640,11 @@
|
|||||||
"urn:mas:admin"
|
"urn:mas:admin"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"name": "user",
|
||||||
|
"description": "Manage users"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user