json-model-compiler 2.0.51__tar.gz → 2.0.52__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 (130) hide show
  1. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/.github/workflows/sanity.yml +1 -1
  2. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/API.md +1 -1
  3. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/BACKLOG.md +11 -10
  4. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/BENCH.md +4 -1
  5. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/DEV.md +79 -9
  6. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/Makefile +1 -1
  7. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/PKG-INFO +1 -1
  8. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/TUTO.md +8 -6
  9. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/VERSION.md +62 -40
  10. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/clang.py +6 -2
  11. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/convert.py +1 -0
  12. json_model_compiler-2.0.52/json_model/data/VERSION +1 -0
  13. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/irep.py +3 -3
  14. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/java.py +44 -1
  15. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/javascript.py +35 -1
  16. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/language.py +5 -3
  17. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/perl.py +24 -1
  18. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/plpgsql.py +1 -1
  19. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/predefs.py +18 -5
  20. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/c/Makefile +2 -2
  21. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/c/json-model.c +602 -17
  22. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/c/json-model.h +10 -0
  23. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/java/Makefile +8 -1
  24. json_model_compiler-2.0.52/json_model/runtime/java/env.sh +12 -0
  25. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/java/json_model/Runtime.java +10 -0
  26. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/java/pom.xml +5 -4
  27. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/js/index.js +16 -4
  28. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/pl/Makefile.PL +2 -1
  29. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/pl/lib/JSON/JsonModel.pm +37 -3
  30. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/sql/META.json +3 -3
  31. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/sql/json_model--2.0.sql +2 -1
  32. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/support.py +17 -2
  33. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/script.py +11 -0
  34. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/utils.py +1 -1
  35. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/xstatic.py +9 -11
  36. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model_compiler.egg-info/PKG-INFO +1 -1
  37. json_model_compiler-2.0.51/json_model/data/VERSION +0 -1
  38. json_model_compiler-2.0.51/json_model/runtime/java/env.sh +0 -10
  39. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/.gitignore +0 -0
  40. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/.gitmodules +0 -0
  41. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/DESIGN.md +0 -0
  42. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/DOC.md +0 -0
  43. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/HOWTO.md +0 -0
  44. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/INTEGRATION.md +0 -0
  45. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/MANIFEST.in +0 -0
  46. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/PUBS.md +0 -0
  47. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/README.md +0 -0
  48. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/SPEC.md +0 -0
  49. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/about.sh +0 -0
  50. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/README.md +0 -0
  51. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/__init__.py +0 -0
  52. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/analyze.py +0 -0
  53. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/clang_entry.c +0 -0
  54. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/clang_free.c +0 -0
  55. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/clang_init.c +0 -0
  56. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/clang_pcre2_fun.c +0 -0
  57. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/clang_re2_fun.c +0 -0
  58. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/java_free.java +0 -0
  59. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/java_init.java +0 -0
  60. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/javascript_exe.js +0 -0
  61. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/javascript_foot.js +0 -0
  62. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/javascript_free.js +0 -0
  63. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/javascript_head.js +0 -0
  64. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/javascript_init.js +0 -0
  65. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/javascript_main.js +0 -0
  66. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/jmc.pod +0 -0
  67. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/perl_entry.pl +0 -0
  68. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/perl_exe.pl +0 -0
  69. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/perl_free.pl +0 -0
  70. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/perl_init.pl +0 -0
  71. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/perl_main.pl +0 -0
  72. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/perl_pkg.pl +0 -0
  73. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/plpgsql_entry.sql +0 -0
  74. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/python_entry.py +0 -0
  75. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/python_exe.py +0 -0
  76. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/python_free.py +0 -0
  77. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/python_init.py +0 -0
  78. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/data/python_main.py +0 -0
  79. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/export.py +0 -0
  80. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/model.py +0 -0
  81. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/mtypes.py +0 -0
  82. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/objops.py +0 -0
  83. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/optim.py +0 -0
  84. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/python.py +0 -0
  85. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/recurse.py +0 -0
  86. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/regex.py +0 -0
  87. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/resolver.py +0 -0
  88. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/Makefile +0 -0
  89. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/__init__.py +0 -0
  90. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/c/main.c +0 -0
  91. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/java/.gitignore +0 -0
  92. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/java/README.md +0 -0
  93. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/java/json_model/Checker.java +0 -0
  94. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/java/json_model/GSON.java +0 -0
  95. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/java/json_model/JSON.java +0 -0
  96. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/java/json_model/JSONP.java +0 -0
  97. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/java/json_model/Jackson.java +0 -0
  98. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/java/json_model/Main.java +0 -0
  99. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/java/json_model/ModelChecker.java +0 -0
  100. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/java/json_model/Path.java +0 -0
  101. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/java/json_model/Report.java +0 -0
  102. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/js/README.md +0 -0
  103. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/js/main.js +0 -0
  104. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/js/package.json +0 -0
  105. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/pl/.gitignore +0 -0
  106. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/pl/Changes +0 -0
  107. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/pl/LICENSE +0 -0
  108. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/pl/MANIFEST +0 -0
  109. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/pl/README +0 -0
  110. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/pl/env.sh +0 -0
  111. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/pl/ignore.txt +0 -0
  112. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/pl/t/00-load.t +0 -0
  113. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/pl/t/manifest.t +0 -0
  114. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/pl/t/pod-coverage.t +0 -0
  115. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/pl/t/pod.t +0 -0
  116. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/pl/xt/boilerplate.t +0 -0
  117. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/sql/Makefile +0 -0
  118. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/sql/json_model.control +0 -0
  119. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/runtime/types.py +0 -0
  120. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/submodel.py +0 -0
  121. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model/url_cache.py +0 -0
  122. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model_compiler.egg-info/SOURCES.txt +0 -0
  123. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model_compiler.egg-info/dependency_links.txt +0 -0
  124. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model_compiler.egg-info/entry_points.txt +0 -0
  125. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model_compiler.egg-info/not-zip-safe +0 -0
  126. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model_compiler.egg-info/requires.txt +0 -0
  127. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/json_model_compiler.egg-info/top_level.txt +0 -0
  128. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/package.json +0 -0
  129. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/pyproject.toml +0 -0
  130. {json_model_compiler-2.0.51 → json_model_compiler-2.0.52}/setup.cfg +0 -0
