Skip to content

Node.js based forum software built for the modern web

feat: add registration/complete route, fix some other tests

Julian Lam14c51e3c60cb
diff --git a/public/openapi/read.yaml b/public/openapi/read.yaml
index a449b0e9c8..f4e684e1e2 100644
--- a/public/openapi/read.yaml
+++ b/public/openapi/read.yaml
@@ -123,6 +123,8 @@ paths:
$ref: 'read/admin/advanced/errors/export.yaml'
/api/admin/advanced/cache:
$ref: 'read/admin/advanced/cache.yaml'
+ /api/admin/advanced/cache/dump:
+ $ref: 'read/admin/advanced/cache.yaml' # todo: @baris to fix, see gh#9122
/api/admin/development/logger:
$ref: 'read/admin/development/logger.yaml'
/api/admin/development/info:
@@ -165,11 +167,11 @@ paths:
$ref: 'read/user/uid/userslug/export/uploads.yaml'
"/api/user/uid/{userslug}/export/profile":
$ref: 'read/user/uid/userslug/export/profile.yaml'
- "/api/post/pid/{id}":
+ "/api/{type}/pid/{id}":
$ref: 'read/post/pid/id.yaml'
- "/api/topic/tid/{id}":
+ "/api/{type}/tid/{id}":
$ref: 'read/topic/tid/id.yaml'
- "/api/category/cid/{id}":
+ "/api/{type}/cid/{id}":
$ref: 'read/category/cid/id.yaml'
/api/categories:
$ref: 'read/categories.yaml'
@@ -197,6 +199,8 @@ paths:
$ref: 'read/login.yaml'
/api/register:
$ref: 'read/register.yaml'
+ /api/register/complete:
+ $ref: 'read/register/complete.yaml'
/api/search:
$ref: 'read/search.yaml'
"/api/reset":
diff --git a/public/openapi/read/register.yaml b/public/openapi/read/register.yaml
index 199b496e03..74001416cc 100644
--- a/public/openapi/read/register.yaml
+++ b/public/openapi/read/register.yaml
@@ -54,28 +54,4 @@ get:
title:
type: string
- $ref: ../components/schemas/Breadcrumbs.yaml#/Breadcrumbs
- - $ref: ../components/schemas/CommonProps.yaml#/CommonProps
- # /api/register/complete:
- # get:
- # tags:
- # - authentication
- # summary: /api/register/complete
- # responses:
- # "200":
- # description: ""
- # content:
- # application/json:
- # schema:
- # allOf:
- # - type: object
- # properties:
- # title:
- # type: string
- # errors:
- # type: array
- # items: {}
- # sections:
- # type: array
- # items:
- # type: string
- # - $ref: ../components/schemas/CommonProps.yaml#/CommonProps
\ No newline at end of file
+ - $ref: ../components/schemas/CommonProps.yaml#/CommonProps
\ No newline at end of file
diff --git a/public/openapi/read/register/complete.yaml b/public/openapi/read/register/complete.yaml
new file mode 100644
index 0000000000..fe6471c850
--- /dev/null
+++ b/public/openapi/read/register/complete.yaml
@@ -0,0 +1,23 @@
+get:
+ tags:
+ - authentication
+ summary: /api/register/complete
+ responses:
+ "200":
+ description: ""
+ content:
+ application/json:
+ schema:
+ allOf:
+ - type: object
+ properties:
+ title:
+ type: string
+ errors:
+ type: array
+ items: {}
+ sections:
+ type: array
+ items:
+ type: string
+ - $ref: ../../components/schemas/CommonProps.yaml#/CommonProps
\ No newline at end of file
diff --git a/test/api.js b/test/api.js
index 7a00ae3d29..cd9b7e0141 100644
--- a/test/api.js
+++ b/test/api.js
@@ -212,6 +212,12 @@ describe('API', async () => {
schema = writeApi;
pathObj.path = pathObj.path.replace('/api/v3', '');
}
+
+ // Don't check non-GET routes in Read API
+ if (schema === readApi && pathObj.method !== 'get') {
+ return;
+ }
+
const normalizedPath = pathObj.path.replace(/\/:([^\\/]+)/g, '/{$1}').replace(/\?/g, '');
assert(schema.paths.hasOwnProperty(normalizedPath));
});