json-model-compiler 2.0.62__tar.gz → 2.0.63__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.
Files changed (134) hide show
  1. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/BACKLOG.md +4 -5
  2. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/BENCH.md +9 -6
  3. json_model_compiler-2.0.63/COMP.md +75 -0
  4. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/DOC.md +4 -2
  5. {json_model_compiler-2.0.62/json_model_compiler.egg-info → json_model_compiler-2.0.63}/PKG-INFO +1 -1
  6. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/SPEC.md +5 -2
  7. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/VERSION.md +26 -0
  8. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/bench.sh +6 -3
  9. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/analyze.py +5 -3
  10. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/clang.py +9 -0
  11. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/convert.py +6 -0
  12. json_model_compiler-2.0.63/json_model/data/VERSION +1 -0
  13. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/jmc.pod +6 -0
  14. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/irep.py +4 -0
  15. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/java.py +9 -0
  16. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/javascript.py +9 -0
  17. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/language.py +25 -2
  18. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/objops.py +2 -2
  19. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/optim.py +33 -3
  20. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/perl.py +9 -0
  21. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/plpgsql.py +10 -1
  22. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/predefs.py +2 -1
  23. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/python.py +9 -0
  24. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/pom.xml +3 -3
  25. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/script.py +4 -0
  26. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/xstatic.py +33 -100
  27. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63/json_model_compiler.egg-info}/PKG-INFO +1 -1
  28. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model_compiler.egg-info/SOURCES.txt +1 -0
  29. json_model_compiler-2.0.62/json_model/data/VERSION +0 -1
  30. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/.github/workflows/docs.yml +0 -0
  31. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/.github/workflows/sanity.yml +0 -0
  32. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/.gitignore +0 -0
  33. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/.gitmodules +0 -0
  34. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/API.md +0 -0
  35. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/DESIGN.md +0 -0
  36. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/DEV.md +0 -0
  37. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/HOWTO.md +0 -0
  38. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/INTEGRATION.md +0 -0
  39. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/MANIFEST.in +0 -0
  40. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/Makefile +0 -0
  41. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/PUBS.md +0 -0
  42. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/README.md +0 -0
  43. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/TUTO.md +0 -0
  44. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/about.sh +0 -0
  45. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/README.md +0 -0
  46. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/__init__.py +0 -0
  47. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/clang_entry.c +0 -0
  48. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/clang_free.c +0 -0
  49. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/clang_init.c +0 -0
  50. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/clang_pcre2_fun.c +0 -0
  51. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/clang_re2_fun.c +0 -0
  52. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/java_free.java +0 -0
  53. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/java_init.java +0 -0
  54. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/javascript_exe.js +0 -0
  55. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/javascript_foot.js +0 -0
  56. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/javascript_free.js +0 -0
  57. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/javascript_head.js +0 -0
  58. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/javascript_init.js +0 -0
  59. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/javascript_main.js +0 -0
  60. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/perl_entry.pl +0 -0
  61. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/perl_exe.pl +0 -0
  62. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/perl_free.pl +0 -0
  63. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/perl_init.pl +0 -0
  64. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/perl_main.pl +0 -0
  65. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/perl_pkg.pl +0 -0
  66. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/plpgsql_entry.sql +0 -0
  67. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/python_entry.py +0 -0
  68. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/python_exe.py +0 -0
  69. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/python_free.py +0 -0
  70. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/python_init.py +0 -0
  71. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/data/python_main.py +0 -0
  72. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/export.py +0 -0
  73. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/iroptim.py +0 -0
  74. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/model.py +0 -0
  75. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/mtypes.py +0 -0
  76. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/recurse.py +0 -0
  77. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/regex.py +0 -0
  78. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/resolver.py +0 -0
  79. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/Makefile +0 -0
  80. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/__init__.py +0 -0
  81. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/c/Makefile +0 -0
  82. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/c/json-model.c +0 -0
  83. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/c/json-model.h +0 -0
  84. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/c/main.c +0 -0
  85. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/.gitignore +0 -0
  86. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/Makefile +0 -0
  87. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/README.md +0 -0
  88. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/env.sh +0 -0
  89. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/Checker.java +0 -0
  90. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/GSON.java +0 -0
  91. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/JSON.java +0 -0
  92. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/JSONP.java +0 -0
  93. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/Jackson.java +0 -0
  94. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/Main.java +0 -0
  95. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/ModelChecker.java +0 -0
  96. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/Path.java +0 -0
  97. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/Report.java +0 -0
  98. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/java/json_model/Runtime.java +0 -0
  99. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/js/README.md +0 -0
  100. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/js/index.js +0 -0
  101. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/js/main.js +0 -0
  102. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/js/package.json +0 -0
  103. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/pl/.gitignore +0 -0
  104. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/pl/Changes +0 -0
  105. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/pl/LICENSE +0 -0
  106. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/pl/MANIFEST +0 -0
  107. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/pl/Makefile.PL +0 -0
  108. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/pl/README +0 -0
  109. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/pl/env.sh +0 -0
  110. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/pl/ignore.txt +0 -0
  111. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/pl/lib/JSON/JsonModel.pm +0 -0
  112. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/pl/t/00-load.t +0 -0
  113. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/pl/t/manifest.t +0 -0
  114. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/pl/t/pod-coverage.t +0 -0
  115. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/pl/t/pod.t +0 -0
  116. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/pl/xt/boilerplate.t +0 -0
  117. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/sql/META.json +0 -0
  118. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/sql/Makefile +0 -0
  119. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/sql/json_model--2.0.sql +0 -0
  120. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/sql/json_model.control +0 -0
  121. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/support.py +0 -0
  122. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/runtime/types.py +0 -0
  123. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/submodel.py +0 -0
  124. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/ts_export.py +0 -0
  125. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/url_cache.py +0 -0
  126. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model/utils.py +0 -0
  127. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model_compiler.egg-info/dependency_links.txt +0 -0
  128. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model_compiler.egg-info/entry_points.txt +0 -0
  129. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model_compiler.egg-info/not-zip-safe +0 -0
  130. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model_compiler.egg-info/requires.txt +0 -0
  131. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/json_model_compiler.egg-info/top_level.txt +0 -0
  132. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/package.json +0 -0
  133. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/pyproject.toml +0 -0
  134. {json_model_compiler-2.0.62 → json_model_compiler-2.0.63}/setup.cfg +0 -0
@@ -2,11 +2,13 @@
2
2
 
3
3
  ## Current Tasks
4
4
 
5
- - [ ] bench: submit `negatives.jsonl` to jsb for sanity checks
5
+ - [ ] java-runtime: consider automatic updates?
6
+ - [ ] bench: re-build corvus image automatically
7
+ - [ ] bench: run cron bench with corvus (wip)
8
+ - [ ] pr: improve compiler page, list and describe optimizations?
6
9
  - [ ] bench: better count should ignore bads
7
10
  - [ ] bench: handle case failures for radar (wip, ajv handling)
8
11
  - [ ] bench: collect error runs?
9
- - [ ] bench: add corvus reference?
10
12
  - [ ] bench: add stddev performance computation
11
13
  - [ ] bench: improve resilience to bad overhead estimation
12
14
  - [ ] bench: collect JSON parse times for comparison with validation times
@@ -21,15 +23,12 @@
21
23
  - [ ] static: check for common object part?
22
24
  - [ ] front: generate valid minimal, maximal and random values from a model
23
25
  - [ ] front: generate invalid minimal values from a model
24
- - [ ] optim: simplify some '!=' cases
25
26
  - [ ] optim: collect and display stats about what works
26
27
  - [ ] spec: allow to _remove_ definitions, eg `{ "$stuff": {"/": "$foo"}}`
27
28
  - [ ] spec: restrict regex syntax to a smaller subset
28
- - [ ] perf: add another loop over performance collection?
29
29
  - [ ] perf: drop and/or merge identical results when comparing
30
30
  - [ ] backend: check `mv-34/mu` test case which may require some utf normalization
31
31
  - [ ] runtime: count graphemes instead of characters? for Java, see `java.text.BreakIterator`
32
- - [ ] pr: better document optimizations, eg add compiler optimization page
33
32
  - [ ] static: improve startswith pattern recognition `/^xyz.*/`
34
33
  - [ ] js: implement cset as an or-expression
35
34
  - [ ] c-backend: factor out str extraction in or-list in more cases
@@ -36,7 +36,7 @@ which will spawn the necessary containers:
36
36
 
37
37
  ```sh
38
38
  JMC=latest JMC_OPTS="--predef --cc=clang" \
39
- nohup ./start_bench.sh latest -p 12 -l 1000 -r 5 -c &
39
+ nohup ./start_bench.sh latest -p 12 -l 1000 -r 5 -L -c &
40
40
  # in the generated directory, look for the summary markdown and radar json files.
41
41
  ```
42
42
 
