json-model-compiler 2.0.63__tar.gz → 2.0.65__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.63 → json_model_compiler-2.0.65}/BACKLOG.md +1 -16
  2. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/BENCH.md +13 -3
  3. {json_model_compiler-2.0.63/json_model_compiler.egg-info → json_model_compiler-2.0.65}/PKG-INFO +1 -1
  4. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/SPEC.md +121 -64
  5. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/VERSION.md +37 -0
  6. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/about.sh +1 -1
  7. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/bench.sh +19 -10
  8. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/analyze.py +8 -1
  9. json_model_compiler-2.0.65/json_model/data/VERSION +1 -0
  10. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/model.py +232 -46
  11. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/recurse.py +7 -2
  12. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65/json_model_compiler.egg-info}/PKG-INFO +1 -1
  13. json_model_compiler-2.0.63/json_model/data/VERSION +0 -1
  14. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/.github/workflows/docs.yml +0 -0
  15. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/.github/workflows/sanity.yml +0 -0
  16. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/.gitignore +0 -0
  17. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/.gitmodules +0 -0
  18. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/API.md +0 -0
  19. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/COMP.md +0 -0
  20. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/DESIGN.md +0 -0
  21. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/DEV.md +0 -0
  22. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/DOC.md +0 -0
  23. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/HOWTO.md +0 -0
  24. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/INTEGRATION.md +0 -0
  25. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/MANIFEST.in +0 -0
  26. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/Makefile +0 -0
  27. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/PUBS.md +0 -0
  28. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/README.md +0 -0
  29. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/TUTO.md +0 -0
  30. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/README.md +0 -0
  31. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/__init__.py +0 -0
  32. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/clang.py +0 -0
  33. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/convert.py +0 -0
  34. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/clang_entry.c +0 -0
  35. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/clang_free.c +0 -0
  36. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/clang_init.c +0 -0
  37. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/clang_pcre2_fun.c +0 -0
  38. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/clang_re2_fun.c +0 -0
  39. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/java_free.java +0 -0
  40. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/java_init.java +0 -0
  41. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/javascript_exe.js +0 -0
  42. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/javascript_foot.js +0 -0
  43. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/javascript_free.js +0 -0
  44. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/javascript_head.js +0 -0
  45. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/javascript_init.js +0 -0
  46. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/javascript_main.js +0 -0
  47. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/jmc.pod +0 -0
  48. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/perl_entry.pl +0 -0
  49. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/perl_exe.pl +0 -0
  50. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/perl_free.pl +0 -0
  51. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/perl_init.pl +0 -0
  52. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/perl_main.pl +0 -0
  53. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/perl_pkg.pl +0 -0
  54. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/plpgsql_entry.sql +0 -0
  55. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/python_entry.py +0 -0
  56. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/python_exe.py +0 -0
  57. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/python_free.py +0 -0
  58. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/python_init.py +0 -0
  59. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/data/python_main.py +0 -0
  60. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/export.py +0 -0
  61. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/irep.py +0 -0
  62. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/iroptim.py +0 -0
  63. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/java.py +0 -0
  64. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/javascript.py +0 -0
  65. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/language.py +0 -0
  66. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/mtypes.py +0 -0
  67. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/objops.py +0 -0
  68. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/optim.py +0 -0
  69. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/perl.py +0 -0
  70. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/plpgsql.py +0 -0
  71. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/predefs.py +0 -0
  72. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/python.py +0 -0
  73. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/regex.py +0 -0
  74. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/resolver.py +0 -0
  75. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/Makefile +0 -0
  76. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/__init__.py +0 -0
  77. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/c/Makefile +0 -0
  78. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/c/json-model.c +0 -0
  79. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/c/json-model.h +0 -0
  80. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/c/main.c +0 -0
  81. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/.gitignore +0 -0
  82. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/Makefile +0 -0
  83. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/README.md +0 -0
  84. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/env.sh +0 -0
  85. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/json_model/Checker.java +0 -0
  86. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/json_model/GSON.java +0 -0
  87. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/json_model/JSON.java +0 -0
  88. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/json_model/JSONP.java +0 -0
  89. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/json_model/Jackson.java +0 -0
  90. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/json_model/Main.java +0 -0
  91. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/json_model/ModelChecker.java +0 -0
  92. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/json_model/Path.java +0 -0
  93. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/json_model/Report.java +0 -0
  94. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/json_model/Runtime.java +0 -0
  95. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/java/pom.xml +0 -0
  96. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/js/README.md +0 -0
  97. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/js/index.js +0 -0
  98. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/js/main.js +0 -0
  99. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/js/package.json +0 -0
  100. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/pl/.gitignore +0 -0
  101. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/pl/Changes +0 -0
  102. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/pl/LICENSE +0 -0
  103. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/pl/MANIFEST +0 -0
  104. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/pl/Makefile.PL +0 -0
  105. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/pl/README +0 -0
  106. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/pl/env.sh +0 -0
  107. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/pl/ignore.txt +0 -0
  108. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/pl/lib/JSON/JsonModel.pm +0 -0
  109. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/pl/t/00-load.t +0 -0
  110. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/pl/t/manifest.t +0 -0
  111. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/pl/t/pod-coverage.t +0 -0
  112. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/pl/t/pod.t +0 -0
  113. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/pl/xt/boilerplate.t +0 -0
  114. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/sql/META.json +0 -0
  115. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/sql/Makefile +0 -0
  116. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/sql/json_model--2.0.sql +0 -0
  117. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/sql/json_model.control +0 -0
  118. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/support.py +0 -0
  119. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/runtime/types.py +0 -0
  120. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/script.py +0 -0
  121. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/submodel.py +0 -0
  122. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/ts_export.py +0 -0
  123. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/url_cache.py +0 -0
  124. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/utils.py +0 -0
  125. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model/xstatic.py +0 -0
  126. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model_compiler.egg-info/SOURCES.txt +0 -0
  127. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model_compiler.egg-info/dependency_links.txt +0 -0
  128. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model_compiler.egg-info/entry_points.txt +0 -0
  129. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model_compiler.egg-info/not-zip-safe +0 -0
  130. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model_compiler.egg-info/requires.txt +0 -0
  131. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/json_model_compiler.egg-info/top_level.txt +0 -0
  132. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/package.json +0 -0
  133. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/pyproject.toml +0 -0
  134. {json_model_compiler-2.0.63 → json_model_compiler-2.0.65}/setup.cfg +0 -0
@@ -3,8 +3,6 @@
3
3
  ## Current Tasks
4
4
 
5
5
  - [ ] java-runtime: consider automatic updates?
6
- - [ ] bench: re-build corvus image automatically
7
- - [ ] bench: run cron bench with corvus (wip)
8
6
  - [ ] pr: improve compiler page, list and describe optimizations?
9
7
  - [ ] bench: better count should ignore bads
10
8
  - [ ] bench: handle case failures for radar (wip, ajv handling)
@@ -24,7 +22,6 @@
24
22
  - [ ] front: generate valid minimal, maximal and random values from a model
25
23
  - [ ] front: generate invalid minimal values from a model
26
24
  - [ ] optim: collect and display stats about what works
27
- - [ ] spec: allow to _remove_ definitions, eg `{ "$stuff": {"/": "$foo"}}`
28
25
  - [ ] spec: restrict regex syntax to a smaller subset
29
26
  - [ ] perf: drop and/or merge identical results when comparing
30
27
  - [ ] backend: check `mv-34/mu` test case which may require some utf normalization
@@ -52,7 +49,6 @@
52
49
  - [ ] predefs: _url_ vs _uri_ vs _iri_
53
50
  - [ ] predefs: improve `$URI` and `$URL`
54
51
  - [ ] predefs: add `$SIMPLE_REGEX` for regex syntax subset?
55
- - [ ] docker: enable user remap
56
52
  - [ ] export: java classes
57
53
  - [ ] export: go interfaces
58
54
  - [ ] export: ts interfaces
@@ -113,19 +109,8 @@
113
109
  - [ ] predefs: add country codes, eg `$COUNTRY $COUNTRY2 $COUNTRY3 $COUNTRYN`
114
110
  - [ ] spec: be precise about predefs standard references, eg `$DATE` and co.
115
111
 
116
- ## Internship
112
+ ## Internship Ideas
117
113
 
118
- - [x] pr: read www, papers, spec… setup dev env, report issues
119
- - [x] pr: try tutorial, report issues and suggest improvements
120
- - [x] tests: add a few tests for jsonrpc model
121
- - [x] model: write a model for MCP
122
- - [x] tests: add a few tests for MCP model
123
- - [x] export: generate ts interfaces
124
- - [x] model: fix IR model and tests
125
- - [x] front: IR re-entrance
126
- - [ ] tests: generate valid (pseudo-random) values
127
- - [ ] tests: generate invalid minimal, maximal, pseudo-random values
128
- - [ ] tests: generate invalid values on each constraint
129
114
  - [ ] backend: C and runtime with json-c (\*, but beware of runtime integration)
130
115
  - [ ] backend: C# (\*\*)
131
116
  - [ ] backend: go (\*\*\*)
@@ -60,14 +60,16 @@ differences in the validated results, in which case they are manually
60
60
  validated and discussed.
61
61
 
62
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.
63
+ an average and standard deviation.
64
+ The repetition also intends to catch hidden costs such as JIT compilation, GC runs and
65
+ lazy initializations, amortized over the loop and tests, typically _1,000,000_ validations
66
+ for a _1000_ iteration loop over _1000_ test values.
65
67
  - Several independent runs are performed to reduce host load effects.
66
68
  - Compilation times and performance times are the _median_ encountered over the runs.
67
69
  - Runs are usually performed in _fast_ mode: the rejection reasons are not collected,
68
70
  and the run stops as soon as possible.
69
71
  - 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).
72
+ collected performances (from 10 ns to over 300 µs for validating one test value).
71
73
 
72
74
  Note that performance figures **must** be taken with a pinch of salt, please consider
73
75
  the following caveats, and others:
@@ -84,6 +86,14 @@ the following caveats, and others:
84
86
  so it is often disabled.
85
87
  - The measure overhead is estimated and deduced from the performance figures by default,
86
88
  which leads to potentially fuzzy results when testing very small values.
