Skip to content

Node.js based forum software built for the modern web

feat(api): schema definition for new credential checking route

Julian Lam0da2843281fe
diff --git a/public/openapi/write.yaml b/public/openapi/write.yaml
index 2b6266d64c..1c691bc5ac 100644
--- a/public/openapi/write.yaml
+++ b/public/openapi/write.yaml
@@ -42,6 +42,8 @@ tags:
paths:
/ping:
$ref: 'write/ping.yaml'
+ /utilities/login:
+ $ref: 'write/login.yaml'
/users/:
$ref: 'write/users.yaml'
/users/{uid}:
diff --git a/public/openapi/write/login.yaml b/public/openapi/write/login.yaml
new file mode 100644
index 0000000000..43ba2f8cb9
--- /dev/null
+++ b/public/openapi/write/login.yaml
@@ -0,0 +1,30 @@
+post:
+ tags:
+ - utilities
+ summary: verify login credentials
+ description: |
+ This route accepts a username/password or email/password pair (dependent on forum settings), returning a standard user object if credentials are validated successfully.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ username:
+ type: string
+ example: admin
+ password:
+ type: string
+ example: '123456'
+ responses:
+ '200':
+ description: credentials successfully validated
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ status:
+ $ref: ../components/schemas/Status.yaml#/Status
+ response:
+ $ref: ../components/schemas/UserObject.yaml#/UserObjectSlim
\ No newline at end of file
diff --git a/test/api.js b/test/api.js
index e4c28cfcef..730682a7e9 100644
--- a/test/api.js
+++ b/test/api.js
@@ -332,7 +332,7 @@ describe('API', async () => {
}
});
- it('should resolve with a 200 when called', async () => {
+ it('should not error out when called', async () => {
await setupData();
if (csrfToken) {
@@ -372,7 +372,7 @@ describe('API', async () => {
});
}
} catch (e) {
- assert(!e, `${method.toUpperCase()} ${path} resolved with ${e.message}`);
+ assert(!e, `${method.toUpperCase()} ${path} errored with: ${e.message}`);
}
});