json: rename python schema converter to make import easier

This commit is contained in:
ochafik 2024-04-08 19:32:30 +01:00
parent b73e564b16
commit 2148f244ca
4 changed files with 5 additions and 5 deletions

View file

@ -8,7 +8,7 @@ print(subprocess.check_output(
"python", "python",
os.path.join( os.path.join(
os.path.dirname(os.path.realpath(__file__)), os.path.dirname(os.path.realpath(__file__)),
"json-schema-to-grammar.py"), "json_schema_to_grammar.py"),
*rest, *rest,
"-", "-",
"--raw-pattern", "--raw-pattern",

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# ./examples/ts-type-to-grammar.sh "{a:string,b:string,c?:string}" # ./examples/ts-type-to-grammar.sh "{a:string,b:string,c?:string}"
# python examples/json-schema-to-grammar.py https://json.schemastore.org/tsconfig.json # python examples/json_schema_to_grammar.py https://json.schemastore.org/tsconfig.json
# #
set -euo pipefail set -euo pipefail
@ -25,4 +25,4 @@ npx ts-json-schema-generator --unstable --no-top-ref --path "$DTS_FILE" --type M
# https://github.com/YousefED/typescript-json-schema # https://github.com/YousefED/typescript-json-schema
# npx typescript-json-schema --defaultProps --required "$DTS_FILE" MyType | tee "$SCHEMA_FILE" >&2 # npx typescript-json-schema --defaultProps --required "$DTS_FILE" MyType | tee "$SCHEMA_FILE" >&2
./examples/json-schema-to-grammar.py "$SCHEMA_FILE" ./examples/json_schema_to_grammar.py "$SCHEMA_FILE"

View file

@ -816,7 +816,7 @@ int main() {
test_all("Python", [](const TestCase & tc) { test_all("Python", [](const TestCase & tc) {
write("test-json-schema-input.tmp", tc.schema); write("test-json-schema-input.tmp", tc.schema);
tc.verify_status(std::system( tc.verify_status(std::system(
"python ./examples/json-schema-to-grammar.py test-json-schema-input.tmp > test-grammar-output.tmp") == 0 ? SUCCESS : FAILURE); "python ./examples/json_schema_to_grammar.py test-json-schema-input.tmp > test-grammar-output.tmp") == 0 ? SUCCESS : FAILURE);
tc.verify(read("test-grammar-output.tmp")); tc.verify(read("test-grammar-output.tmp"));
}); });
} else { } else {