89
+ - Parsing is not taken into account:
90
+ From a user perspective, the combined time for parsing or building, checking, and
91
+ using or serializing makes more sense.
92
+ From our tool perspective, it is built around external representations, and
93
+ aims at being _inserted_ into existing code, without changing the underlying
94
+ JSON libraries, so the validation is the only new overhead to consider.
95
+ For other tools which force using their own representation (eg Blaze or Corvus C#)
96
+ and may imply conversion costs, an end-to-end measure seems more appropriate.
87
97
  - Compilers, libraries and other design and updates can have dramatic effects:
88
98
  for faster parsing, a library may use linked-list for properties, which means
89
99
  that retrieving a given property value will cost more than a library which uses
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_model_compiler
3
- Version: 2.0.63
3
+ Version: 2.0.65
4
4
  Summary: JSON Model Tools
5
5
  Author: Fabien Coelho, Claire Yannou-Medrala
6
6
  License-Expression: CC0-1.0
@@ -146,7 +146,7 @@ for all possible values for that type.
146
146
  - `"$IP6"`: an ipv6, eg _0::0_
147
147
  - `"$ETH"`: an ethernet (mac) address, eg _De:ad:Be:ef:01:23_
148
148
  - `"$CARD"`: a credit card number with a Luhn checksum, eg _1234567890123452_
149
- - `"$JSONPT"`: an RFC6901 json pointer, eg _/http:~1~1json-model.org_
149
+ - `"$JSONPT"`: an RFC6901 json pointer, eg _/http:\~1\~1json-model.org_
150
150
  - `"$TIMETZ"`: time with timezone
151
151
  - `"$SEMVER"`: semantic versioning 2.0
152
152
 
@@ -458,90 +458,147 @@ A reference is a string which begins with the `$` character.
458
458
 
459
459
  Implementation should detect external reference cycles which are errors and should be rejected.
460
460
 
461
- ## (EXPERIMENTAL) Model Transformations
461
+ ## (EXPERIMENTAL) Type Edition (aka Model Transformations)
462
462
 
463
- Symbol `%` at the root of the model defines a model transformation object, which
463
+ Type edition allows to transform models by editing nodes inside a model.
464
+ It comes in two forms:
465
+
466
+ 1. Global Type Edition with special keyword `%` at the root of the model.
467
+ 2. Local Type Edition within `$`-definitions.
468
+
469
+ The are executed when the model is loaded, as an initial syntactic step,
470
+ before any interpretation of the model beside considering its definitions `$`
471
+ and editions `%`.
472
+
473
+ ### Global Type Editions
474
+
475
+ Symbol `%` at the root of the model defines a global type edition object, which
464
476
  may include symbol renamings, model importations and model editions.
477
+ Inside the type edition objects, `#...` properties are comments to be ignored.
478
+ Other allowed properties are imports (`<`) and references (`$...`).
479
+ Any other property is an error.
465
480
 
466
- - **Symbol Names**
481
+ - **Importation**
467
482
 
468
- Within the `%` object at the root, properties beginning with a `.` introduce new symbol names.
469
- The value is the symbol string which is replaced, in `# ~ $ % @ = != <= < >= > ! | ^ & + / *`.
470
- For instance:
483
+ Special property `<` inside a edition object expects a reference to an external model,
484
+ or a list of such references, and imports all **definitions** of the targets into the
485
+ local scope, as local **definitions**.
471
486
 
472
- ```json
473
- {
474
- "%": { ".com": "#", ".or": "|", ".merge": "+" }
475
- }
476
- ```
487
+ While importing, homonymous definitions are invalid and must be rejected.
477
488
 
478
- Declares property substitutions, which translate this model:
489
+ - **Model Removal, Addition and Edition**
479
490
 
480
- ```json
481
- { ".merge": [ {"a": 0}, {".or": [ {"b": 0}, {"c": 0} ] } ] }
482
- ```
491
+ Model editions are specified with properties which are references (`$...`) possibly followed
492
+ by a JSON path, allowing to point to a JSON element in the model, and either a value
493
+ with special properties `/ *` to remove or add sub elements, `:` to rename properties.
494
+ Anything else taken as-is, but which must not be an object with any of the special properties.
483
495
 
484
- Into:
496
+ - If the reference ends with `#`, it designates the model _definitions_ on which the
497
+ editions are performed. The reference object must be a root model, eg imported with
498
+ a URL (`{ "model": "$https://json-model/models/json-model" }`). `$#` is a reference
499
+ to a model's own definitions. A reference may designate an indirectly imported model,
500
+ eg `$openapi#schema#` where `schema` is a definition inside `openapi`.
501
+ If the referenced object does not exist, this is an error.
485
502
 
486
- ```json
487
- { "+": [ {"a": 0}, {"|": [ {"b": 0}, {"c": 0} ] } ] }
488
- ```
503
+ The target value may contains any of `/ * ~` properties, this is a type edition object,
504
+ which is interpreted as follow, in this order, when they exist:
489
505
 
490
- These substitutions can be carried out by a separate preprocessor which generates
491
- the resulting standard model without any renamed symbol.
506
+ `/` must be a string or list of strings, the corresponding definitions must exist and
507
+ are removed.
492
508
 
493
- When declaring the model meta-model with `"~"` at the root, any renaming section specified
494
- in the meta-model **must** be applied to the current model before further processing.
495
- This feature allow the localization of the model syntax.
509
+ `*` is a object containing new definitions to be added to the name space. If
510
+ the name already exists, this is an error.
496
511
 
497
- - **Importation**
512
+ `~` is a string-to-string map to rename definitions, which the source must exist
513
+ and the target must not.
514
+ The renaming occurs simultaneously, i.e. `{"a": "b", "b": "a"}` inverts `a`
515
+ and `b` values and is allowed.
498
516
 
499
- Special property `"<"` inside a transformation object expects a reference to an external
500
- model, or a list of such references, and imports all definitions of the targets into the
501
- local scope.
517
+ The target object may also include comments (`# ...` properties) which are ignored.
518
+ It cannot include anything else.
502
519
 
503
- While importing, homonymous definitions are invalid and must be rejected.
520
+ - If the reference does **not** end with a `#`, this is interpreted as a `$` reference
521
+ possibly followed by a simple `.`-separated JSON Path: `$Foo.?bla` is definition `Foo`
522
+ and within this definition property `?bla`. As expected, `$.foo` refer to property
523
+ `foo` at the root of the model itself.
504
524
 
505
- - **Model Addition and Edition**
525
+ - If the reference is a name without a path, it designates a definition.
506
526
 
507
- Model editions are specified with properties which are references possibly followed
508
- by a JSON path, allowing to point to a JSON element in the model, and either a value
509
- with special properties `/ *` to remove or add sub elements, or anything else
510
- taken as-is, but which must not be an object with any of the special properties.
511
-
512
- - Addition/replacement on a `"$External#name"` reference to a definition:
513
- - a non-existing definition is added to available definitions _in the target scope_.
514
- - an existing definition is replaced _in the target scope_.
515
- - Edition on a `"$External#name.foo.0"`: the target element **must** exist.
516
- The `.foo.0` path instructs to select the first element (index _0_) of
517
- the array value of property _foo_ inside definition _name_.
518
-
519
- The following edition rules apply, in order, depending on the type of the target element:
520
-
521
- - if the transformation value is an edition object (ie include at least one `/ *` property):
522
- - if the target is a JSON object (not necessarily a model for an object):
523
- - `/` value may be a string or a list of strings.
524
- All properties of these names are removed.
525
- If a property does not exist, this is an error and must be rejected.
526
- - `*` value must be a object, which is merged into the target object.
527
- If a property already exists, this is an error and must be rejected.
528
- - if the target is a JSON array (not necessarily a model for an array):
529
- - `/`: may be value or a list of values.
530
- Array items equal to these values are removed.
531
- If a value is not found, this is an error and must be rejected.
532
- - `*`: if the value is an array, append its items to the target array.
533
- if the value is something else, appends this to the array.
534
- - if the target is a JSON scalar: this is an error and must be rejected.
535
- - if the transformation value is a model (i.e. an object without any `/ *` property),
536
- the target value is _replaced_ by this value, in place.
537
-
538
- These additions and editions are performed _after_ property renamings and imports,
539
- and _before_ merge pre-processing.
527
+ If the definition does not exist, it is created and the value is associated
528
+ to the definition, which may be a model **or** a local type edition.
529
+
530
+ - If the definition exists, or if the reference is a name with an existing path:
531
+
532
+ - If the target value is an object which contains any of contains `/ * ~` properties
533
+ and possibly some comments, this is an edition, interpreted as follow:
534
+
535
+ `/` is a scalar or list of stuff and the referenced model is an array,
536
+ the values are removed from the array; if it is an object, the scalar or stuffs
537
+ must be strings, and the corresponding properties are removed. Other cases are errors.
538
+
539
+ `*` interpretation is also type dependent:
540
+ If a scalar and the target a list, the item must exist and is removed;
541
+ If a list of stuff and the target a list, the items must exist and are removed;
542
+ If a list of strings and the target is an objects, keep only those properties;
543
+ If an object and the target an object, both objects are merged,
544
+ with property collisions considered as errors.
545
+ All other cases are errors.
546
+
547
+ `~` is a string-to-string map, the target must be an object, the sources
548
+ must exist as properties and are renamed to the target, which must not exist.
549
+ The renaming occurs simultaneously, i.e. `{"a": "b", "b": "a"}` inverts `a`
550
+ and `b` value and is allowed.
551
+
552
+ - Otherwise the target is assumed to be a model and replaces initial definition
553
+ or value at the path.
554
+
555
+ - If the reference is a name with a non existing path, this is an error.
556
+
557
+ ### Local Type Editions
558
+
559
+ Symbols `<`, `/`, `*`, `~` inside a _definition_ constitute a local type edition.
560
+
561
+ - `<` must be a simple local reference `$name`, the target model is **copied** inside the definition.
562
+ - `/`, `*` and `~` define local editions inside the definition, as describe above.
540
563
 
541
564
  What is the _right_ balance between features, syntax and ease-of-use for a type transformation
542
565
  language is an on-going investigation: should it allow renaming, moving or copying attributes?
543
566
  Should it allow to remove definitions? Should imports allow to define a namespace?
544
567
 
568
+ Local editions are executed _after_ global editions, which may add new definitions with
569
+ such local editions.
570
+
571
+ ## (EXPERIMENTAL) Symbol Names
572
+
573
+ Within the `%` object at the root, properties beginning with a `.` introduce new symbol names.
574
+ The value is the symbol string which is replaced, in `# ~ $ % @ = != <= < >= > ! | ^ & + / *`.
575
+ For instance:
576
+
577
+ ```json
578
+ {
579
+ "%": { ".com": "#", ".or": "|", ".merge": "+" }
580
+ }
581
+ ```
582
+
583
+ Declares property substitutions, which translate this model:
584
+
585
+ ```json
586
+ { ".merge": [ {"a": 0}, {".or": [ {"b": 0}, {"c": 0} ] } ] }
587
+ ```
588
+
589
+ Into:
590
+
591
+ ```json
592
+ { "+": [ {"a": 0}, {"|": [ {"b": 0}, {"c": 0} ] } ] }
593
+ ```
594
+
595
+ These substitutions can be carried out by a separate preprocessor which generates
596
+ the resulting standard model without any renamed symbol.
597
+
598
+ When declaring the model meta-model with `"~"` at the root, any renaming section specified
599
+ in the meta-model **must** be applied to the current model before further processing.
600
+ This feature allow the localization of the model syntax.
601
+
545
602
  ## Static Typing Lattice
546
603
 
547
604
  In the above specification, there are several requirements for having _one_ known type
@@ -1,5 +1,42 @@
1
1
  # JSON Model Compiler Versions
2
2
 
3
+ ## 2.0.65 on 2026-11-01
4
+
5
+ - models: json schema drafts as a diff (4, 6, 7, 8, 9)
6
+ - tests: also check json schema diff versions
7
+ - tests: add more trafo tests
8
+ - tests: update trafo support in model schema used by some tests
9
+ - models: add for openapi overlay spec
10
+ - models: add json patch spec (RFC6902) and tests
11
+ - model: allow comments in trafo
12
+ - model: fix missing resolver forwarding
13
+ - pr: rewrite trafo spec
14
+ - tests: add sanity assertion about xdist parallel pytest runs
15
+
16
+ ## 2.0.64 on 2026-10-26
17
+
18
+ - bench: do not link same version and message artifacts, keep first encountered
19
+ - bench: move corvus at then end of the radar to keep colors consistent
20
+ - bench: run cron bench with corvus
21
+ - bench: re-build corvus image automatically
22
+ - model: transformation rename properties with `~` (experimental)
23
+ - model: transformation make work on import? checked!
24
+ - model: allow to edit definitions (namespace `$foo#`) with transformations
25
+ - models: add `:` trafo to json model meta model
26
+ - models: add diff model from v1 to v2
27
+ - bench: work around cal dns issues
28
+ - bench: fix missing jmc on cron job
29
+ - bench: improve report section title about classification metrics
30
+ - docker: enable user remap (for a long time?)
31
+ - models: add OpenAPI-with-models alternative model
32
+ - model: fix definition cross renames
33
+ - model: add local transformations
34
+ - model: add keep-only transformation
35
+ - model: allow bulk mandatory to optional and optional to mandatory renames
36
+ - model: fix model internals when adding definitions with a namespace trafo
37
+ - models: add json schema draft 03 diff model
38
+ - model: move local transformations _after_ global transformations
39
+
3
40
  ## 2.0.63 on 2026-10-05
4
41
 
5
42
  - pr: center logo in sidebar
@@ -158,7 +158,7 @@ on a set of test vectors.
158
158
  - Number of test vector JSON values: _${n_values}_
159
159
  - All tested JSON values (including models, generated schemas and IR, and test suite schemas): _${all_values}_
160
160
 
161
- Over _170,000_ assertion checks are performed when running non-regression tests:
161
+ Over _180,000_ assertion checks are performed when running non-regression tests:
162
162
  generated files, values validated in various languages…
163
163
 
164
164
  [Example models](https://json-model.org/MODELS) cover typical use cases and demonstrate
@@ -20,29 +20,38 @@ get_version()
20
20
  sed -ne '1,/BENCHES/p' < BENCH.md | grep -v '^BENCHES$'
21
21
 
22
22
  # list max 10 latest artifacts
23
- nartifacts=0
23
+ nartifacts=0 p_jsu= p_jmc= p_sbc= p_crv= p_msg=
24
24
 
25
25
  for artifact in $(ls site/benchmarks/*.md | sort -r) ; do
26
- let nartifacts+=1
27
26
 
28
- link=${artifact#site/}
29
- name=${link#benchmarks/}
30
- name=${name%.md}
31
27
  jsu=$(get_version jsu $artifact)
32
28
  jmc=$(get_version jmc $artifact)
33
29
  sbc=$(get_version jsonschema-cli $artifact)
34
30
  crv=$(get_version corvus-cli $artifact)
35
- message=""
36
- [ "$(grep 'content:.*yes' $artifact)" ] && message+="content" || message+="no content"
37
- [ "$(grep 'JSU_OPT.*--no-id' $artifact)" ] && message+=", no id" || message+=", id"
38
- [ "$(grep 'fix:.*yes' $artifact)" ] && message+=", fix" || message+=", no fix"
31
+
32
+ msg=""
33
+ [ "$(grep 'content:.*yes' $artifact)" ] && msg+="content" || msg+="no content"
34
+ [ "$(grep 'JSU_OPT.*--no-id' $artifact)" ] && msg+=", no id" || msg+=", id"
35
+ [ "$(grep 'fix:.*yes' $artifact)" ] && msg+=", fix" || msg+=", no fix"
36
+
37
+ # skip same version (details may differ, keep first encountered)
38
+ [ "$jsu" = "$p_jsu" -a "$jmc" = "$p_jmc" -a \
39
+ "$sbc" = "$p_sbc" -a "$crv" = "$p_crv" -a "$msg" = "$p_msg" ] && continue
40
+
41
+ p_jsu=$jsu p_jmc=$jmc p_sbc=$sbc p_crv=$crv p_msg=$msg
42
+
43
+ link=${artifact#site/}
44
+ name=${link#benchmarks/}
45
+ name=${name%.md}
46
+
39
47
  echo "- Artifact [$name]($link) using"
40
48
  echo " [JMC $jmc]($PYPI/json-model-compiler/$jmc/), "
41
49
  echo " [JSU $jsu]($PYPI/json-schema-utils/$jsu/), "
42
50
  [ "$sbc" ] && echo " [SBC $sbc](https://github.com/sourcemeta/jsonschema/releases/tag/v$sbc),"
43
51
  [ "$crv" ] && echo " [Corvus $crv](https://corvus-oss.org/Corvus.JsonSchema/),"
44
- echo " $message."
52
+ echo " $msg."
45
53
 
54
+ let nartifacts+=1
46
55
  [ $nartifacts -eq $MAX ] && break
47
56
  done
48
57
 
@@ -60,7 +60,7 @@ def check(jm: JsonModel, assertion: ModelFilter, what: str = "?", short: bool =
60
60
  okay = False
61
61
  return okay if short else True
62
62
 
63
- recModel(jm._model, checkFlt, noRwt, True)
63
+ recModel(jm._model, checkFlt, noRwt, True, jm._is_root)
64
64
 
65
65
  return okay
66
66
 
@@ -83,6 +83,9 @@ def valid(jm: JsonModel,
83
83
  ARR_KW = {"!"}
84
84
  OP_KW = {"@", "|", "&", "^", "+"}
85
85
 
86
+ # trafo are applied before checking model validity, thus out of scope
87
+ # TRAFO_KW = {"/", "*", "~"}
88
+
86
89
  if extend: # multiple-of: number, contains: model
87
90
  CMP_KW |= {".mo"}
88
91
  ARR_KW |= {".in"}
@@ -103,6 +106,10 @@ def valid(jm: JsonModel,
103
106
  finite = not jm._isRef(ref) or ref == "$#" # Hmmm…
104
107
  if not finite:
105
108
  log.debug(f"infinite recursion on {smodel}: {recref} ({recid})")
109
+ if jm._debug >= 3:
110
+ log.debug(f"{jm._id}: {jm._model}")
111
+ for name, j in jm._defs.items():
112
+ log.debug(f"{jm._id}: {name} -> {j._id} ({j._model})")
106
113
  return finite
107
114
 
108
115
  def validFlt(model: ModelType, path: ModelPath) -> bool:
@@ -0,0 +1 @@
1
+ 2.0.65