json: indent 4 spaces
This commit is contained in:
parent
7628bd8c76
commit
10ee30f1b8
5 changed files with 868 additions and 869 deletions
|
@ -4,9 +4,9 @@
|
||||||
#! python json-schema-pydantic-example.py
|
#! python json-schema-pydantic-example.py
|
||||||
|
|
||||||
from pydantic import BaseModel, TypeAdapter
|
from pydantic import BaseModel, TypeAdapter
|
||||||
from annotated_types import MaxLen, MinLen
|
from annotated_types import MinLen
|
||||||
from typing import Annotated, Iterable, List, Optional
|
from typing import Annotated, List, Optional
|
||||||
import enum, json, requests
|
import json, requests
|
||||||
|
|
||||||
if True:
|
if True:
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,8 @@ static std::string trim(const std::string & source) {
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TestCaseStatus {
|
enum TestCaseStatus {
|
||||||
SUCCESS, FAILURE
|
SUCCESS,
|
||||||
|
FAILURE
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TestCase {
|
struct TestCase {
|
||||||
|
@ -810,14 +811,12 @@ 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"));
|
||||||
});
|
});
|
||||||
test_all("JavaScript", [](const TestCase& tc) {
|
test_all("JavaScript", [](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(
|
||||||
"node ./tests/run-json-schema-to-grammar.mjs test-json-schema-input.tmp > test-grammar-output.tmp") == 0 ? SUCCESS : FAILURE);
|
"node ./tests/run-json-schema-to-grammar.mjs test-json-schema-input.tmp > test-grammar-output.tmp") == 0 ? SUCCESS : FAILURE);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue