This directory contains utility scripts for the Sequence documentation.
The update_security_schemas.js script updates the security schemas in all JSON files in the api-references directory and its subdirectories.
- Node.js (v12 or higher)
- npm
Install dependencies:
cd scripts
npm installRun the script:
cd scripts
npm startOr directly:
cd scripts
node update_security_schemas.jsThe script:
- Finds all JSON files in the api-references directory and its subdirectories
- For each file, it analyzes the endpoints to determine if they are public or secret:
- If an endpoint has a tag of 'public', it's considered public
- If an endpoint has a tag of 'secret', it's considered secret
- If no explicit tags are found, endpoints are considered public by default
- Updates the security schemas accordingly:
- If a file has ANY secret endpoints, it sets the BearerAuth schema with the token "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiMHhiZWU3NGU3ZmZkNzdkMThhZDJhOTg2ODEyZGE2MTc5ODk0MDY4ODZjIiwiaWF0IjoxNzQxNjg3NDg4LCJwcm9qZWN0IjoxNjgxNX0.LvTwKf0T6IBK9HuRFboXCNh2YY9d6EwDoQAlGYC80KQ"
- Otherwise, it sets the ApiKeyAuth schema with the key "AQAAAAAAAEGvyZiWA9FMslYeG_yayXaHnSI"
- Updates the global security section for each file
The script will print:
- Each file it updates and whether it contains public or secret endpoints
- A summary of how many files were updated out of the total number of JSON files found