Skip to content

Commit bbc0651

Browse files
committed
Make all implementations accept only the path
1 parent 9330fed commit bbc0651

File tree

6 files changed

+29
-25
lines changed

6 files changed

+29
-25
lines changed

Makefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ all: dist/report.csv ; cat $<
3030
define docker_run
3131
$(eval $@_TOOL = $(1))
3232
$(eval $@_INPUT = $(2))
33-
-$(shell docker run --rm -v $(CURDIR):/workspace jsonschema-benchmark/$($@_TOOL) $($@_INPUT) > $@)
33+
-$(shell docker run --rm -v $(CURDIR):/workspace jsonschema-benchmark/$($@_TOOL) /workspace/$(dir $(word 2, $($@_INPUT))) > $@)
3434
@if [ ! -s $@ ]; then echo "0,0" > $@ ; fi
3535
@sed -i 's/$$/,$(.SHELLSTATUS)/' $@
3636
endef
@@ -49,7 +49,7 @@ dist/results/blaze/%: \
4949
schemas/%/schema.json \
5050
schemas/%/instances.jsonl \
5151
| dist/results/blaze
52-
@$(call docker_run,blaze,/workspace/$(dir $(word 2,$^)))
52+
@$(call docker_run,blaze,$^)
5353

5454
implementations/blaze-nodejs/.dockertimestamp: \
5555
implementations/blaze-nodejs/main.mjs \
@@ -62,7 +62,7 @@ dist/results/blaze-nodejs/%: \
6262
schemas/%/schema.json \
6363
schemas/%/instances.jsonl \
6464
| dist/results/blaze-nodejs
65-
@$(call docker_run,blaze-nodejs,/workspace/$(word 2,$^) /workspace/$(word 3,$^))
65+
@$(call docker_run,blaze-nodejs,$^)
6666

6767
# AJV
6868

@@ -79,7 +79,7 @@ dist/results/ajv/%: \
7979
schemas/%/schema.json \
8080
schemas/%/instances.jsonl \
8181
| dist/results/ajv
82-
@$(call docker_run,ajv,/workspace/$(word 2,$^) /workspace/$(word 3,$^))
82+
@$(call docker_run,ajv,/workspace/$(dir $(word 2,$^)))
8383

8484
# BOON
8585

@@ -95,7 +95,7 @@ dist/results/boon/%: \
9595
schemas/%/schema.json \
9696
schemas/%/instances.jsonl \
9797
| dist/results/boon
98-
@$(call docker_run,boon,/workspace/$(dir $(word 2,$^)))
98+
@$(call docker_run,boon,$^)
9999

100100
# JSON_SCHEMER
101101

@@ -112,7 +112,7 @@ dist/results/json_schemer/%: \
112112
schemas/%/schema.json \
113113
schemas/%/instances.jsonl \
114114
| dist/results/json_schemer
115-
@$(call docker_run,json_schemer,/workspace/$(dir $(word 3,$^)))
115+
@$(call docker_run,json_schemer,$^)
116116

117117
# PYTHON / JSONSCHEMA
118118

@@ -146,7 +146,7 @@ dist/results/go-jsonschema/%: \
146146
schemas/%/schema.json \
147147
schemas/%/instances.jsonl \
148148
| dist/results/go-jsonschema
149-
@$(call docker_run,go-jsonschema,/workspace/$(dir $(word 2,$^)))
149+
@$(call docker_run,go-jsonschema,$^)
150150

151151
# HYPERJUMP
152152

@@ -163,7 +163,7 @@ dist/results/hyperjump/%: \
163163
schemas/%/schema.json \
164164
schemas/%/instances.jsonl \
165165
| dist/results/hyperjump
166-
@$(call docker_run,hyperjump,/workspace/$(word 2,$^) /workspace/$(word 3,$^))
166+
@$(call docker_run,hyperjump,$^)
167167

168168
# JSONCONS
169169

@@ -181,7 +181,7 @@ dist/results/jsoncons/%: \
181181
schemas/%/schema.json \
182182
schemas/%/instances.jsonl \
183183
| dist/results/jsoncons
184-
@$(call docker_run,jsoncons,/workspace/$(dir $(word 2,$^)))
184+
@$(call docker_run,jsoncons,$^)
185185

186186
# DOTNET / CORVUS
187187

@@ -198,7 +198,7 @@ dist/results/corvus/%: \
198198
schemas/%/schema.json \
199199
schemas/%/instances.jsonl \
200200
| dist/results/corvus
201-
@$(call docker_run,corvus,/workspace/$(word 2,$^) /workspace/$(word 3,$^))
201+
@$(call docker_run,corvus,$^)
202202

203203
# SCHEMASAFE
204204

@@ -215,4 +215,4 @@ dist/results/schemasafe/%: \
215215
schemas/%/schema.json \
216216
schemas/%/instances.jsonl \
217217
| dist/results/schemasafe
218-
@$(call docker_run,schemasafe,/workspace/$(word 2,$^) /workspace/$(word 3,$^))
218+
@$(call docker_run,schemasafe,$^)

implementations/ajv/main.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from 'fs';
2+
import path from 'path';
23
import readline from 'readline';
34
import { performance } from 'perf_hooks';
45

@@ -59,11 +60,11 @@ async function validateSchema(schemaPath, instancePath) {
5960
}
6061
}
6162

62-
if (process.argv.length !== 4) {
63+
if (process.argv.length !== 3) {
6364
process.exit(1);
6465
}
6566

66-
const schemaPath = process.argv[2];
67-
const instancePath = process.argv[3];
67+
const schemaPath = path.join(process.argv[2], "schema.json");
68+
const instancePath = path.join(process.argv[2], "/instances.jsonl");
6869

6970
await validateSchema(schemaPath, instancePath);

implementations/blaze-nodejs/main.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { compile, evaluate } from './repo/bindings/nodejs/blaze.js';
22

33
import fs from 'fs';
4+
import path from 'path';
45
import readline from 'readline';
56
import { performance } from 'perf_hooks';
67

@@ -54,11 +55,11 @@ async function validateSchema(schemaPath, instancePath) {
5455
}
5556
}
5657

57-
if (process.argv.length !== 4) {
58+
if (process.argv.length !== 3) {
5859
process.exit(1);
5960
}
6061

61-
const schemaPath = process.argv[2];
62-
const instancePath = process.argv[3];
62+
const schemaPath = path.join(process.argv[2], "schema.json");
63+
const instancePath = path.join(process.argv[2], "/instances.jsonl");
6364

6465
await validateSchema(schemaPath, instancePath);

implementations/corvus/generate-and-run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
SCHEMA=$1
4-
INSTANCES=$2
3+
SCHEMA=$1/schema.json
4+
INSTANCES=$1/instances.jsonl
55

66
dialect=$(grep '$schema' $SCHEMA | head -1 | cut -d: -f2- | tr -d '", \n' | sed -nE 's_https?://json-schema.org/(.*)/schema#?_\1_p')
77
case "$dialect" in

implementations/hyperjump/main.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { registerSchema, validate } from "@hyperjump/json-schema/draft-2020-12";
22
import fs from 'fs';
3+
import path from 'path';
34
import readline from 'readline';
45
import { performance } from 'perf_hooks';
56

@@ -61,11 +62,11 @@ async function validateSchema(schemaPath, instancePath) {
6162
}
6263
}
6364

64-
if (process.argv.length !== 4) {
65+
if (process.argv.length !== 3) {
6566
process.exit(1);
6667
}
6768

68-
const schemaPath = process.argv[2];
69-
const instancePath = process.argv[3];
69+
const schemaPath = path.join(process.argv[2], "schema.json");
70+
const instancePath = path.join(process.argv[2], "/instances.jsonl");
7071

7172
await validateSchema(schemaPath, instancePath);

implementations/schemasafe/main.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { validator } from '@exodus/schemasafe';
22
import fs from 'fs';
3+
import path from 'path';
34
import readline from 'readline';
45
import { performance } from 'perf_hooks';
56

@@ -55,11 +56,11 @@ async function validateSchema(schemaPath, instancePath) {
5556
}
5657
}
5758

58-
if (process.argv.length !== 4) {
59+
if (process.argv.length !== 3) {
5960
process.exit(1);
6061
}
6162

62-
const schemaPath = process.argv[2];
63-
const instancePath = process.argv[3];
63+
const schemaPath = path.join(process.argv[2], "schema.json");
64+
const instancePath = path.join(process.argv[2], "/instances.jsonl");
6465

6566
await validateSchema(schemaPath, instancePath);

0 commit comments

Comments
 (0)