Skip to content
This repository was archived by the owner on Apr 3, 2019. It is now read-only.

Commit fedaa23

Browse files
committed
fix(scripts): fix the broken api docs generator script
Fixes #2521. Two things were wrong with it: 1. We started using object destructuring, which necessitates a version bump for the JS version in Acorn. 2. The upgrade to Hapi 17 changed the property name for route settings from `config` to `options`, so the script needed the same.
1 parent 2cb7642 commit fedaa23

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

docs/api.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ see [`mozilla/fxa-js-client`](https://github.com/mozilla/fxa-js-client).
6060
* [POST /session/verify/recoveryCode (:lock: sessionToken)](#post-sessionverifyrecoverycode)
6161
* [Recovery key](#recovery-key)
6262
* [POST /recoveryKey (:lock: sessionToken)](#post-recoverykey)
63-
* [GET /recoveryKey/:recoveryKeyId (:lock: accountResetToken)](#get-recoverykey)
64-
* [POST /recoveryKey/exists (:lock: sessionToken)](#post-recoverykeyexists)
63+
* [GET /recoveryKey/{recoveryKeyId} (:lock: accountResetToken)](#get-recoverykeyrecoverykeyid)
64+
* [POST /recoveryKey/exists (:lock::unlock: sessionToken)](#post-recoverykeyexists)
6565
* [DELETE /recoveryKey (:lock: sessionToken)](#delete-recoverykey)
6666
* [Session](#session)
6767
* [POST /session/destroy (:lock: sessionToken)](#post-sessiondestroy)
@@ -2258,6 +2258,12 @@ to reset the account password and `wrapKb`.
22582258

22592259
<!--end-request-body-post-passwordforgotverify_code-metricsContext-->
22602260

2261+
* `accountResetWithRecoveryKey`: *boolean, optional*
2262+
2263+
<!--begin-request-body-post-passwordforgotverify_code-accountResetWithRecoveryKey-->
2264+
2265+
<!--end-request-body-post-passwordforgotverify_code-accountResetWithRecoveryKey-->
2266+
22612267
##### Response body
22622268

22632269
* `accountResetToken`: *string*
@@ -2382,23 +2388,17 @@ For more details, see the
23822388
<!--end-request-body-post-recoverykey-recoveryData-->
23832389

23842390

2385-
#### GET /recoveryKey/:recoveryKeyId
2391+
#### GET /recoveryKey/{recoveryKeyId}
23862392

23872393
:lock: HAWK-authenticated with account reset token
23882394
<!--begin-route-get-recoverykeyrecoverykeyid-->
23892395
Retrieve the account recovery data associated with the given recovery key.
23902396
<!--end-route-get-recoverykeyrecoverykeyid-->
23912397

2392-
##### Response body
2393-
2394-
* `recoveryData`: *string*
2395-
2396-
<!--begin-response-body-post-recoverykeyrecoverykeyid-recoverydata-->
2397-
2398-
<!--end-response-body-post-recoverykeyrecoverykeyid-recoverydata-->
23992398

24002399
#### POST /recoveryKey/exists
2401-
:lock: HAWK-authenticated with session token
2400+
2401+
:lock::unlock: Optionally HAWK-authenticated with session token
24022402
<!--begin-route-post-recoverykeyexists-->
24032403
This route checks to see if given user has setup an account recovery key.
24042404
When used during the password reset flow, an email can be provided (instead
@@ -2408,26 +2408,30 @@ using an email, the request is rate limited.
24082408

24092409
##### Request body
24102410

2411-
* `email`: *validators.email.required*
2411+
* `email`: *validators.email.optional*
24122412

24132413
<!--begin-request-body-post-recoverykeyexists-email-->
2414-
2414+
24152415
<!--end-request-body-post-recoverykeyexists-email-->
24162416

24172417
##### Response body
24182418

2419-
* `status`: *boolean, required*
2419+
* `exists`: *boolean, required*
24202420

2421-
<!--begin-response-body-post-recoverykeyexists-email-->
2421+
<!--begin-response-body-post-recoverykeyexists-exists-->
2422+
2423+
<!--end-response-body-post-recoverykeyexists-exists-->
24222424

2423-
<!--end-response-body-post-recoverykeyexists-email-->
24242425

24252426
#### DELETE /recoveryKey
2427+
2428+
:lock: HAWK-authenticated with session token
24262429
<!--begin-route-delete-recoverykey-->
24272430
This route remove an account's recovery key. When the key is
24282431
removed, it can no longer be used to restore an account's kB.
24292432
<!--end-route-delete-recoverykey-->
24302433

2434+
24312435
### Session
24322436

24332437
#### POST /session/destroy

scripts/write-api-docs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const render = handlebars.compile(
2323
// will be propagated to the same place each time the docs are regenerated.
2424
const DOCS_DATA = /<!--begin-([a-z_]+(?:-[a-z_]+)*)-->((?:.*?\n?.*?)*?)<!--end-([a-z_]+(?:-[a-z_]+)*)-->/gi
2525
const ACORN_OPTIONS = {
26+
ecmaVersion: 10,
2627
locations: true,
2728
sourceType: 'script'
2829
}
@@ -481,7 +482,7 @@ function findRouteMethod (route, filePath) {
481482
}
482483

483484
function findRouteConfig (route, filePath) {
484-
return findProperty(route, 'config', OBJECT_TYPES, filePath)
485+
return findProperty(route, 'options', OBJECT_TYPES, filePath)
485486
}
486487

487488
function findRouteAuthentication (config, filePath) {

0 commit comments

Comments
 (0)