@@ -59,12 +59,15 @@ misplaced keywords or bad regex, or better native models), and induce small
59
59
  differences in the validated results, in which case they are manually
60
60
  validated and discussed.
61
61
 
62
- Runs are performed in _fast_ mode: the rejection reasons are not collected, and
63
- the run stops as soon as possible.
64
-
65
- - To smooth out the wide range of collected performances (from 10 ns to
66
- over 300 µs for validating one value), a relative comparison ratio is shown.
62
+ - Performance elapsed times for each test are collected over a loop to compute
63
+ an average and standard deviation. The repetition also intends to catch hidden costs
64
+ such as JIT compilation, GC runs and lazy initializations.
65
+ - Several independent runs are performed to reduce host load effects.
67
66
  - Compilation times and performance times are the _median_ encountered over the runs.
67
+ - Runs are usually performed in _fast_ mode: the rejection reasons are not collected,
68
+ and the run stops as soon as possible.
69
+ - The benchmark presents relative comparison ratios to smooth out the wide range of
70
+ collected performances (from 10 ns to over 300 µs for validating one value).
68
71
 
69
72
  Note that performance figures **must** be taken with a pinch of salt, please consider
70
73
  the following caveats, and others:
@@ -0,0 +1,75 @@
1
+ # JSON Model Compiler
2
+
3
+ This page documents the JSON Model Compiler (JMC), accessible from the `jmc` command.
4
+
5
+ ## Overview
6
+
7
+ The compiler is composed of 8 parts:
8
+
9
+ 1. Parser from JSON, YAML or JS
10
+ 2. Preprocessor
11
+ 3. Model Optimizations
12
+ 4. Static Compilation to IR
13
+ 5. Export to TS, JSON Schema or Pydantic
14
+ 6. IR Optimizations
15
+ 7. Target Source Code Generation in Python, C, JavaScript, Java, Perl, PL/pgSQL
16
+ 8. Target Runtime for each target language
17
+
18
+ ```mermaid
19
+ flowchart LR
20
+ filein(json
21
+ yaml
22
+ js)
23
+ parser[parser]
24
+ preproc[preproc]
25
+ m-optim[optim]
26
+ compile[static]
27
+ export[export]
28
+ ir-optim["IR
29
+ optim"]
30
+ codegen["code
31
+ gen"]
32
+ code(py
33
+ c
34
+ js
35
+ java
36
+ pl
37
+ sql)
38
+ filein --> parser --> preproc --> m-optim --> compile --> ir-optim --> codegen --> code
39
+ fileout(schema
40
+ ts
41
+ py)
42
+ m-optim --> export --> fileout
43
+ runtime[runtime]
44
+ runtime --> code
45
+ ```
46
+
47
+ ## Parser
48
+
49
+ Read a model, possibly resolving remote references, from JSON, YAML or JS syntaxes.
50
+
51
+ ## Preprocessor
52
+
53
+ Apply model transformations (`%`), check references (`$`) and eliminate object merges (`+`).
54
+
55
+ ## Model Optimization
56
+
57
+ Perform optimizations at the model level, including partial evaluation,
58
+ various simplifications and normalizations.
59
+
60
+ ## Static Compiler
61
+
62
+ Generate a language-agnostic AST (Abstract Syntax Tree) IR (Intermediate Representation) for the evaluator.
63
+
64
+ ## IR Optimization
65
+
66
+ Optimize the AST, which results in simpler source code.
67
+
68
+ ## Code Generator
69
+
70
+ Generate actual target source code from the AST.
71
+ This includes target-specific optimizations.
72
+
73
+ ## Runtime
74
+
75
+ Per-language runtimes provide support functions.
@@ -4,12 +4,14 @@ Following the [diátaxis](https://diataxis.fr/) approach, this project provides:
4
4
 
5
5
  ## Explanations and discussions
6
6
 
7
- See [introduction](README.md) and [research papers](PUBS#research-papers).
7
+ See [introduction](README.md), [compiler documentation](COMP.md)
8
+ and [research papers](PUBS#research-papers).
8
9
 
9
10
  ## Tutorial
10
11
 
11
12
  See [tutorial](TUTO.md) about JSON Model and the `jmc` command,
12
- using a [docker](DOCKER.md) [image](https://hub.docker.com/r/zx80/jmc) for easy deployment.
13
+ using a [docker](DOCKER.md)
14
+ [image](https://hub.docker.com/r/zx80/jmc) for easy deployment.
13
15
 
14
16
  ## How To
15
17
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_model_compiler
3
- Version: 2.0.62
3
+ Version: 2.0.63
4
4
  Summary: JSON Model Tools
5
5
  Author: Fabien Coelho, Claire Yannou-Medrala
6
6
  License-Expression: CC0-1.0
@@ -127,6 +127,7 @@ for all possible values for that type.
127
127
  - `"$F16"`, `"$F32"`, `"$F64"`: 16/32/64 bit precision
128
128
  [IEEE 754](https://standards.ieee.org/ieee/754/6210/) floats.
129
129
  - "`$STRING"`: a string.
130
+ - `"$RATE"`: a float between _0.0_ and _1.0_.
130
131
 
131
132
  In addition, the following string predefs are defined:
132
133
 
@@ -196,7 +197,9 @@ Property names are matched as follow:
196
197
  - `"?XXX"`: optional properties directly provided after the `?`.
197
198
  - `"/.../"`: optional property names matching a regular expression:
198
199
  eg `{"/^a/": ""}` means property names starting with _a_ must have string values.
199
- - `"$XXX"`: optional property reference to a **string** [definition](#definitions-and-scope).
200
+ - `"$XXX"`: optional property reference to a **string** [definition](#definitions-and-scope)
201
+ or predef. The target definition type must be resolved as a string according to
202
+ the [typing lattice](#static-typing-lattice).
200
203
  - `""` catch all property: any property name matches.
201
204
  This is consistent with `""` standing for any string.
202
205
  - property names starting with other characters are reserved for future uses and must be rejected.
@@ -216,7 +219,7 @@ property specifications are **not** cumulative.
216
219
 
217
220
  The matching search **should** follow the specification order within these classes
218
221
  if the language JSON representation allows it.
219
- However, a model **should nots** rely on the fact that the specification order is preserved
222
+ However, a model **should not** rely on the fact that the specification order is preserved
220
223
  for its expected semantics.
221
224
  This allows to hint optimization by putting more likely properties ahead of the check.
222
225
 
@@ -1,5 +1,31 @@
1
1
  # JSON Model Compiler Versions
2
2
 
3
+ ## 2.0.63 on 2026-10-05
4
+
5
+ - pr: center logo in sidebar
6
+ - optim: handle indirect number models
7
+ - optim: improve partial eval for more num nones
8
+ - optim: simplify some '!=' cases
9
+ - perf: ~add another loop over performance collection?~
10
+ - pr: add simple compiler description page
11
+ - optim: fix xor bad deduplication optimization when 3 models are equal
12
+ - optim: `{"a":"$NONE"}` is `"$NONE"`
13
+ - optim: `{"?a":"$NONE"}` or `{"": "$NONE"}` is `{}`
14
+ - check: prop references must be strings
15
+ - static: shortcut on open may-only props
16
+ - sql: capitalize bool and int type names for consistency
17
+ - backends: refactor language-specific code generation settings to each language
18
+ - bench: add corvus external reference
19
+ - bench: add untested `--collect` option
20
+ - bench: submit `negatives.jsonl` to jsb for sanity checks (wip)
21
+ - bench: always use `latest` tag for external tools (ajv, corvus)
22
+ - java-runtime: update dependent java lib versions (base container, runtime)
23
+ - bench: run negatives to access tool accuracy
24
+ - bench: extract and report tool accuracy, precision, recall…
25
+ - spec: add `$RATE` predef, float in [0.0, 1.0]
26
+ - bench: add build option to cron script
27
+ - bench: disactivate reruns on jsb changes
28
+
3
29
  ## 2.0.62 on 2026-09-20
4
30
 
5
31
  - bench: add case names to generated radar
@@ -31,13 +31,16 @@ for artifact in $(ls site/benchmarks/*.md | sort -r) ; do
31
31
  jsu=$(get_version jsu $artifact)
32
32
  jmc=$(get_version jmc $artifact)
33
33
  sbc=$(get_version jsonschema-cli $artifact)
34
+ crv=$(get_version corvus-cli $artifact)
34
35
  message=""
35
36
  [ "$(grep 'content:.*yes' $artifact)" ] && message+="content" || message+="no content"
36
37
  [ "$(grep 'JSU_OPT.*--no-id' $artifact)" ] && message+=", no id" || message+=", id"
37
38
  [ "$(grep 'fix:.*yes' $artifact)" ] && message+=", fix" || message+=", no fix"
38
- echo "- Artifact [$name]($link) using [JMC $jmc]($PYPI/json-model-compiler/$jmc/), "
39
- echo " [JSU $jsu]($PYPI/json-schema-utils/$jsu/) and "
40
- echo " [SBC $sbc](https://github.com/sourcemeta/jsonschema/releases/tag/v$sbc), "
39
+ echo "- Artifact [$name]($link) using"
40
+ echo " [JMC $jmc]($PYPI/json-model-compiler/$jmc/), "
41
+ echo " [JSU $jsu]($PYPI/json-schema-utils/$jsu/), "
42
+ [ "$sbc" ] && echo " [SBC $sbc](https://github.com/sourcemeta/jsonschema/releases/tag/v$sbc),"
43
+ [ "$crv" ] && echo " [Corvus $crv](https://corvus-oss.org/Corvus.JsonSchema/),"
41
44
  echo " $message."
42
45
 
43
46
  [ $nartifacts -eq $MAX ] && break
@@ -186,14 +186,16 @@ def valid(jm: JsonModel,
186
186
  else: # check object
187
187
  props = set() # check property name collisions
188
188
  for p, m in model.items():
189
- if p == "#":
189
+ if p == "#" or p and p[0] == "#": # skip comments
190
190
  continue
191
191
  assert isinstance(p, str), f"property name {p} is a string at {spath}"
192
- if p and p[0] not in ("$", "/"):
192
+ if p and p[0] not in "$/":
193
193
  name = p[1:] if p[0] in ("?", "_", "!") else p
194
194
  assert name not in props, f"no property name collison at {spath}"
195
195
  props.add(name)
196
- # more checks on p if p[0] == "$"
196
+ elif p and p[0] == "$": # check property name type
197
+ assert ultimate_type(jm, p) is str, f"property name reference {p} is a string at {spath}"
198
+ # else p == "" or p is a regex
197
199
  case _:
198
200
  assert False, f"unexpected model base type at {spath}"
199
201
  return True
@@ -301,6 +301,15 @@ class CLangJansson(Language):
301
301
  self._partition_threshold = partition_threshold
302
302
  self._byte_order = byte_order
303
303
 
304
+ self._settings |= {
305
+ "mot": 0,
306
+ "mmo": 0,
307
+ "moo": 3,
308
+ "map": 256,
309
+ "par": 6,
310
+ "omu": 4,
311
+ "aun": 4,
312
+ }
304
313
  # instance counter
305
314
  self._count = Counter()
306
315
 
@@ -9,12 +9,15 @@ from .predefs import PREDEF_RE, PREDEFS
9
9
 
10
10
  PREDEF_TYPES: dict[str, str] = {
11
11
  "$NUMBER": "number",
12
+ "$RATE": "number",
12
13
  }
13
14
 
14
15
  for name, model in PREDEFS.items():
15
16
  if name[0] == "o": # skip $oXXX
16
17
  continue
17
18
  pname = "$" + name
19
+ if pname in PREDEF_TYPES:
20
+ continue
18
21
  match model:
19
22
  case None:
20
23
  PREDEF_TYPES[pname] = "null"
@@ -146,6 +149,9 @@ def _m2s(model: ModelType, path: ModelPath, defs: Symbols) -> JsonSchema:
146
149
  schema["contentMediaType"] = "application/json"
147
150
  elif model in PREDEF_RE:
148
151
  schema["pattern"] = PREDEF_RE[model][1]
152
+ elif model == "$RATE":
153
+ schema["minimum"] = 0.0
154
+ schema["maximum"] = 1.0
149
155
  # else: ignore
150
156
  elif model[0] == "$":
151
157
  if model == "$#":
@@ -0,0 +1 @@
1
+ 2.0.63
@@ -204,6 +204,12 @@ is below the provided threshold, default is depends on target.
204
204
  Consider must-only object property scheme if the number of mandatory
205
205
  properties is below the provided threshold, default depends on target.
206
206
 
207
+ =item B<--may-only-open-threshold THRESHOLD>
208
+
209
+ Count-based shorcut for may-only open objects if the number of optional
210
+ properties is greater than 1 and below the provided threshold.
211
+ Default is 3, 0 to disable.
212
+
207
213
  =item B<--partition-threshold THRESHOLD>
208
214
 
209
215
  Number of properties to trigger partitioning inlined property checks,
@@ -96,6 +96,10 @@ class IRep(Language):
96
96
  self._if_optim = if_optim
97
97
  self._byte_order = lang._byte_order if lang else "le"
98
98
 
99
+ def setting(self, name: str, val: int|None) -> int:
100
+ # FORWARD to lang if distinct, else use common defaults
101
+ return self._lang.setting(name, val) if self != self._lang else super().setting(name, val)
102
+
99
103
  # language dependent stuff is forwarded to the underlying language if any
100
104
  def fast_strlen(self) -> bool:
101
105
  return self._lang._fast_strlen
@@ -46,6 +46,15 @@ class Java(Language):
46
46
 
47
47
  self._json_esc_table = str.maketrans(_ESC_TABLE)
48
48
  self.reindent = True
49
+ self._settings |= {
50
+ "mot": 8,
51
+ "mmo": 8,
52
+ "moo": 3,
53
+ "map": 12,
54
+ "par": 0,
55
+ "omu": 2,
56
+ "aun": 3,
57
+ }
49
58
 
50
59
  #
51
60
  # file
@@ -66,6 +66,15 @@ class JavaScript(Language):
66
66
  self._json_esc_table = str.maketrans(_ESC_TABLE)
67
67
  self._direct = direct
68
68
  self._runtime = runtime
69
+ self._settings |= {
70
+ "mot": 256,
71
+ "mmo": 16,
72
+ "moo": 3,
73
+ "map": 20,
74
+ "par": 0,
75
+ "omu": 2,
76
+ "aun": 0,
77
+ }
69
78
 
70
79
  #
71
80
  # file
@@ -103,6 +103,17 @@ class Language:
103
103
  self.reindent = False
104
104
  self._predefs: set[str] = predefs # implemented by language runtime
105
105
 
106
+ # code generator settings
107
+ self._settings: dict[str, int] = {
108
+ "mot": 8, # must only threshold
109
+ "mmo": 16, # may must open threshold
110
+ "moo": 3, # may only open threshold (max, untested)
111
+ "map": 12, # map threshold
112
+ "par": 0, # partition threshold
113
+ "omu": 0, # or-must threshold
114
+ "aun": 0, # array unroll size
115
+ }
116
+
106
117
  # Hmmm…
107
118
  self._lang = self
108
119
 
@@ -110,6 +121,10 @@ class Language:
110
121
  """Version string in generated code."""
111
122
  return self._version.split(".", 1)[0] if self._short_version else self._version
112
123
 
124
+ def setting(self, name: str, val: int|None = None) -> int:
125
+ """Language-specific code generation default settings."""
126
+ return self._settings[name] if val is None else val
127
+
113
128
  def ident(self, prefix: str) -> Var:
114
129
  """Return a new identifier using prefix."""
115
130
  if prefix not in self._idcounts:
@@ -216,12 +231,20 @@ class Language:
216
231
  elif name in ("$INT", "$INTEGER", "$I32", "$I64"):
217
232
  return self.is_a(var, int)
218
233
  elif name in ("$U32", "$U64"):
219
- return self.and_op(self.is_a(var, int),
220
- self.num_cmp(self.value(var, int), ">=", self.const(0), False, True))
234
+ return self.and_op(
235
+ self.is_a(var, int),
236
+ self.num_cmp(self.value(var, int), ">=", self.const(0), False, True)
237
+ )
221
238
  elif name in ("$FLOAT", "$F32", "$F64"):
222
239
  return self.is_a(var, float)
223
240
  elif name == "$NUMBER":
224
241
  return self.is_a(var, Number) # type: ignore
242
+ elif name == "$RATE":
243
+ return self.and_op(
244
+ self.is_a(var, float),
245
+ self.num_cmp(self.value(var, float), ">=", self.const(0.0)),
246
+ self.num_cmp(self.value(var, float), "<=", self.const(1.0)),
247
+ )
225
248
  elif name == "$STRING":
226
249
  return self.is_a(var, str) if not is_str else self.true()
227
250
  elif self.str_content_predef(name):
@@ -321,13 +321,13 @@ def intersect(
321
321
  return in1
322
322
  # type strict inclusions
323
323
  # TODO loose ints/floats?
324
- if t1t is int:
324
+ if t1t is int and isinstance(m1, int) and isinstance(m2, int):
325
325
  mm, mM = min(m1, m2), max(m1, m2)
326
326
  if mm == -1 and mM in (0, 1):
327
327
  return mM
328
328
  elif mm == 0 and mM == 1:
329
329
  return 1
330
- if t1t is float:
330
+ if t1t is float and isinstance(m1, (int, float)) and isinstance(m2, (int, float)):
331
331
  mm, mM = min(m1, m2), max(m1, m2)
332
332
  if mm == -1.0 and mM in (0.0, 1.0):
333
333
  return mM
@@ -459,14 +459,21 @@ def partial_eval(jm: JsonModel):
459
459
  return "$NONE"
460
460
  elif all(map(lambda m: isinstance(m, str) and (m == "" or m[0] not in "$/="),
461
461
  lxor)):
462
+ # only direct strings
462
463
 
463
464
  # beware of type inclusions!
464
- if len(list(filter(lambda m: m == "", lxor))) == 2:
465
+ if len(list(filter(lambda m: m == "", lxor))) >= 2:
465
466
  changes += 1
466
467
  return "$NONE"
467
468
  has_str = "" in lxor
468
469
 
469
- # move doubled (or more) string constants
470
+ # normalize string constants with a _
471
+ normal = [ f"_{m}" if m and m[0] != "_" else m for m in lxor ]
472
+ if normal != lxor:
473
+ changes += 1
474
+ lxor = normal
475
+
476
+ # remove doubled (or more) string constants
470
477
  seen, doubled = set(), set()
471
478
  for m in lxor:
472
479
  if m in seen:
@@ -542,6 +549,11 @@ def partial_eval(jm: JsonModel):
542
549
  v = float(model["="])
543
550
  lev = v if lev is None else min(lev, v)
544
551
  gev = v if gev is None else max(gev, v)
552
+ # constant num model
553
+ if isinstance(model["@"], str) and re.match(r"^=[-+]?\d+(\.\d*)?([eE][-+]?\d+)?$", model["@"]):
554
+ v = float(model["@"][1:])
555
+ lev = v if lev is None else min(lev, v)
556
+ gev = v if gev is None else max(gev, v)
545
557
  # conclude for < <= = > >=
546
558
  if gev is not None and lev is not None and gev > lev:
547
559
  changes += 1
@@ -553,6 +565,9 @@ def partial_eval(jm: JsonModel):
553
565
  if gev is not None and nev < gev or lev is not None and lev < nev:
554
566
  changes += 1
555
567
  del model["!="]
568
+ if gev is not None and lev is not None and nev == lev and nev == gev:
569
+ changes += 1
570
+ return "$NONE"
556
571
  # .mo
557
572
  if ".mo" in model:
558
573
  mo = model[".mo"]
@@ -618,7 +633,22 @@ def partial_eval(jm: JsonModel):
618
633
  for prop in drop:
619
634
  changes += 1
620
635
  del model[prop]
621
-
636
+ # check for mandatory none props
637
+ for prop, smodel in model.items():
638
+ if prop and prop[0] not in "#/$?" and smodel == "$NONE":
639
+ changes += 1
640
+ return "$NONE"
641
+ # simplify optional none catchall prop
642
+ if "" in model and model[""] == "$NONE":
643
+ changes += 1
644
+ del model[""]
645
+ # simplify optional none props
646
+ # TODO improve, but props masking to consider
647
+ optprops = {p for p in model if p == "" or p[0] in "/$?"}
648
+ if all(model[p] == "$NONE" for p in optprops): # safe case
649
+ changes += len(optprops)
650
+ for p in optprops:
651
+ del model[p]
622
652
  return model
623
653
 
624
654
  # log.debug(f"{jm._id}: eval in = {jm._model}")
@@ -53,6 +53,15 @@ class Perl(Language):
53
53
  self._json_esc_table = str.maketrans(_ESC_TABLE)
54
54
  # TODO check actual use to desactivate
55
55
  self._setmap_used = True
56
+ self._settings |= {
57
+ "mot": 128,
58
+ "mmo": 16,
59
+ "moo": 3,
60
+ "map": 8,
61
+ "par": 0,
62
+ "omu": 3,
63
+ "aun": 0,
64
+ }
56
65
 
57
66
  def esc(self, s: str) -> StrExpr:
58
67
  return "\"" + s.translate(self._json_esc_table) + "\""
@@ -49,7 +49,7 @@ class PLpgSQL(Language):
49
49
  eq="=", ne="<>", indent=" ",
50
50
  not_op="NOT", and_op="AND", or_op="OR", lcom="--",
51
51
  true="TRUE", false="FALSE", null="NULL",
52
- check_t="TEXT", json_t="JSONB",
52
+ int_t="INT", bool_t="BOOL", check_t="TEXT", json_t="JSONB",
53
53
  path_t="TEXT[]", float_t="FLOAT8", str_t="TEXT", match_t="TEXT[]",
54
54
  eoi=";", relib=relib, debug=debug, predefs=set(PLPGSQL_RUNTIME_PREDEFS),
55
55
  set_caps=(type(None), bool, int, float, str)
@@ -58,6 +58,15 @@ class PLpgSQL(Language):
58
58
  assert relib in ("re"), f"regex engine {relib} is not supported, try: re"
59
59
 
60
60
  self._json_esc_table = str.maketrans(_ESC_TABLE)
61
+ self._settings |= { # untested…
62
+ "mot": 0,
63
+ "mmo": 0,
64
+ "moo": 3,
65
+ "map": 8,
66
+ "par": 0,
67
+ "omu": 0,
68
+ "aun": 0,
69
+ }
61
70
 
62
71
  #
63
72
  # file
@@ -26,7 +26,7 @@ INT_MODEL_PREDEFS = {
26
26
  }
27
27
 
28
28
  FLOAT_MODEL_PREDEFS = {
29
- "$FLOAT", "$F32", "$F64", "$NUMBER",
29
+ "$FLOAT", "$F32", "$F64", "$NUMBER", "$RATE",
30
30
  }
31
31
 
32
32
  MODEL_PREDEFS = {
@@ -188,6 +188,7 @@ PREDEFS: dict[str, ModelType] = {
188
188
  "F32": -1.0,
189
189
  "F64": -1.0,
190
190
  "NUMBER": {"|": [-1, -1.0]},
191
+ "RATE": {"@": 0.0, "<=": 1.0},
191
192
  "STRING": "",
192
193
  "REGEX": "",
193
194
  "EXREG": "",
@@ -40,6 +40,15 @@ class Python(Language):
40
40
 
41
41
  # TODO check actual use to desactivate
42
42
  self._setmap_used = True
43
+ self._settings |= {
44
+ "mot": 256,
45
+ "mmo": 16,
46
+ "moo": 3,
47
+ "map": 10,
48
+ "par": 0,
49
+ "omu": 2,
50
+ "aun": 0,
51
+ }
43
52
 
44
53
  def is_num(self, var: Var) -> BoolExpr:
45
54
  return f"isinstance({var}, (int, float)) and not isinstance({var}, bool)"
@@ -3,7 +3,7 @@
3
3
 
4
4
  <groupId>org.json-model</groupId>
5
5
  <artifactId>json-model</artifactId>
6
- <version>2.0.52</version>
6
+ <version>2.0.63</version>
7
7
  <packaging>jar</packaging>
8
8
 
9
9
  <name>JSON Model Java Runtime</name>
@@ -52,10 +52,10 @@
52
52
  <maven.compiler.version>3.15.0</maven.compiler.version>
53
53
  <getopt.version>1.0.13</getopt.version>
54
54
  <gson.version>2.14</gson.version>
55
- <jackson.version>3.1</jackson.version>
55
+ <jackson.version>3.2</jackson.version>
56
56
  <jackson.ann.version>2.22</jackson.ann.version>
57
57
  <jakarta.version>2.1</jakarta.version>
58
- <johnzon.version>2.1</johnzon.version>
58
+ <johnzon.version>2.2</johnzon.version>
59
59
  </properties>
60
60
 
61
61
  <!--
@@ -516,6 +516,9 @@ def jmc_script(xargs: list[str]|None = None) -> int:
516
516
  arg("--must-only-threshold", "-mot", default=None, type=int,
517
517
  help="must-only scheme if number of mandatory props below threshold,"
518
518
  " target-dependent default, 0 to disable")
519
+ arg("--may-only-open-threshold", "-moot", default=None, type=int,
520
+ help="count shortcut for on open may-only props objects below threshold but > 1,"
521
+ " default is 3, 0 to disable")
519
522
  arg("--partition-threshold", "-pt", default=None, type=int,
520
523
  help="threshold to trigger unrolled string search partitioning")
521
524
  arg("--or-must-prop", "-omp", default=None, type=int,
@@ -963,6 +966,7 @@ def jmc_script(xargs: list[str]|None = None) -> int:
963
966
  regex_pattern=args.regex_pattern,
964
967
  may_must_open_threshold=args.may_must_open_threshold,
965
968
  must_only_threshold=args.must_only_threshold,
969
+ may_only_open_threshold=args.may_only_open_threshold,
966
970
  partition_threshold=args.partition_threshold,
967
971
  or_must_prop=args.or_must_prop,
968
972
  sort_must=args.sort_must,