json-model-compiler 2.0.55__tar.gz → 2.0.56__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/API.md +15 -2
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/BACKLOG.md +3 -5
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/BENCH.md +30 -20
- {json_model_compiler-2.0.55/json_model_compiler.egg-info → json_model_compiler-2.0.56}/PKG-INFO +1 -1
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/PUBS.md +6 -12
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/VERSION.md +16 -3
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/about.sh +9 -3
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/__init__.py +2 -0
- json_model_compiler-2.0.56/json_model/data/VERSION +1 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/jmc.pod +10 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/irep.py +14 -4
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/language.py +4 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/predefs.py +1 -1
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/c/json-model.c +6 -4
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/script.py +150 -55
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/xstatic.py +131 -47
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56/json_model_compiler.egg-info}/PKG-INFO +1 -1
- json_model_compiler-2.0.55/json_model/data/VERSION +0 -1
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/.github/workflows/sanity.yml +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/.gitignore +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/.gitmodules +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/DESIGN.md +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/DEV.md +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/DOC.md +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/HOWTO.md +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/INTEGRATION.md +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/MANIFEST.in +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/Makefile +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/README.md +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/SPEC.md +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/TUTO.md +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/README.md +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/analyze.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/clang.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/convert.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/clang_entry.c +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/clang_free.c +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/clang_init.c +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/clang_pcre2_fun.c +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/clang_re2_fun.c +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/java_free.java +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/java_init.java +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/javascript_exe.js +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/javascript_foot.js +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/javascript_free.js +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/javascript_head.js +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/javascript_init.js +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/javascript_main.js +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/perl_entry.pl +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/perl_exe.pl +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/perl_free.pl +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/perl_init.pl +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/perl_main.pl +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/perl_pkg.pl +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/plpgsql_entry.sql +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/python_entry.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/python_exe.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/python_free.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/python_init.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/data/python_main.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/export.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/java.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/javascript.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/model.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/mtypes.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/objops.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/optim.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/perl.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/plpgsql.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/python.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/recurse.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/regex.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/resolver.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/Makefile +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/__init__.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/c/Makefile +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/c/json-model.h +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/c/main.c +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/.gitignore +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/Makefile +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/README.md +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/env.sh +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/json_model/Checker.java +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/json_model/GSON.java +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/json_model/JSON.java +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/json_model/JSONP.java +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/json_model/Jackson.java +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/json_model/Main.java +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/json_model/ModelChecker.java +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/json_model/Path.java +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/json_model/Report.java +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/json_model/Runtime.java +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/java/pom.xml +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/js/README.md +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/js/index.js +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/js/main.js +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/js/package.json +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/pl/.gitignore +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/pl/Changes +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/pl/LICENSE +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/pl/MANIFEST +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/pl/Makefile.PL +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/pl/README +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/pl/env.sh +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/pl/ignore.txt +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/pl/lib/JSON/JsonModel.pm +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/pl/t/00-load.t +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/pl/t/manifest.t +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/pl/t/pod-coverage.t +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/pl/t/pod.t +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/pl/xt/boilerplate.t +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/sql/META.json +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/sql/Makefile +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/sql/json_model--2.0.sql +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/sql/json_model.control +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/support.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/runtime/types.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/submodel.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/ts_export.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/url_cache.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model/utils.py +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model_compiler.egg-info/SOURCES.txt +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model_compiler.egg-info/dependency_links.txt +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model_compiler.egg-info/entry_points.txt +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model_compiler.egg-info/not-zip-safe +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model_compiler.egg-info/requires.txt +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/json_model_compiler.egg-info/top_level.txt +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/package.json +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/pyproject.toml +0 -0
- {json_model_compiler-2.0.55 → json_model_compiler-2.0.56}/setup.cfg +0 -0
|
@@ -74,7 +74,7 @@ person.check_model_free()
|
|
|
74
74
|
As the JSON Model compiler is written in Python, it can be invoked directly for generating
|
|
75
75
|
a validation function.
|
|
76
76
|
|
|
77
|
-
Currently,
|
|
77
|
+
Currently, three functions are available:
|
|
78
78
|
|
|
79
79
|
- `model_checker_from_json`: generate a model from a JSON value which must be a valid model.
|
|
80
80
|
|
|
@@ -83,8 +83,12 @@ Currently, two functions are available:
|
|
|
83
83
|
|
|
84
84
|
This function expects a URL as a first parameter, which should dowload a JSON model possibly
|
|
85
85
|
as JSON or YAML.
|
|
86
|
+
- `ir_checker_from_file`: generate a model checker from a JSON intermediate representation.
|
|
86
87
|
|
|
87
|
-
|
|
88
|
+
This function expects a file path as a first parameter, or `-` for standard input, holding
|
|
89
|
+
an IR as generated with `jmc -C -F json`. See compiler option `--from-ir` about its limitations.
|
|
90
|
+
|
|
91
|
+
The following named parameters are available to both model functions:
|
|
88
92
|
|
|
89
93
|
- `auto`: boolean, whether to automatically map url to local path, default is _False_;
|
|
90
94
|
this feature is mostly for testing.
|
|
@@ -111,6 +115,15 @@ is_person = jm.model_checker_from_url("./Person.model.json")
|
|
|
111
115
|
print("hobbes is a person:", is_person({"name": "Hobbes", "birth": "2020-07-29"}))
|
|
112
116
|
```
|
|
113
117
|
|
|
118
|
+
Or, starting from a previously generated IR, eg with `jmc -C -F json -o Person.ir.json Person.model.json`:
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
import json_model as jm
|
|
122
|
+
|
|
123
|
+
is_person = jm.ir_checker_from_file("./Person.ir.json")
|
|
124
|
+
print("hobbes is a person:", is_person({"name": "Hobbes", "birth": "2020-07-29"}))
|
|
125
|
+
```
|
|
126
|
+
|
|
114
127
|
## JavaScript API
|
|
115
128
|
|
|
116
129
|
Model compilation to JavaScript generates either a module (`.mjs`) or a node script (`.js`),
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Current Tasks
|
|
4
4
|
|
|
5
|
-
- [ ] bench: use local models instead of fetching urls
|
|
6
5
|
- [ ] bench: case failures handling needs some fixing
|
|
7
|
-
- [ ] front: allow to load `.errors.json` file to filter out expected errors
|
|
8
6
|
- [ ] tests: run tests inside docker image
|
|
9
7
|
- [ ] tests: check more bad urls (eg bad %-escape)
|
|
10
8
|
- [ ] tests: check pydantic generated classes
|
|
@@ -35,7 +33,7 @@
|
|
|
35
33
|
- [ ] perf: keep only one java run?
|
|
36
34
|
- [ ] perf: check median hack for run times
|
|
37
35
|
- [ ] perf: show schema to model conversion times
|
|
38
|
-
- [ ] pr: better document optimizations, eg add
|
|
36
|
+
- [ ] pr: better document optimizations, eg add compiler optimization page
|
|
39
37
|
- [ ] optim: collect and display stats about what works
|
|
40
38
|
- [ ] c-backend: improve unique with hash using int set?
|
|
41
39
|
- [ ] c-backend: improve str hash?
|
|
@@ -146,8 +144,8 @@
|
|
|
146
144
|
- [x] model: write a model for MCP
|
|
147
145
|
- [x] tests: add a few tests for MCP model
|
|
148
146
|
- [x] export: generate ts interfaces
|
|
149
|
-
- [
|
|
150
|
-
- [
|
|
147
|
+
- [x] model: fix IR model and tests
|
|
148
|
+
- [x] front: IR re-entrance
|
|
151
149
|
- [ ] tests: generate valid (pseudo-random) values
|
|
152
150
|
- [ ] tests: generate invalid minimal, maximal, pseudo-random values
|
|
153
151
|
- [ ] tests: generate invalid values on each constraint
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# JSON Model Compiler Benchmark Artifacts
|
|
2
2
|
|
|
3
3
|
The purpose of this benchmark is to compare JSON value validation performance for
|
|
4
|
-
the
|
|
5
|
-
of the syntax used to express these constraints.
|
|
4
|
+
the same constraints, independently of the syntax used to express these constraints.
|
|
6
5
|
|
|
7
6
|
These artifacts compare
|
|
8
7
|
[JSON Model Compiler (jmc)](https://github.com/clairey-zx81/json-model) generated code using the
|
|
@@ -13,20 +12,29 @@ from [JSON Schema Benchmark](https://github.com/sourcemeta-research/jsonschema-b
|
|
|
13
12
|
|
|
14
13
|
## Recent Artifacts
|
|
15
14
|
|
|
16
|
-
Overall, depending on the chosen metrics,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- [
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
23
|
-
- [
|
|
24
|
-
- [
|
|
25
|
-
- [
|
|
26
|
-
- [
|
|
27
|
-
- [
|
|
28
|
-
- [
|
|
29
|
-
- [
|
|
15
|
+
Overall, depending on the chosen metrics, JMC with the C backend is 50-100% faster
|
|
16
|
+
than Blaze on average to validate JSON values in these artifacts.
|
|
17
|
+
|
|
18
|
+
- [2026080600](benchmarks/2026080600.md) jsu 0.9.17/jmc 2.0.55 vs sbc 16.7.0, content, fix.
|
|
19
|
+
- [2026080501](benchmarks/2026080501.md) jsu 0.9.17/jmc 2.0.55 vs sbc 16.6.0, content, fix.
|
|
20
|
+
- [2026080500](benchmarks/2026080500.md) jsu 0.9.17/jmc 2.0.55 vs sbc 16.5.0, content, fix.
|
|
21
|
+
- [2026080400](benchmarks/2026080400.md) jsu 0.9.16/jmc 2.0.55 vs sbc 16.5.0, content, fix.
|
|
22
|
+
- [2026080300](benchmarks/2026080300.md) jsu 0.9.16/jmc 2.0.55 vs sbc 16.4.0, content, fix.
|
|
23
|
+
- [2026080100](benchmarks/2026080100.md) jsu 0.9.16/jmc 2.0.55 vs sbc 16.3.0, content, no fix.
|
|
24
|
+
- [2026073100](benchmarks/2026073100.md) jsu 0.9.16/jmc 2.0.55 vs sbc 16.3.0, content, fix.
|
|
25
|
+
- [2026073003](benchmarks/2026073003.md) jsu 0.9.16/jmc 2.0.54 vs sbc 16.3.0, content, fix.
|
|
26
|
+
- [2026072902](benchmarks/2026072902.md) jsu 0.9.15/jmc 2.0.53 vs sbc 16.3.0, content, fix.
|
|
27
|
+
- [2026072900](benchmarks/2026072900.md) jsu 0.9.15/jmc 2.0.52 vs sbc 16.3.0, content, fix.
|
|
28
|
+
- [2026072600](benchmarks/2026072600.md) jsu 0.9.13/jmc 2.0.52 vs sbc 16.3.0, content, fix.
|
|
29
|
+
- [2026072200](benchmarks/2026072200.md) jsu 0.9.13/jmc 2.0.52 vs sbc 16.2.1, content, fix.
|
|
30
|
+
- [2026071700](benchmarks/2026071700.md) jsu 0.9.13/jmc 2.0.52 vs sbc 16.2.0, content, fix.
|
|
31
|
+
- [2026071302](benchmarks/2026071302.md) jsu 0.9.13/jmc 2.0.52 vs sbc 16.1.0, content, fix.
|
|
32
|
+
- [2026071000](benchmarks/2026071000.md) jsu 0.9.12/jmc 2.0.51 vs sbc 16.1.0, no content, fix.
|
|
33
|
+
- [2026070900](benchmarks/2026070900.md) jsu 0.9.11/jmc 2.0.51 vs sbc 16.1.0, no content, fix.
|
|
34
|
+
- [2026062200](benchmarks/2026062200.md) jsu 0.9.11/jmc 2.0.51 vs sbc 16.0.0, no content, fix.
|
|
35
|
+
- [2026062102](benchmarks/2026062102.md) jsu 0.9.10/jmc 2.0.50 vs sbc 16.0.0, no content, fix.
|
|
36
|
+
|
|
37
|
+
Options: _content_ validate string contents (format/predef), _fix_ improved models (bug fixes) or strictly schema compatible models.
|
|
30
38
|
|
|
31
39
|
## Benchmarking Script
|
|
32
40
|
|
|
@@ -43,17 +51,17 @@ It is typically started on a large host with the
|
|
|
43
51
|
which will spawn the necessary containers:
|
|
44
52
|
|
|
45
53
|
```sh
|
|
46
|
-
JMC=latest JMC_OPTS="--
|
|
47
|
-
nohup ./start_bench.sh latest -p
|
|
54
|
+
JMC=latest JMC_OPTS="--predef --cc=clang" JSU_OPTS="--id --fix --no-strict" \
|
|
55
|
+
nohup ./start_bench.sh latest -p 12 -l 1000 -r 5 -c &
|
|
48
56
|
# in the generated directory, look for the summary markdown and radar json files.
|
|
49
57
|
```
|
|
50
58
|
|
|
51
59
|
The main script options are:
|
|
52
60
|
|
|
53
|
-
- `-p PARA` parallelism (
|
|
61
|
+
- `-p PARA` parallelism (less that the number of available cores, default is _8_)
|
|
54
62
|
- `-l LOOP` loop iterations for performance average (at least _1000_, the default)
|
|
55
63
|
- `-r RUNS` number of runs (odd number, default is _3_)
|
|
56
|
-
-
|
|
64
|
+
- `-c` validate contents (default is _not_)
|
|
57
65
|
|
|
58
66
|
## Benchmarking Conditions
|
|
59
67
|
|
|
@@ -112,6 +120,8 @@ the following caveats, and others:
|
|
|
112
120
|
for the garbage collector and JIT), which may or may not be a blessing: it can reduce
|
|
113
121
|
the apparent latency (eg the gc runs in another thread) but have a detrimental overall
|
|
114
122
|
effect on throughput and costs as more cpu ressources are spent on the same task.
|
|
123
|
+
- test values are mostly valid, which is representative of a typical use case, but
|
|
124
|
+
the tool accuracy should be asserted elsewhere with failing cases.
|
|
115
125
|
|
|
116
126
|
## Other Artifacts
|
|
117
127
|
|
|
@@ -40,27 +40,21 @@ JSON Model design and implementation are discussed in research papers and report
|
|
|
40
40
|
JSON Model compiler and runtimes are distributed through the packages published for
|
|
41
41
|
each language ecosystem:
|
|
42
42
|
|
|
43
|
-
- [JSON Model Compiler Python Package](https://pypi.org/project/json-model-compiler/)
|
|
44
|
-
|
|
43
|
+
- [JSON Model Compiler Python Package](https://pypi.org/project/json-model-compiler/)
|
|
45
44
|
Ready to use JSON Model compiler and runtime for a Python environment, from _PyPI_.
|
|
46
45
|
|
|
47
|
-
- [JSON Model Compiler Container Image `docker.io/zx80/jmc`](https://hub.docker.com/r/zx80/jmc)
|
|
48
|
-
|
|
46
|
+
- [JSON Model Compiler Container Image `docker.io/zx80/jmc`](https://hub.docker.com/r/zx80/jmc)
|
|
49
47
|
Ready to use JSON Model compiler and runtimes (Python, C, JavaScript, Perl, Java)
|
|
50
48
|
as a Docker image, from _Docker Hub_.
|
|
51
49
|
|
|
52
|
-
- [JSON Model JavaScript Runtime](https://www.npmjs.com/package/json_model_runtime)
|
|
53
|
-
|
|
50
|
+
- [JSON Model JavaScript Runtime](https://www.npmjs.com/package/json_model_runtime)
|
|
54
51
|
JS runtime for generated code, from _npm Registry_.
|
|
55
52
|
|
|
56
|
-
- [JSON Model PL/pgSQL Runtime](https://pgxn.org/dist/json_model/)
|
|
57
|
-
|
|
53
|
+
- [JSON Model PL/pgSQL Runtime](https://pgxn.org/dist/json_model/)
|
|
58
54
|
PL/pgSQL runtime for generated code, from _PGXN_.
|
|
59
55
|
|
|
60
|
-
- [JSON Model Perl Runtime](https://metacpan.org/pod/JSON::JsonModel)
|
|
61
|
-
|
|
56
|
+
- [JSON Model Perl Runtime](https://metacpan.org/pod/JSON::JsonModel)
|
|
62
57
|
Perl runtime for generated code, from _CPAN_.
|
|
63
58
|
|
|
64
|
-
- [JSON Model Java Runtime](https://central.sonatype.com/artifact/org.json-model/json-model)
|
|
65
|
-
|
|
59
|
+
- [JSON Model Java Runtime](https://central.sonatype.com/artifact/org.json-model/json-model)
|
|
66
60
|
Java runtime for generated code, from _Maven Central_.
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
# JSON Model Compiler Versions
|
|
2
2
|
|
|
3
|
+
## 2.0.56 on 2026-08-07
|
|
4
|
+
|
|
5
|
+
- bench: use local models instead of fetching urls
|
|
6
|
+
- bench: add option to change the bench reference
|
|
7
|
+
- bench: rework presentation and comments
|
|
8
|
+
- bench: allow to only keep Java with GSON lib
|
|
9
|
+
- bench: add option to change standard comments depending on test conditions
|
|
10
|
+
- bench: add option to skip showing _best_ row in performance summary
|
|
11
|
+
- bench: when comparing to a reference, count betters
|
|
12
|
+
- front: ~allow to load `.errors.json` file to filter out expected errors~
|
|
13
|
+
- pr: improved pages and descriptions
|
|
14
|
+
- pr: improve demonstration models comments and indentation
|
|
15
|
+
- predef: allow amqp URLs
|
|
16
|
+
- model: update and test `jmc-ir.model.json`
|
|
17
|
+
- front: allow IR re-entrance, including tests
|
|
18
|
+
|
|
3
19
|
## 2.0.55 on 2026-07-31
|
|
4
20
|
|
|
5
21
|
- front: try again to display a relevant version under dev
|
|
6
|
-
- perf: improve generated reports
|
|
7
|
-
- model: add example model for JMC benchmark radar data
|
|
8
|
-
- pr: check `json-model.org` SEO - listed on Google console but some pages are not indexed
|
|
9
22
|
- models: add model for `*.errors.json` files
|
|
10
23
|
- tests: use `.errors.json` file to manage value errors, instead of rough counts
|
|
11
24
|
- tests: use `.errors.json` file to manage ts export errors
|
|
@@ -124,9 +124,13 @@ cloc --md \
|
|
|
124
124
|
json_model/runtime \
|
|
125
125
|
| sed -n -e '/SUM/s/\([0-9][0-9]*\)/**\1**/g;s/SUM:/**Total**/;/^$/,$p' | grep -v '^-[-|]*$'
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
n_valid_models=$(ls tests/[mr]*/*.model.json | wc -l)
|
|
128
|
+
n_invalid_models=$(ls tests/bads/*.model.json | wc -l)
|
|
129
|
+
n_models=$(( $n_valid_models + $n_invalid_models ))
|
|
128
130
|
n_values=$(cat tests/[mrb]*/*.values.json | egrep '(true|false)' | wc -l)
|
|
129
131
|
n_value_files=$(ls tests/[mrb]*/*.values.json | wc -l)
|
|
132
|
+
n_error_files=$(ls tests/[mrb]*/*.errors.json | wc -l)
|
|
133
|
+
# == $n_valid_models?
|
|
130
134
|
n_schemas=$(echo tests/[mrb]*/*.schema.json | wc -w)
|
|
131
135
|
n_test_schemas=$(grep '^ "schema": {' tests/JSON-Schema-Test-Suite/tests/*/*.json | wc -l)
|
|
132
136
|
n_test_files=$(ls tests/JSON-Schema-Test-Suite/tests/*/*.json | wc -l)
|
|
@@ -134,7 +138,8 @@ model_locs=$(cat tests/[mrb]*/*.model.json | wc -l)
|
|
|
134
138
|
n_eg_models=$(ls models/*.model.json | wc -l)
|
|
135
139
|
eg_models_locs=$(cat models/*.model.json | wc -l)
|
|
136
140
|
|
|
137
|
-
|
|
141
|
+
# valid models are re-counted for IR checks
|
|
142
|
+
all_values=$(( $n_values + $n_models + $n_valid_models + $n_value_files + $n_error_files + $n_schemas + $n_test_schemas + $n_test_files ))
|
|
138
143
|
|
|
139
144
|
cat <<EOF
|
|
140
145
|
|
|
@@ -151,7 +156,8 @@ on a set of test vectors.
|
|
|
151
156
|
- number of test vector JSON values: _${n_values}_
|
|
152
157
|
- all tested JSON values (including models, generated schemas and test suite schemas): _${all_values}_
|
|
153
158
|
|
|
154
|
-
Example models cover typical use cases and demonstrate
|
|
159
|
+
[Example models](https://json-model.org/MODELS) cover typical use cases and demonstrate
|
|
160
|
+
JSON Model power and ease of expression.
|
|
155
161
|
|
|
156
162
|
- number of example models: _${n_eg_models}_
|
|
157
163
|
- total example model locs: _${eg_models_locs}_
|
|
@@ -8,6 +8,7 @@ from .script import (
|
|
|
8
8
|
jmc_script, jmc_version,
|
|
9
9
|
model_from_json, model_from_url, model_from_str,
|
|
10
10
|
model_checker, model_checker_from_url, model_checker_from_json,
|
|
11
|
+
ir_checker_from_file,
|
|
11
12
|
)
|
|
12
13
|
|
|
13
14
|
__ALL__ = [
|
|
@@ -15,4 +16,5 @@ __ALL__ = [
|
|
|
15
16
|
jmc_script, jmc_version,
|
|
16
17
|
model_from_json, model_from_url, model_from_str,
|
|
17
18
|
model_checker, model_checker_from_url, model_checker_from_json,
|
|
19
|
+
ir_checker_from_file,
|
|
18
20
|
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.0.56
|
|
@@ -119,6 +119,16 @@ Accept JSON with objects containing duplicated properties.
|
|
|
119
119
|
|
|
120
120
|
Allow some extensions to help with JSU back-end implementation.
|
|
121
121
|
|
|
122
|
+
=item B<--from-ir>/B<-fir>
|
|
123
|
+
|
|
124
|
+
Read a JSON intermediate representation, as generated with C<-C -F json>, instead of a
|
|
125
|
+
JSON model, so that only code generation (C<-C>) is available.
|
|
126
|
+
|
|
127
|
+
The entry name and package are taken from the IR, and reporting must have been enabled
|
|
128
|
+
when it was generated. An IR generated with C<-F json> targets a generic back-end: the
|
|
129
|
+
regenerated code may differ from a direct compilation, and PL/pgSQL is not supported.
|
|
130
|
+
Pass the tuning options when generating the IR for a closer match.
|
|
131
|
+
|
|
122
132
|
=back
|
|
123
133
|
|
|
124
134
|
=head2 Processing
|
|
@@ -1119,11 +1119,11 @@ def optimizeIR(code: list[Jsonable], *, shortcuts: dict[str, str], partial: bool
|
|
|
1119
1119
|
|
|
1120
1120
|
|
|
1121
1121
|
def _t2s(tvar: type|None) -> str:
|
|
1122
|
-
"""Type to
|
|
1122
|
+
"""Type to IR type name conversion."""
|
|
1123
1123
|
if tvar is None or tvar is type(None):
|
|
1124
1124
|
return "null"
|
|
1125
1125
|
elif tvar is bool:
|
|
1126
|
-
return "
|
|
1126
|
+
return "bool"
|
|
1127
1127
|
elif tvar is int:
|
|
1128
1128
|
return "integer"
|
|
1129
1129
|
elif tvar is float:
|
|
@@ -1209,8 +1209,11 @@ class IRep(Language):
|
|
|
1209
1209
|
def esc(self, s: str) -> StrExpr:
|
|
1210
1210
|
return _j("esc", s=s)
|
|
1211
1211
|
|
|
1212
|
+
def esc_msg(self, s: str) -> StrExpr:
|
|
1213
|
+
return Language.esc(self, s)
|
|
1214
|
+
|
|
1212
1215
|
def json_cst(self, j: Jsonable) -> JsonExpr:
|
|
1213
|
-
return _j("jc",
|
|
1216
|
+
return _j("jc", j=j)
|
|
1214
1217
|
|
|
1215
1218
|
def const(self, c: Jsonable) -> Expr:
|
|
1216
1219
|
return _j("cst", c=c)
|
|
@@ -1490,7 +1493,7 @@ def _s2t(tname: str|None) -> type:
|
|
|
1490
1493
|
"""String to type reconversion."""
|
|
1491
1494
|
match tname:
|
|
1492
1495
|
case None|"null": return None
|
|
1493
|
-
case "bool"
|
|
1496
|
+
case "bool": return bool
|
|
1494
1497
|
case "int"|"integer": return int
|
|
1495
1498
|
case "float"|"number": return float
|
|
1496
1499
|
case "Number": return Number
|
|
@@ -1669,6 +1672,13 @@ def _eval(jv: Jsonable, gen: Language) -> Block|Expr:
|
|
|
1669
1672
|
# probably a string, eg a variable name
|
|
1670
1673
|
return jv
|
|
1671
1674
|
|
|
1675
|
+
def ir_evaluate(ir: Jsonable, lang: Language) -> str:
|
|
1676
|
+
"""Generate the target language source code from a full code JSON IR."""
|
|
1677
|
+
code = _eval(ir, lang)
|
|
1678
|
+
assert isinstance(code, list), "full code JSON IR"
|
|
1679
|
+
|
|
1680
|
+
return lang.code_to_str(lang.filter_code(code))
|
|
1681
|
+
|
|
1672
1682
|
def evaluate(ir: Code, lang: Language) -> Code:
|
|
1673
1683
|
code = Code(lang, ir._entry, ir._executable, ir._package, ir._mark)
|
|
1674
1684
|
code._predefs = ir._predefs
|
|
@@ -77,7 +77,7 @@ _PQA = r"(/[^/?#\s]*)*(\?[^#\s]*)?(#\S*)?"
|
|
|
77
77
|
# NOTE first segment cannot look like "scheme:" and contain strange chars
|
|
78
78
|
_REL_URL = r"([^?#\s:/<>{}()!=*]+)?(/[^?#\s/]*)*(\?[^#\s]*)?(#\S*)?"
|
|
79
79
|
# hierarchical urls
|
|
80
|
-
_HIE_URL = f"(https?|s?ftp|rtsps?|s3|cm|oci)://({_AUTH})?{_PQA}"
|
|
80
|
+
_HIE_URL = f"(https?|s?ftp|rtsps?|s3|cm|oci|amqp)://({_AUTH})?{_PQA}"
|
|
81
81
|
# file does not have a auth?
|
|
82
82
|
_FILE_URL = f"file:{_REL_URL}"
|
|
83
83
|
# other urls
|
|
@@ -1230,7 +1230,8 @@ static const uint64_t
|
|
|
1230
1230
|
s_rtsp = 0x0000003a70737472LL,
|
|
1231
1231
|
s_rtsps = 0x00003a7370737472LL,
|
|
1232
1232
|
s_telnet = 0x003a74656e6c6574LL,
|
|
1233
|
-
s_mailto = 0x003a6f746c69616dLL
|
|
1233
|
+
s_mailto = 0x003a6f746c69616dLL,
|
|
1234
|
+
s_amqp = 0x0000000070715d61LL
|
|
1234
1235
|
// s_imap = 0x0000003a70616d69LL,
|
|
1235
1236
|
// s_imaps = 0x00003a7370616d69LL,
|
|
1236
1237
|
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ // ordered
|
|
@@ -1241,7 +1242,8 @@ static const uint64_t
|
|
|
1241
1242
|
s_rtsp = 0x727473703a000000LL,
|
|
1242
1243
|
s_rtsps = 0x72747370733a0000LL,
|
|
1243
1244
|
s_telnet = 0x74656c6e65743a00LL,
|
|
1244
|
-
s_mailto = 0x6d61696c746f3a00LL
|
|
1245
|
+
s_mailto = 0x6d61696c746f3a00LL,
|
|
1246
|
+
s_amqp = 0x616d717000000000LL
|
|
1245
1247
|
// s_imap = 0x696d61703a000000LL,
|
|
1246
1248
|
// s_imaps = 0x696d6170733a0000LL,
|
|
1247
1249
|
#else
|
|
@@ -1784,7 +1786,7 @@ jm_is_valid_url(const char *url, jm_path_t *path, jm_report_t *rep)
|
|
|
1784
1786
|
jm_str_eq_4(url, s_oci) || jm_str_eq_5(url, s_file) ||
|
|
1785
1787
|
jm_str_eq_4(url, s_ssh) || jm_str_eq_8(url, s_telnet) ||
|
|
1786
1788
|
jm_str_eq_8(url, s_mailto) || jm_str_eq_3(url, s_cm) ||
|
|
1787
|
-
jm_str_eq_3(url, s_s3)
|
|
1789
|
+
jm_str_eq_3(url, s_s3) || jm_str_eq_5(url, s_amqp)
|
|
1788
1790
|
) && jm_rfc3986_is_uri(url, true, false);
|
|
1789
1791
|
}
|
|
1790
1792
|
|
|
@@ -1801,7 +1803,7 @@ jm_is_valid_url_rel(const char *url, jm_path_t *path, jm_report_t *rep)
|
|
|
1801
1803
|
jm_str_eq_4(url, s_oci) || jm_str_eq_5(url, s_file) ||
|
|
1802
1804
|
jm_str_eq_4(url, s_ssh) || jm_str_eq_8(url, s_telnet) ||
|
|
1803
1805
|
jm_str_eq_8(url, s_mailto) || jm_str_eq_3(url, s_cm) ||
|
|
1804
|
-
jm_str_eq_3(url, s_s3)
|
|
1806
|
+
jm_str_eq_3(url, s_s3) || jm_str_eq_5(url, s_amqp)
|
|
1805
1807
|
) && jm_rfc3986_is_uri(url, true, false)) || jm_rfc3986_is_uri(url, false, true);
|
|
1806
1808
|
}
|
|
1807
1809
|
|