@@ -9,7 +9,7 @@ jobs:
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
11
  - name: Checkout project
12
- uses: actions/checkout@v6
12
+ uses: actions/checkout@v7
13
13
  - name: Set up Python
14
14
  uses: actions/setup-python@v6
15
15
  - name: Install Package Stuff
@@ -249,7 +249,7 @@ This generated code exports 4 useful functions:
249
249
  plus two parameters which must be `undef` for now.
250
250
 
251
251
  The generated functions and runtime depends in `JSON::JsonModel`, `re::engine::RE2`,
252
- `JSON::MaybeXS` for JSON.
252
+ `JSON::MaybeXS` and `Algorithm::LUHN`.
253
253
 
254
254
  For instance, generate a Perl module:
255
255
 
@@ -2,16 +2,15 @@
2
2
 
3
3
  ## Current Tasks
4
4
 
5
+ - [ ] tests: check more bad urls (eg bad %-escape)
6
+ - [ ] static: use combined type test and value extraction when available?
7
+ - [ ] irep: cleanup `propesc2.c` (and others) variable res set but not used
5
8
  - [ ] c-backend: factor out str extraction in or-list in more cases
6
- - [ ] pl-backend: use short post-if where possible (filtering)
7
- - [ ] pl-backend: use `unless` where appropriate (filtering?)
8
- - [ ] js-backend: remove useless braces and semi-colons
9
- - [ ] java-backend: remove useless braces
10
9
  - [ ] export: generate a [katydid](https://katydid.github.io/) expression, for a compatible subset
10
+ - [ ] static: factor out common checks on `&` with shared constraints?
11
11
  - [ ] front: generate valid minimal, maximal and random values from a model
12
12
  - [ ] front: generate invalid minimal values from a model
13
13
  - [ ] optim: simplify some '!=' cases
14
- - [ ] perf: run benchmark for formats/predefs enabled
15
14
  - [ ] spec: allow to _remove_ definitions, eg `{ "$stuff": {"/": "$foo"}}`
16
15
  - [ ] static: check for common object part
17
16
  - [ ] perf: add another loop over performance collection?
@@ -57,7 +56,6 @@
57
56
  - [ ] predefs: improve `$URI` and `$URL`
58
57
  - [ ] backend: check leap-second support on `$DATETIME` and `$TIME`
59
58
  - [ ] doc: add _known limitations_ stuff
60
- - [ ] doc: improve developer documentation
61
59
  - [ ] spec: restrict regex syntax to a smaller subset
62
60
  - [ ] predefs: add `$SIMPLE_REGEX` for regex syntax subset?
63
61
  - [ ] docker: enable user remap
@@ -142,22 +140,24 @@
142
140
  - [ ] tests: add a few tests for jsonrpc model
143
141
  - [ ] model: write a model for MCP
144
142
  - [ ] tests: add a few tests for MCP model
143
+ - [ ] model: add a clean model for SAP UI5 tools?
145
144
  - [ ] model: update and test `ri.model.json`
146
145
  - [ ] export: generate ts interfaces
147
- - [ ] export: katydid?
148
- - [ ] backend: improve generated code with filters for js, java, pl
149
146
  - [ ] tests: improve predef validators cross-language consistency
150
147
  - [ ] tests: generate invalid minimal, maximal, random values
151
148
  - [ ] tests: generate invalid values on each constraint
152
- - [ ] backend: C and runtime with other json lib
149
+ - [ ] backend: C and runtime with json-c
153
150
  - [ ] backend: C++
154
151
  - [ ] backend: go
155
152
  - [ ] backend: php
156
153
  - [ ] backend: ruby
157
154
  - [ ] backend: rust
155
+ - [ ] backend: test and fix existing dart backend MR
158
156
  - [ ] export: generate annotated java interfaces/classes?
159
157
  - [ ] tool: jmc api in flask
160
158
  - [ ] front: allow IR re-entrance?
159
+ - [ ] export: katydid?
160
+ - [ ] api: json model as a service backend with flask
161
161
 
162
162
  ## Re Do
163
163
 
@@ -342,7 +342,8 @@
342
342
  - [ ] design: documentation use case, with added _markdown description_
343
343
  - [ ] pr: validation must be optimized for the valid case, as it is the most likely.
344
344
  - [ ] case: use trafo in geo to have either 2 or 3 vectors, no mix.
345
+ - [ ] c-backend: consider [json-c](https://github.com/json-c/json-c)
345
346
  - [ ] c-backend: consider [yyjson](https://github.com/ibireme/yyjson)
346
347
  - [ ] c-backend: consider [cJSON](https://github.com/davegamble/cjson) (linked lists? no ints?…)
347
- - [ ] c-backend: consider [json-c](https://github.com/json-c/json-c)
348
+ - [ ] ~c-backend: consider [Parson](https://github.com/kgabis/parson) (unmaintained?)~
348
349
  - [ ] ~c-backend: consider [json.h](https://github.com/sheredom/json.h) (hmmm, linked lists)~
@@ -12,6 +12,9 @@ schema to model converter in C, JS, Java (GSON, Jackson and JSONP using Johnzon)
12
12
  Overall, depending on the chosen metrics, the JSU converter and JMC C backend are 50 to 90%
13
13
  faster than Blaze in these artifacts.
14
14
 
15
+ - [2026071000](benchmarks/2026071000.md) clang, no predefs, jsu 0.9.12/jmc 2.0.51 vs sbc 16.1.0, 11 runs, 1000 iterations.
16
+ - [2026070900](benchmarks/2026070900.md) clang, no predefs, jsu 0.9.11/jmc 2.0.51 vs sbc 16.1.0, 11 runs, 1000 iterations.
17
+ - [2026062200](benchmarks/2026062200.md) clang, no predefs, jsu 0.9.11/jmc 2.0.51 vs sbc 16.0.0, 11 runs, 1000 iterations.
15
18
  - [2026062102](benchmarks/2026062102.md) clang, no predefs, jsu 0.9.10/jmc 2.0.50 vs sbc 16.0.0, 11 runs, 1000 iterations.
16
19
  - [2026061700](benchmarks/2026061700.md) clang, no predefs, jsu 0.9.9/jmc 2.0.50 vs sbc 16.0.0, 11 runs, 1000 iterations.
17
20
  - [2026061300](benchmarks/2026061300.md) clang, no predefs, jsu 0.9.9/jmc 2.0.50 vs sbc 15.11.0, 11 runs, 1000 iterations.
@@ -84,7 +87,7 @@ the following caveats, and others:
84
87
  for faster parsing, a library may use linked-list for properties, which means
85
88
  that retrieving a given property value will cost more than a library which uses
86
89
  a hash table which is more costly to build.
87
- - blaze does _not_ implement checking string values (eg dates, url…),
90
+ - before version _16.0_, blaze does _not_ implement checking string values (eg dates, url…),
88
91
  so these checks may be disactivated (see `JMC_OPTS`) for fairness,
89
92
  reducing the results significance.
90
93
  - blaze uses its own special-purpose JSON representation which include a precomputed
@@ -6,7 +6,7 @@ Beware that the developer documentation is scarce. PR are always welcome, eg:
6
6
 
7
7
  - new language or library support implementations
8
8
  - new exporters
9
- - possibly new models
9
+ - new native models
10
10
  - generated code optimizations
11
11
 
12
12
  ## Publication Accounts
@@ -41,26 +41,95 @@ git clone --recursive-submodules git@github.com:clairey-zx81/json-model.git
41
41
  cd json-model
42
42
  ```
43
43
 
44
- If you intend to develop and submit a PR, fork the repos before cloning.
44
+ If you intend to develop and submit a PR, fork the repos before cloning, and create a branch.
45
+ Use `pull` with `rebase` to ensure a linear commit history.
45
46
 
46
- To setup a local developer environment, run at the root of the project:
47
+ There are 3 branches:
48
+
49
+ - `main` for releases
50
+ - `post` for post-release changes
51
+ - `dev` for fixes and features
52
+
53
+ New things happen on `dev`, the are merged into `main` for release from time to time.
54
+ Branch `post` is used to add new benchmark artifacts out of the release cycle.
55
+
56
+ The `post`/`main` branches and `main` tags are needed so that automatic versioning works.
57
+
58
+ To setup a local developer environment, run at the root of the project, try `make dev`.
47
59
 
48
60
  ```sh
49
61
  # for Python
50
- make dev
62
+ make dev.py
51
63
  source venv/bin/activate
52
64
  # for JS
53
65
  npm install
54
- # for Perl
66
+ # for Perl, install dependencies, see "PREREQ_PM" in Makefile.PL, then:
55
67
  source $PWD/json_model/runtime/pl/env.bash
56
68
  # for Java
57
- # get needed dependency jars (see pom.xml), then
58
- make -C json_model/runtime/java jar
69
+ # get needed dependencies and compile jar
70
+ make -C json_model/runtime/java mvn.jar mvn.deps
59
71
  source $PWD/json_model/runtime/java/env.bash
60
72
  # for C
61
- # install pcre2, cre2, gnu getopt, jansson
73
+ # install pcre2, cre2, gnu getopt, jansson, compile runtime
74
+ make -C json_model/runtime/c compile
62
75
  # for SQL
63
- # have psql ready to connect to a local Postgres
76
+ # have psql ready to connect to a local Postgres, and the permissions to
77
+ # create databases and install the `json_model` extension (for running tests).
78
+ ```
79
+
80
+ It can be convenient to have a local `env.sh` (or similar) file at the root
81
+ of the project to setup the needed environment:
82
+
83
+ ```bash
84
+ # File env.sh
85
+ source venv/bin/activate
86
+ source $PWD/json_model/runtime/pl/env.sh
87
+ source $PWD/json_model/runtime/java/env.sh
88
+ ```
89
+
90
+ ## Tests
91
+
92
+ Tests use `pytest`, possibly through `make`.
93
+
94
+ ### Root directory
95
+
96
+ Python linting (not well maintained) and non regression tests
97
+
98
+ ```bash
99
+ make check
100
+ make check.src # linting
101
+ make check.tests # tests
102
+ ```
103
+
104
+ ### Tests directory
105
+
106
+ Pytests tests inside `tests`
107
+
108
+ ```bash
109
+ make check # run pytest tests in parallel
110
+ make check.check # regenerate all reference files
111
+ make clean.js js # regenerate javascript stuff
112
+ make clean.java java # regenerate java stuff
113
+ make clean.pl pl # regenerate pl stuff
114
+ make clean # remove intermediate files
115
+ ```
116
+
117
+ Example manual command:
118
+
119
+ ```bash
120
+ pytest -n auto -k mv-22 tests.py
121
+ ```
122
+
123
+ ### Tests subdirectories
124
+
125
+ Subdirectories provide a parallel work unit:
126
+
127
+ ```bash
128
+ make gen # generate reference files
129
+ make check # regenerate reference files
130
+ make clean # remove intermediate files
131
+ make clean.js js # regenerate js stuff (and other languages)
132
+ make foo.CLEAN foo.ALL # clean/regenerate all stuff for case "foo"
64
133
  ```
65
134
 
66
135
  ## Code Doc
@@ -74,6 +143,7 @@ Section _The jmc Compiler_ is not too bad for an initial understanding.
74
143
  Procedure for releasing a new python package version:
75
144
 
76
145
  - consider releasing both JSU and JMC at the same time!
146
+ - consider testing bowtie and jsonschema-benchmark dockers with the dev branch
77
147
  - merge `dev` changes into the `main` branch
78
148
  - update `json_model/data/VERSION`, `BACKLOG.md` and `VERSION.md`
79
149
  - `git commit` and `git tag` as new version
@@ -48,7 +48,7 @@ node_modules:
48
48
  # FIXME get jar dependencies? rely on mvn?
49
49
  .PHONY: dev.java
50
50
  dev.java:
51
- $(MAKE) -C json_model/runtime/java jar
51
+ $(MAKE) -C json_model/runtime/java mvn.jar mvn.deps
52
52
 
53
53
  #
54
54
  # CLEANUP
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_model_compiler
3
- Version: 2.0.51
3
+ Version: 2.0.52
4
4
  Summary: JSON Model Tools
5
5
  Author: Fabien Coelho, Claire Yannou-Medrala
6
6
  License-Expression: CC0-1.0
@@ -249,7 +249,7 @@ jmc --name Pi Person-2 pi.json # PASS
249
249
  A common use case is to define some data structure and to reuse them in other
250
250
  related settings, much like one would _import_ a module or _include_ a header file.
251
251
  JSON Model allows definitions to be local or remote URLs so as to fetch and reuse
252
- external models easily.
252
+ external models easily. Here the `#` keyword is not a comment but a definition selector.
253
253
 
254
254
  Let us write file `Class.model.json` which reuses `Person-2.model.json` by loading
255
255
  it as a file (`$./Person-2`) for defining the class name and array of students:
@@ -320,7 +320,8 @@ jmc Loose moe.json # PASS
320
320
  A common pattern is to allow several kind of object as some point in the data structure,
321
321
  aka a _union_.
322
322
  This can be expressed with a model involving either the special `^` (xor, one-of) or `|`
323
- (or, any-of) property with an array of possible models.
323
+ (or, any-of) property with an array of possible models. A sample value stands for its whole type,
324
+ and its sign selects the range: -1.0 means any float, 0.0 non-negative, 1.0 strictly positive — likewise -1, 0, 1 for integers.
324
325
 
325
326
  Let us consider the model in file `Geom.model.json`, which defines a coordinate (`coord`) as
326
327
  a pair of numbers, and use it for point and segment objects:
@@ -328,15 +329,15 @@ a pair of numbers, and use it for point and segment objects:
328
329
  ```json
329
330
  {
330
331
  "#": "Geometrical Model",
331
- "$": { "coord": [ -1.0, -1.0 ] },
332
+ "$": { "Coord": [ -1.0, -1.0 ] },
332
333
  "^": [
333
334
  {
334
335
  "type": "_Point",
335
- "data": "$coord"
336
+ "data": "$Coord"
336
337
  },
337
338
  {
338
339
  "type": "_Segment",
339
- "data": [ "$coord", "$coord" ]
340
+ "data": [ "$Coord", "$Coord" ]
340
341
  }
341
342
  ]
342
343
  }
@@ -678,11 +679,12 @@ jmc -o Person.java Person-2 # Java class
678
679
  jmc -o person.sql Person-2 # PL/pgSQL functions
679
680
  ```
680
681
 
682
+ If you have postgresql instance installed then:
681
683
  Here is an example of checking JSONB values inside Postgres, by importing
682
684
  JSON Model runtime and generated code:
683
685
 
684
686
  ```sh
685
- sudo make -C json_model/runtime install # install runtime
687
+ sudo make -C json_model/runtime/sql install # install runtime
686
688
  # OR: sudo pgxn install json_model
687
689
  psql -f person.sql # load runtime and model checking functions
688
690
  ```
@@ -1,6 +1,28 @@
1
1
  # JSON Model Compiler Versions
2
2
 
3
- ## 2.0.51 2026-06-22
3
+ ## 2.0.52 on 2027-07-13
4
+
5
+ - js-backend: remove useless semi-colons
6
+ - js-backend: remove useless braces by filtering output
7
+ - pl-backend: use `unless` where appropriate by filtering output
8
+ - pl-backend: use short post-if/unless where possible by filtering output
9
+ - java-backend: remove useless braces by filtering output
10
+ - doc: improve developer documentation
11
+ - clang: fix clang loose int extraction (`json_integer_value` returns 0 on floats)
12
+ - tests: add `schema.check` for most test models
13
+ - runtimes: accept "oci:..." as valid urls in java, python, perl, plpgsql…
14
+ - runtimes: improve homogeneity for `$URL` across languages (js, c, py, pl, java)
15
+ - container: add missing `Algorithm::LUHN` Perl module installation
16
+ - java-runtime: use maven to get dependencies and compile
17
+ - pr: improve dev setup documentation
18
+ - tests: add jsonrpc tests
19
+ - container: add perl `URI` dependency
20
+ - front: add ability to recompile a modified C or Java source file
21
+ - c-runtime: add fast [RFC3986](https://www.rfc-editor.org/info/rfc3986/) URI parser
22
+ - predef: add `$URI_REL` for openapi, with non perfect cross-language support
23
+ - perf: run benchmark for formats/predefs enabled (ok, add artifact after release)
24
+
25
+ ## 2.0.51 on 2026-06-22
4
26
 
5
27
  - perf: rename `show.py` as `report.py`
6
28
  - front: allow to add a comment in generated source files
@@ -24,7 +46,7 @@
24
46
  - optim: do not flatten `^`!
25
47
  - optim: fix wrong removal of min props constraint when not an object
26
48
 
27
- ## 2.0.50 2026-05-21
49
+ ## 2.0.50 on 2026-05-21
28
50
 
29
51
  - c-runtime: remove some warnings on build
30
52
  - front: reduce version display verbosity
@@ -76,7 +98,7 @@
76
98
  - perf: also add jsb sharing when using js-cli
77
99
  - java-runtime: fix GSON null when used in value sets
78
100
 
79
- ## 2.0.49 2026-05-09
101
+ ## 2.0.49 on 2026-05-09
80
102
 
81
103
  - front: cleanup obsolete versioning stuff
82
104
  - front: show dynamic version when under dev
@@ -85,7 +107,7 @@
85
107
  - front: workaround, allow to skip dynamic version recomputation
86
108
  - front: use semver
87
109
 
88
- ## 2.0b48 2026-05-07
110
+ ## 2.0b48 on 2026-05-07
89
111
 
90
112
  - static: unroll small array scans for simple type checks
91
113
  - test: cover more array unrolling cases
@@ -96,7 +118,7 @@
96
118
  - front: show git hash on `--version`?
97
119
  - front: switch to dynamic versioning
98
120
 
99
- ## 2.0b46 2026-05-03
121
+ ## 2.0b46 on 2026-05-03
100
122
 
101
123
  - c-backend: test real then int when checking for a number
102
124
  - static: provide type of array elements for unique
@@ -113,20 +135,20 @@
113
135
  - pr: cleanup backlog and create version markdown
114
136
  - docker: use ubuntu 26.04 base
115
137
 
116
- ## 2.0b45 2026-04-25
138
+ ## 2.0b45 on 2026-04-25
117
139
 
118
140
  - ~perl-backend: improve resilience to missing dependencies, eg `Algorithm::LUHN`~
119
141
  - c-backend: allow to reuse pre-compiled runtime
120
142
 
121
- ## 2.0b44 2026-04-24
143
+ ## 2.0b44 on 2026-04-24
122
144
 
123
145
  - front: allow to call script as a function
124
146
 
125
- ## 2.0b43 2026-04-23
147
+ ## 2.0b43 on 2026-04-23
126
148
 
127
149
  - optim: override simpler regex props if stricter
128
150
 
129
- ## 2.0b42 2026-04-20
151
+ ## 2.0b42 on 2026-04-20
130
152
 
131
153
  - \*-backend: remove `--jsonschema-benchmark` handling as it is moved to this repo
132
154
  - command: add `--no-comment` option not to generate comments in source code
@@ -192,7 +214,7 @@
192
214
  - model: add option to `s` on regex? else `.` is any but `\n` and sometimes `\r`
193
215
  - optim: `/^.{1,256}$/`? only under `/s` though…
194
216
 
195
- ## 2.0b41 2026-03-14
217
+ ## 2.0b41 on 2026-03-14
196
218
 
197
219
  - optim: do not recheck object if not necessary
198
220
  - command: show runtime directory with `--runtime`
@@ -200,19 +222,19 @@
200
222
  - js-backend: export model map
201
223
  - pl-backend: add and export `mapper` function
202
224
 
203
- ## 2.0b40 2026-03-12
225
+ ## 2.0b40 on 2026-03-12
204
226
 
205
227
  - c-backend: use monotonic instead of realtime clock which has a better precision
206
228
  - java-backend: fix previously untested `--jsonschema-benchmark` implementation
207
229
 
208
- ## 2.0b39 2026-03-10
230
+ ## 2.0b39 on 2026-03-10
209
231
 
210
232
  - optim: implement any type but one constrained optimization (jsu)
211
233
  - ir: fix bad elimination when bool var was used
212
234
  - ir: add bool var assign elimination on return with only one use
213
235
  - c-backend: fix long option parsing
214
236
 
215
- ## 2.0b38 2026-03-08
237
+ ## 2.0b38 on 2026-03-08
216
238
 
217
239
  - pr: publish python jmc package
218
240
  - static: add support for `.in` with constraints
@@ -221,7 +243,7 @@
221
243
  - perf: add missing warmup to C runtime for jsonschema benchmark
222
244
  - perl-backend: be resilient on missing RE2 module
223
245
 
224
- ## 2.0b37 2026-02-27
246
+ ## 2.0b37 on 2026-02-27
225
247
 
226
248
  - test: improve output determinism
227
249
  - container: allow to use `podman` instead of `docker`
@@ -247,7 +269,7 @@
247
269
  - ir: fix stupid bug in ir opts
248
270
  - tests: rerun with updated JSTS before release
249
271
 
250
- ## 2.0b36 2025-11-12
272
+ ## 2.0b36 on 2025-11-12
251
273
 
252
274
  - tests: check how clang compares to gcc (maybe a few pc better)
253
275
  - static: partition long lists of properties based on first bytes
@@ -263,7 +285,7 @@
263
285
  - model: simplify `{"": "$NONE"}`
264
286
  - ~model: avoid dead code in `mv-0f/dedup-002`~ (simple pair ok, multiple seldom useful)
265
287
 
266
- ## 2.0b35 2025-10-30
288
+ ## 2.0b35 on 2025-10-30
267
289
 
268
290
  - static: order must/may props by increasing size
269
291
  - command: fix bad mmo threshold initializations
@@ -277,7 +299,7 @@
277
299
  - pr: move out schema-to-model conversion
278
300
  - pr: adjust radar display to visible datasets
279
301
 
280
- ## 2.0b34 2025-10-27
302
+ ## 2.0b34 on 2025-10-27
281
303
 
282
304
  - static: improve likely hints depending on expectations
283
305
  - backend: fix `TRUE AND` in `mv-07/json-schema-draft-tight.sql` (late)
@@ -287,18 +309,18 @@
287
309
  - command: rename `--unroll-may-…` options for `--may-must-open-threshold`
288
310
  - command: set optimization parameters depending on target language
289
311
 
290
- ## 2.0b33 2025-10-24
312
+ ## 2.0b33 on 2025-10-24
291
313
 
292
314
  - c-backend: try with `clang` instead of `gcc`
293
315
 
294
- ## 2.0b32 2025-10-22
316
+ ## 2.0b32 on 2025-10-22
295
317
 
296
318
  - backend: optimize length-based non-empty string check
297
319
  - backend: remove reporting expressions under no reporting
298
320
  - backend: nullify reporting parameters under no reporting
299
321
  - command: silent more cc warnings
300
322
 
301
- ## 2.0b31 2025-10-22
323
+ ## 2.0b31 on 2025-10-22
302
324
 
303
325
  - pr: improve radar chart responsiveness and sorting
304
326
  - backend: remove intermediate variable on return
@@ -323,7 +345,7 @@
323
345
  - c-backend: cleanup duplicated `json_is_boolean` calls
324
346
  - c-backend: fix bad constant string expression syntax
325
347
 
326
- ## 2.0b30 2025-10-18
348
+ ## 2.0b30 on 2025-10-18
327
349
 
328
350
  - pr: improve bench page
329
351
  - command: set default to compile on `-F language` instead of model preprocessing
@@ -333,14 +355,14 @@
333
355
  - static: remove unexpected `$ANY` messages (irep dead code elimination)
334
356
  - pr: add new artifact (2025101808)
335
357
 
336
- ## 2.0b29 2025-10-17
358
+ ## 2.0b29 on 2025-10-17
337
359
 
338
360
  - pr: add a benchmarking performance artifact page
339
361
  - backend: shamefully ignore bad json due to strange prop names
340
362
  - static: fix disjunct analysis issue
341
363
  - optim: fix infinite loop between xor-to-or and partial eval
342
364
 
343
- ## 2.0b28 2025-10-11
365
+ ## 2.0b28 on 2025-10-11
344
366
 
345
367
  - static: skip map target functions for objects
346
368
  - static: skip map target functions for references
@@ -351,7 +373,7 @@
351
373
  - optim: more xor/not/or simplifications
352
374
  - optim: xor-to-or model difference based on not exclusion, possibly behind refs
353
375
 
354
- ## 2.0b27 2025-10-07
376
+ ## 2.0b27 on 2025-10-07
355
377
 
356
378
  - perf: ensure properly aligned data in box report
357
379
  - perf: allow to collect data over several runs
@@ -364,7 +386,7 @@
364
386
  - optim: get rid of double object with C, Python and Java
365
387
  - backend: ~do not generate intermediate empty functions for direct objects? (skip)~
366
388
 
367
- ## 2.0b26 2025-10-04
389
+ ## 2.0b26 on 2025-10-04
368
390
 
369
391
  - perf: add jsb version to final summary
370
392
  - command: add `--no-predef` option for testing
@@ -373,13 +395,13 @@
373
395
  - docker: environment control for perf tests
374
396
  - command: `jmc -C -o foo.json` generates python instead of json
375
397
 
376
- ## 2.0b25 2025-10-02
398
+ ## 2.0b25 on 2025-10-02
377
399
 
378
400
  - models: write model for json IR
379
401
  - static: fix value path in some object variants
380
402
  - static: add a max threshold/ratio for may property unrolling
381
403
 
382
- ## 2.0b24 2025-09-27
404
+ ## 2.0b24 on 2025-09-27
383
405
 
384
406
  - backend: intermediate represention json code generation
385
407
  - backend: optimize some output patterns on IR
@@ -392,7 +414,7 @@
392
414
  - backend: apply skip functions also for all pmap/cmap/cc through IR
393
415
  - optim: direct mandatory-only attributes objects with expected count checked ahead
394
416
 
395
- ## 2.0b23 2025-09-21
417
+ ## 2.0b23 on 2025-09-21
396
418
 
397
419
  - artifact: add test case stats
398
420
  - static: detect discriminators from references
@@ -401,7 +423,7 @@
401
423
  - docker: generate image for current branch
402
424
  - artifact: improve docker image tagging
403
425
 
404
- ## 2.0b22 2025-09-19
426
+ ## 2.0b22 on 2025-09-19
405
427
 
406
428
  - static: detect discriminator on object part of or/xor
407
429
  - static: accept discriminator with a list of constants
@@ -414,57 +436,57 @@
414
436
  - tests: cleanup current status, back to 100\%
415
437
  - pr: update tuto scripts to match current status
416
438
 
417
- ## 2.0b20 2025-09-14
439
+ ## 2.0b20 on 2025-09-14
418
440
 
419
441
  - artifact: reduce task granularity
420
442
  - artifact: add bench docker image base on docker-cli
421
443
  - java-backend: update dependency versions
422
444
 
423
- ## 2.0b19 2025-09-13
445
+ ## 2.0b19 on 2025-09-13
424
446
 
425
447
  - docker: add subdirs to java classpath
426
448
 
427
- ## 2.0b18 2025-09-11
449
+ ## 2.0b18 on 2025-09-11
428
450
 
429
451
  - static: optimize function mapping by skipping intermediate functions if possible
430
452
 
431
- ## 2.0b16 2025-09-09
453
+ ## 2.0b16 on 2025-09-09
432
454
 
433
455
  - model: filter out all comments from transformations
434
456
  - c-backend: improve overhead estimation accuracy
435
457
 
436
- ## 2.0b15 2025-09-08
458
+ ## 2.0b15 on 2025-09-08
437
459
 
438
460
  - pl-backend: work around reference issues
439
461
  - command: add `--schema-version` to force schema version output
440
462
  - pr: remove _wip_ cover page from web site
441
463
 
442
- ## 2.0b13 2025-09-06
464
+ ## 2.0b13 on 2025-09-06
443
465
 
444
466
  - pr: improve tuto docker launch
445
467
  - pl-backend: add function declarations, needed for some recursions
446
468
 
447
- ## 2.0b12 2025-09-02
469
+ ## 2.0b12 on 2025-09-02
448
470
 
449
471
  - js-frontend: do several iterations to measure the loop overhead
450
472
  - python: fix venv installation issue with `pl/JSON` directory
451
473
 
452
- ## 2.0b11 2025-08-30
474
+ ## 2.0b11 on 2025-08-30
453
475
 
454
476
  - py-frontend: fix line numbering for jsonl
455
477
 
456
- ## 2.0b10 2025-08-30
478
+ ## 2.0b10 on 2025-08-30
457
479
 
458
480
  - java-frontend: improve check interface and calls
459
481
  - js-frontend: fix line numbering for jsonl
460
482
 
461
- ## 2.0b9 2025-08-29
483
+ ## 2.0b9 on 2025-08-29
462
484
 
463
485
  - c-backend: add inlining and branch hints
464
486
  - c-frontend: fix --version display
465
487
  - py-frontend: fix line display for jsonl and test vectors
466
488
 
467
- ## 2.0b7 2025-08-28
489
+ ## 2.0b7 on 2025-08-28
468
490
 
469
491
  - pl-backend: fix utf8 JSON handling `mv-21/pJSON`
470
492
  - pr: docker tuto script fix pull
@@ -17,6 +17,7 @@ _ESC_TABLE = {
17
17
  # must be consistent with "predef"
18
18
  CLANG_RUNTIME_PREDEFS: dict[str, str] = {
19
19
  "$URL": "jm_is_valid_url",
20
+ "$URL_REL": "jm_is_valid_url_rel",
20
21
  "$URI": "jm_is_valid_url",
21
22
  "$DATE": "jm_is_valid_date",
22
23
  "$TIME": "jm_is_valid_time",
@@ -403,14 +404,17 @@ class CLangJansson(Language):
403
404
  expr = super().predef(val, name, path, is_str or check_str, True)
404
405
  return self.and_op(self.is_a(var, str), expr) if check_str and not is_str else expr
405
406
 
406
- def value(self, var: Var, tvar: type) -> Expr:
407
+ def value(self, var: Var, tvar: type, loose: bool = False) -> Expr:
407
408
  """Known type value extraction."""
408
409
  if tvar is type(None):
409
410
  return "NULL"
410
411
  elif tvar is bool:
411
412
  return f"json_boolean_value({var})"
412
413
  elif tvar is int:
413
- return f"json_integer_value({var})"
414
+ if loose:
415
+ return f"jm_json_loose_integer_value({var})"
416
+ else:
417
+ return f"json_integer_value({var})"
414
418
  elif tvar is float:
415
419
  return f"json_real_value({var})"
416
420
  elif tvar is Number: # NOTE this cast from int if necessary
@@ -38,6 +38,7 @@ PREDEF_FORMATS = {
38
38
  "$UUID": "uuid",
39
39
  "$URL": "uri",
40
40
  "$URI": "uri",
41
+ "$URL_REL": "uri-reference", # ???
41
42
  "$IP4": "ipv4",
42
43
  "$IP6": "ipv6",
43
44
  "$HOST": "hostname",
@@ -0,0 +1 @@
1
+ 2.0.52
@@ -1221,8 +1221,8 @@ class IRep(Language):
1221
1221
  def predef(self, var: Var, name: str, path: Var, is_str: bool = False, is_val: bool = False) -> BoolExpr:
1222
1222
  return _j("pre", var=_l(var), name=name, path=_l(path), is_str=is_str, is_val=is_val)
1223
1223
 
1224
- def value(self, var: Var, tvar: type) -> Expr:
1225
- return _j("val", var=_l(var), tvar=_t2s(tvar))
1224
+ def value(self, var: Var, tvar: type, loose: bool = False) -> Expr:
1225
+ return _j("val", var=_l(var), tvar=_t2s(tvar), loose=loose)
1226
1226
 
1227
1227
  def get_value(self, var: str, tvar: type) -> Expr:
1228
1228
  return _j("gv", var=var, tvar=_t2s(tvar))
@@ -1527,7 +1527,7 @@ def _eval(jv: Jsonable, gen: Language) -> Block|Expr:
1527
1527
  case "pre": return gen.predef(
1528
1528
  var=ev("var"), name=jv["name"], path=ev("path"), is_str=jv["is_str"], is_val=jv["is_val"]
1529
1529
  )
1530
- case "val": return gen.value(var=ev("var"), tvar=_s2t(jv["tvar"]))
1530
+ case "val": return gen.value(var=ev("var"), tvar=_s2t(jv["tvar"]), loose=jv["loose"])
1531
1531
  case "gv": return gen.get_value(var=jv["var"], tvar=_s2t(jv["tvar"]))
1532
1532
  case "aiv": return gen.arr_item_val(arr=ev("arr"), idx=ev("idx"))
1533
1533
  case "opv": return gen.obj_prop_val(obj=ev("obj"), prop=jv["prop"], is_var=jv["is_var"])