Skip to content

Commit

Permalink
generate schema with ejs
Browse files Browse the repository at this point in the history
  • Loading branch information
sakari committed Oct 25, 2024
1 parent a3bb498 commit db54067
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3,816 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"lint:local": "eslint --max-warnings=0 --ext .ts test examples",
"lint": "yarn lint:local && lerna run lint",
"lint:fix": "yarn lint:local && lerna run lint:fix",
"generate": "yarn generate:examples && yarn generate:test",
"generate": "yarn generate:ejs && yarn generate:examples && yarn generate:test",
"generate:ejs": "find test -name '*.ejs' -exec /bin/sh -c 'yarn ejs -o ${1%.*} $1' --hide-banner {} \\;",
"generate:test": "find test -name 'driver.ts' -exec ts-node -r tsconfig-paths/register --project tsconfig.json {} \\;",
"generate:examples": "ts-node -r tsconfig-paths/register --project tsconfig.json examples/driver.ts && ts-node -r tsconfig-paths/register --project tsconfig.json render.ts",
"render": "yarn doc && lerna run render",
Expand Down Expand Up @@ -56,6 +57,7 @@
"@typescript-eslint/parser": "5.59.11",
"ajv": "^8.17.1",
"axios": "1.7.4",
"ejs": "^3.1.10",
"eslint": "8.42.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-import": "2.27.5",
Expand Down
1 change: 1 addition & 0 deletions test/benchmark-with-ajv/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
api.yml
16 changes: 12 additions & 4 deletions test/benchmark-with-ajv/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Benchmark against ajv

run `erb api.yml.erb > api.yml` in this directory
run `yarn generate` in root directory
run tests in the benchmark.spec.ts
Run `yarn generate` in root directory to generate the necessary artifacts. This will generate type definitions and the
openapi schema for the bencmark test data.

Run the benchmark.spec.ts test using jest. Note that the benchmark test does not fail but outputs timing information to
console.log.

Sizes of the data can be configured in the test file. Note however that the generated data must match the schema in
api.yml

## Change the benchmark schema

The benchmark schema in api.yml is generated from an ejs template in api.yml.ejs.

The benchmark outputs timing information. Sizes of the data can be configured in the test file.
Loading

0 comments on commit db54067

Please sign in to comment.