OAS: example payload

This commit is contained in:
realaravinth 2021-03-31 15:27:23 +05:30
parent 8aeab69303
commit 55dd3fffe5
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88
4 changed files with 20 additions and 6 deletions

File diff suppressed because one or more lines are too long

View file

@ -17,6 +17,10 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/RegisterUser'
example:
username: "testuser"
password: "mysuperlongandsecurepassword"
email: "testuser@example.com"
responses:
'200':
description: Successful registration
@ -48,6 +52,9 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/LoginUser'
example:
username: "testuser"
password: "mysuperlongandsecurepassword"
responses:
'200':
description: Successful authentication
@ -95,6 +102,8 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/DeleteUser'
example:
password: "mysuperlongandsecurepassword"
responses:
'200':
description: OK
@ -128,6 +137,8 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/UserDetailCheck'
example:
val: "testuser"
responses:
'200':
description: OK
@ -153,6 +164,8 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/UserDetailCheck'
example:
val: "testuser@example.com"
responses:
'200':
description: OK
@ -208,7 +221,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/addDomain'
$ref: '#/components/schemas/AddDomain'
responses:
'200':
@ -246,7 +259,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/addDomain'
$ref: '#/components/schemas/AddDomain'
responses:
'200':
@ -288,7 +301,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/addDomain'
$ref: '#/components/schemas/AddDomain'
responses:
'200':
@ -332,7 +345,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/addDomain'
$ref: '#/components/schemas/AddDomain'
responses:
'200':

View file

@ -31,6 +31,8 @@ pub struct AddLevels {
pub name: String,
}
// TODO try for non-existent token names
#[post("/api/v1/mcaptcha/domain/token/levels/add")]
pub async fn add_levels(
payload: web::Json<AddLevels>,

View file

@ -138,7 +138,6 @@ impl ResponseError for ServiceError {
ServiceError::ChallengeVerificationFailure => StatusCode::UNAUTHORIZED,
ServiceError::CaptchaError(e) => match e {
CaptchaError::MailboxError => StatusCode::INTERNAL_SERVER_ERROR,
_ => StatusCode::BAD_REQUEST,
},
}