Skip to content

Commit

Permalink
Merge pull request #394 from jsdelivr/oas
Browse files Browse the repository at this point in the history
Add OpenAPI docs and tests
  • Loading branch information
MartinKolarik committed Jul 25, 2023
2 parents 482562f + 4eec73a commit e1d38c9
Show file tree
Hide file tree
Showing 22 changed files with 2,128 additions and 75 deletions.
2 changes: 1 addition & 1 deletion docs/CLIENT_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- Use the following algorithm for measurement result pooling:
1. Request the measurement status.
2. If the status is `in-progress`, wait 500 ms and repeat from step 1. Note that it is important to wait 500 ms *after* receiving the response, instead of simply using an "every 500 ms" interval. For large measurements, the request itself may take a few hundred milliseconds to complete.
3. If the status is anything else, stop. The measurement is no longer running. Note that there are several possible status values, such as `finished`, `failed`, and `timed-out`. Any value other than `in-progress` is final.
3. If the status is anything else, stop. The measurement is no longer running. Any value other than `in-progress` is final.

Additional guidelines for non-browser based apps:
- Set a `User-Agent` header. The recommended format and approach is [as here](https://github.com/jsdelivr/data.jsdelivr.com/blob/60c5154d26c403ba9dd403a8ddc5e42a31931f0d/config/default.js#L9).
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"artillery": "^2.0.0-31",
"better-ajv-errors": "^1.2.0",
"c8": "^7.13.0",
Expand Down Expand Up @@ -121,7 +122,7 @@
"test:mocha": "NODE_ENV=test FAKE_PROBE_IP=1 NEW_RELIC_ENABLED=false NEW_RELIC_LOG_ENABLED=false mocha",
"test:mocha:dev": "TS_NODE_TRANSPILE_ONLY=true NODE_ENV=test FAKE_PROBE_IP=1 NEW_RELIC_ENABLED=false NEW_RELIC_LOG_ENABLED=false mocha",
"test:perf": "tsx test-perf/index.ts",
"test:portman": "start-test 'npm run start:test' http://localhost:3000/health 'npm run test:portman:create && npm run test:portman:run' 2> /dev/null || E=$?; rm -rf tmp; exit $E;",
"test:portman": "TEST_DONT_RESTART_WORKERS=1 start-test 'npm run start:test' http://localhost:3000/health 'npm run test:portman:create && npm run test:portman:run' 2> /dev/null || E=$?; rm -rf tmp; exit $E;",
"test:portman:create": "portman --cliOptionsFile test/tests/contract/portman-cli.json",
"test:portman:run": "newman run tmp/converted/globalpingApi.json -e test/tests/contract/newman-env.json --ignore-redirects"
},
Expand Down
2 changes: 1 addition & 1 deletion probes-stats/known.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const generateFiles = (data: ResultItem[], acc: {ipinfo: string, maxmind: string
`accuracy:,1,${acc.ipinfo},${acc.maxmind},${acc.fastly},${acc.algorithm}`,
...data.map(row => `${row.ip},${row.city},${row.ipinfo},${row.maxmind},${row.fastly},${row.algorithm}`),
].join('\n');
fs.writeFileSync('./probes-stats/known-result.json', JSON.stringify(data, null, 2));
fs.writeFileSync('./probes-stats/known-result.json', JSON.stringify(data, null, '\t'));
fs.writeFileSync('./probes-stats/known-result.csv', csvContent);
};

Expand Down
Loading

0 comments on commit e1d38c9

Please sign in to comment.