json-model-compiler 2.0.59__tar.gz → 2.0.60__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/.gitignore +1 -1
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/BACKLOG.md +10 -4
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/Makefile +11 -12
- {json_model_compiler-2.0.59/json_model_compiler.egg-info → json_model_compiler-2.0.60}/PKG-INFO +1 -1
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/VERSION.md +34 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/bench.sh +11 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/analyze.py +125 -86
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/clang.py +4 -4
- json_model_compiler-2.0.60/json_model/data/VERSION +1 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/irep.py +95 -8
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/javascript.py +53 -10
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/mtypes.py +6 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/optim.py +5 -5
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/c/json-model.c +62 -42
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/c/json-model.h +1 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/c/main.c +18 -4
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/script.py +10 -1
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/submodel.py +1 -1
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/utils.py +1 -1
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/xstatic.py +9 -5
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60/json_model_compiler.egg-info}/PKG-INFO +1 -1
- json_model_compiler-2.0.59/json_model/data/VERSION +0 -1
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/.github/workflows/docs.yml +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/.github/workflows/sanity.yml +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/.gitmodules +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/API.md +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/BENCH.md +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/DESIGN.md +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/DEV.md +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/DOC.md +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/HOWTO.md +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/INTEGRATION.md +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/MANIFEST.in +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/PUBS.md +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/README.md +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/SPEC.md +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/TUTO.md +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/about.sh +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/README.md +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/__init__.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/convert.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/clang_entry.c +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/clang_free.c +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/clang_init.c +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/clang_pcre2_fun.c +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/clang_re2_fun.c +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/java_free.java +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/java_init.java +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/javascript_exe.js +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/javascript_foot.js +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/javascript_free.js +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/javascript_head.js +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/javascript_init.js +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/javascript_main.js +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/jmc.pod +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/perl_entry.pl +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/perl_exe.pl +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/perl_free.pl +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/perl_init.pl +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/perl_main.pl +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/perl_pkg.pl +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/plpgsql_entry.sql +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/python_entry.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/python_exe.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/python_free.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/python_init.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/data/python_main.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/export.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/java.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/language.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/model.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/objops.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/perl.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/plpgsql.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/predefs.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/python.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/recurse.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/regex.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/resolver.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/Makefile +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/__init__.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/c/Makefile +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/.gitignore +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/Makefile +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/README.md +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/env.sh +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/json_model/Checker.java +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/json_model/GSON.java +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/json_model/JSON.java +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/json_model/JSONP.java +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/json_model/Jackson.java +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/json_model/Main.java +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/json_model/ModelChecker.java +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/json_model/Path.java +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/json_model/Report.java +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/json_model/Runtime.java +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/java/pom.xml +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/js/README.md +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/js/index.js +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/js/main.js +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/js/package.json +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/pl/.gitignore +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/pl/Changes +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/pl/LICENSE +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/pl/MANIFEST +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/pl/Makefile.PL +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/pl/README +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/pl/env.sh +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/pl/ignore.txt +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/pl/lib/JSON/JsonModel.pm +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/pl/t/00-load.t +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/pl/t/manifest.t +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/pl/t/pod-coverage.t +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/pl/t/pod.t +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/pl/xt/boilerplate.t +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/sql/META.json +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/sql/Makefile +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/sql/json_model--2.0.sql +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/sql/json_model.control +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/support.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/runtime/types.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/ts_export.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model/url_cache.py +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model_compiler.egg-info/SOURCES.txt +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model_compiler.egg-info/dependency_links.txt +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model_compiler.egg-info/entry_points.txt +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model_compiler.egg-info/not-zip-safe +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model_compiler.egg-info/requires.txt +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/json_model_compiler.egg-info/top_level.txt +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/package.json +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/pyproject.toml +0 -0
- {json_model_compiler-2.0.59 → json_model_compiler-2.0.60}/setup.cfg +0 -0
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## Current Tasks
|
|
4
4
|
|
|
5
|
+
- [ ] bench: submit `negatives.jsonl` to jsb for sanity checks
|
|
6
|
+
- [ ] bench: better count should ignore bads
|
|
7
|
+
- [ ] bench: handle case failures for radar (wip, ajv handling)
|
|
8
|
+
- [ ] bench: collect error runs?
|
|
9
|
+
- [ ] bench: add corvus reference?
|
|
10
|
+
- [ ] bench: add stddev performance computation
|
|
11
|
+
- [ ] bench: improve resilience to bad overhead estimation
|
|
12
|
+
- [ ] bench: add case names to generated radar
|
|
13
|
+
- [ ] bench: collect JSON parse times for comparison with validation times
|
|
5
14
|
- [ ] export: generate a [katydid](https://katydid.github.io/) expression, for a compatible subset
|
|
6
15
|
- [ ] pr: add _known limitations_ stuff
|
|
7
16
|
- [ ] front: merge many internal options to trigrams
|
|
8
|
-
- [ ] bench: case failures handling needs some fixing
|
|
9
17
|
- [ ] tests: check more bad urls (eg bad %-escape)
|
|
10
18
|
- [ ] tests: check pydantic generated classes
|
|
11
19
|
- [ ] static: use combined type test and value extraction when available?
|
|
@@ -22,11 +30,9 @@
|
|
|
22
30
|
- [ ] perf: drop and/or merge identical results when comparing
|
|
23
31
|
- [ ] backend: check `mv-34/mu` test case which may require some utf normalization
|
|
24
32
|
- [ ] runtime: count graphemes instead of characters? for Java, see `java.text.BreakIterator`
|
|
25
|
-
- [ ] bench: add stddev performance computation
|
|
26
|
-
- [ ] bench: improve resilience to bad overhead estimation
|
|
27
|
-
- [ ] bench: collect JSON parse times for comparison with validation times
|
|
28
33
|
- [ ] pr: better document optimizations, eg add compiler optimization page
|
|
29
34
|
- [ ] static: improve startswith pattern recognition `/^xyz.*/`
|
|
35
|
+
- [ ] js: implement cset as an or-expression
|
|
30
36
|
- [ ] c-backend: factor out str extraction in or-list in more cases
|
|
31
37
|
- [ ] c-backend: improve unique with hash using int set?
|
|
32
38
|
- [ ] c-backend: improve str hash?
|
|
@@ -67,7 +67,7 @@ clean.js:
|
|
|
67
67
|
|
|
68
68
|
.PHONY: clean.site
|
|
69
69
|
clean.site:
|
|
70
|
-
$(RM) site/
|
|
70
|
+
$(RM) site/models.json site/JMC.md site/ABOUT.md site/BENCH.md .about.md
|
|
71
71
|
$(RM) -r _site
|
|
72
72
|
|
|
73
73
|
.PHONY: clean.py
|
|
@@ -140,17 +140,16 @@ check.sanity: venv/.dev
|
|
|
140
140
|
#
|
|
141
141
|
# Docsify Web Site: https://json-model.org/
|
|
142
142
|
#
|
|
143
|
-
site/
|
|
143
|
+
site/models.json: $(wildcard models/*.model.json)
|
|
144
144
|
{
|
|
145
|
-
|
|
146
|
-
echo
|
|
147
|
-
for model in
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if [ "$$doc" = "null" ] ; then doc="" ; else doc=" – $$doc" ; fi
|
|
151
|
-
echo "- [$$title]($$model ':ignore')$$doc"
|
|
145
|
+
first=1
|
|
146
|
+
echo "["
|
|
147
|
+
for model in $^ ; do
|
|
148
|
+
[ "$$first" ] && first= || echo ","
|
|
149
|
+
jq "{title: .\"#\", doc: .\"#.doc\", model: \"$${model}\"}" $${model}
|
|
152
150
|
done
|
|
153
|
-
|
|
151
|
+
echo "]"
|
|
152
|
+
} | jq 'map(if .doc == null then del(.doc) else . end)' > $@
|
|
154
153
|
|
|
155
154
|
# pod2markdown: libpod-markdown-perl
|
|
156
155
|
site/JMC.md: json_model/data/jmc.pod
|
|
@@ -160,7 +159,7 @@ site/BENCH.md: ./bench.sh
|
|
|
160
159
|
./$< > $@
|
|
161
160
|
|
|
162
161
|
# generate twice to include the about page in the counts
|
|
163
|
-
site/ABOUT.md: ./about.sh site/JMC.md site/
|
|
162
|
+
site/ABOUT.md: ./about.sh site/JMC.md site/BENCH.md
|
|
164
163
|
./$< > $@
|
|
165
164
|
./$< > .about.md
|
|
166
165
|
mv .about.md $@
|
|
@@ -188,7 +187,7 @@ www: build.site
|
|
|
188
187
|
-include local.mk
|
|
189
188
|
|
|
190
189
|
.PHONY: build.site
|
|
191
|
-
build.site: site/
|
|
190
|
+
build.site: site/models.json site/JMC.md site/ABOUT.md site/BENCH.md
|
|
192
191
|
|
|
193
192
|
.PHONY: publish.site
|
|
194
193
|
publish.site: build.site
|
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# JSON Model Compiler Versions
|
|
2
2
|
|
|
3
|
+
## 2.0.60 on 2026-09-15
|
|
4
|
+
|
|
5
|
+
- pr: jm site added to [awesome docsify](https://github.com/docsifyjs/awesome-docsify/commit/3950ece64978f41294463e1a2b12e809c65a6379)
|
|
6
|
+
- bench: show rounded minutes run time
|
|
7
|
+
- clang: remove useless empty line from string constant set functions
|
|
8
|
+
- bench: use uc for external tools, report in italic
|
|
9
|
+
- bench: show versions of used languages, not all
|
|
10
|
+
- bench: radar data with added speed property
|
|
11
|
+
- model: improve internal doc for some example models
|
|
12
|
+
- model: simplify JSTS model with `$SEMVER`
|
|
13
|
+
- pr: generate model examples pages from json
|
|
14
|
+
- bench: add ajv cli docker and wrapper
|
|
15
|
+
- bench: add ajv external reference
|
|
16
|
+
- js: add option for more direct/simpler code
|
|
17
|
+
- js: set default to use simpler code
|
|
18
|
+
- analyze: check static typing on constrained nodes
|
|
19
|
+
- analyze: display model rejections reasons as a warning
|
|
20
|
+
- bench: handle case failures when reporting
|
|
21
|
+
- model: improve jm meta model
|
|
22
|
+
- c-backend: stricter regex check active by default
|
|
23
|
+
- bench: keep initial schema when testing
|
|
24
|
+
- jsb: patch test values to avoid border or invalid cases
|
|
25
|
+
- optim: fix type check rejections
|
|
26
|
+
- bench: various report generation fixes
|
|
27
|
+
- optim: fix partial eval over simplification (yet another bool/int issue)
|
|
28
|
+
- bench: add missing model conversion time for some tools, ensure display order
|
|
29
|
+
- bench: make cron job also check for jsb changes
|
|
30
|
+
- bench: improve summary description depending on displayed data
|
|
31
|
+
- check: model validation rejects all-caps definitions
|
|
32
|
+
- tests: improve default load balancing with `--maxschedchunk=3`
|
|
33
|
+
- pr: remove older artifacts
|
|
34
|
+
- bench: always display the result success section
|
|
35
|
+
- pr: list at most 10 latests artifacts on bench page
|
|
36
|
+
|
|
3
37
|
## 2.0.59 on 2026-08-28
|
|
4
38
|
|
|
5
39
|
- bench: fix standard cron runs
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
# generate BENCH.md page with links to available benchmarks
|
|
4
4
|
#
|
|
5
5
|
|
|
6
|
+
MAX=10
|
|
6
7
|
PYPI="https://pypi.org/project"
|
|
7
8
|
|
|
9
|
+
# extract version from file
|
|
8
10
|
get_version()
|
|
9
11
|
{
|
|
10
12
|
local what=$1 file=$2
|
|
@@ -14,9 +16,15 @@ get_version()
|
|
|
14
16
|
echo $line
|
|
15
17
|
}
|
|
16
18
|
|
|
19
|
+
# up to artifact list
|
|
17
20
|
sed -ne '1,/BENCHES/p' < BENCH.md | grep -v '^BENCHES$'
|
|
18
21
|
|
|
22
|
+
# list max 10 latest artifacts
|
|
23
|
+
nartifacts=0
|
|
24
|
+
|
|
19
25
|
for artifact in $(ls site/benchmarks/*.md | sort -r) ; do
|
|
26
|
+
let nartifacts+=1
|
|
27
|
+
|
|
20
28
|
link=${artifact#site/}
|
|
21
29
|
name=${link#benchmarks/}
|
|
22
30
|
name=${name%.md}
|
|
@@ -31,6 +39,9 @@ for artifact in $(ls site/benchmarks/*.md | sort -r) ; do
|
|
|
31
39
|
echo " [JSU $jsu]($PYPI/json-schema-utils/$jsu/) and "
|
|
32
40
|
echo " [SBC $sbc](https://github.com/sourcemeta/jsonschema/releases/tag/v$sbc), "
|
|
33
41
|
echo " $message."
|
|
42
|
+
|
|
43
|
+
[ $nartifacts -eq $MAX ] && break
|
|
34
44
|
done
|
|
35
45
|
|
|
46
|
+
# after artifact list
|
|
36
47
|
sed -ne '/BENCHES/,$p' < BENCH.md | grep -v '^BENCHES$'
|
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
#
|
|
4
4
|
import functools
|
|
5
5
|
import re
|
|
6
|
+
import json
|
|
6
7
|
|
|
7
|
-
from .mtypes import UnknownModel, ModelPath, ModelType, ModelFilter, ModelObject, ModelArray
|
|
8
|
+
from .mtypes import UnknownModel, ModelPath, ModelType, ModelFilter, ModelObject, ModelArray, NullType, TopType
|
|
8
9
|
from .utils import log, is_regex, is_a_simple_object
|
|
9
10
|
from .predefs import CONST_RE, STR_MODEL_PREDEFS, BOOL_MODEL_PREDEFS, INT_MODEL_PREDEFS, FLOAT_MODEL_PREDEFS
|
|
10
11
|
from .recurse import recModel, allFlt, noRwt
|
|
11
12
|
from .model import JsonModel
|
|
12
13
|
from .runtime import ConstSet
|
|
14
|
+
from .runtime.support import _path as json_path
|
|
13
15
|
|
|
14
16
|
# JsonModel = typing.NewType("JsonModel", None)
|
|
15
17
|
type Constants = bool|int|float|str|list[int|float|str]
|
|
@@ -46,25 +48,6 @@ def references(jm: JsonModel) -> dict[str, set[int]]:
|
|
|
46
48
|
|
|
47
49
|
return contains
|
|
48
50
|
|
|
49
|
-
# def reachable(self):
|
|
50
|
-
# """Build reachable defs."""
|
|
51
|
-
#
|
|
52
|
-
# # should consider **all** loaded models!?
|
|
53
|
-
# contains = self.references()
|
|
54
|
-
# reached = copy.deepcopy(contains)
|
|
55
|
-
#
|
|
56
|
-
# # simplistic transitive closure computation
|
|
57
|
-
# changed = True
|
|
58
|
-
# while changed:
|
|
59
|
-
# changed = False
|
|
60
|
-
# for ref, refs in reached.items():
|
|
61
|
-
# for r in refs:
|
|
62
|
-
# if r in reached and not reached[r].issubset(refs):
|
|
63
|
-
# changed = True
|
|
64
|
-
# refs.update(reached[r])
|
|
65
|
-
#
|
|
66
|
-
# return reached
|
|
67
|
-
|
|
68
51
|
def check(jm: JsonModel, assertion: ModelFilter, what: str = "?", short: bool = False) -> bool:
|
|
69
52
|
"""Check an arbitrary local assertion on a model."""
|
|
70
53
|
|
|
@@ -88,18 +71,25 @@ def valid(jm: JsonModel, path: ModelPath = [], root: bool = True, extend: bool =
|
|
|
88
71
|
is_valid = True
|
|
89
72
|
|
|
90
73
|
# allowed keywords
|
|
91
|
-
|
|
74
|
+
ROOT_KW = {"$", "%", "~"}
|
|
75
|
+
DIV_KW = {"@", "#"}
|
|
76
|
+
CMP_KW = {"<", "<=", ">", ">="}
|
|
77
|
+
NEQ_KW = {"=", "!="}
|
|
78
|
+
ARR_KW = {"!"}
|
|
79
|
+
OP_KW = {"@", "|", "&", "^", "+"}
|
|
80
|
+
|
|
92
81
|
if extend: # multiple-of: number, contains: model
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
CMP_KW |= {".mo"}
|
|
83
|
+
ARR_KW |= {".in"}
|
|
95
84
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if
|
|
99
|
-
|
|
85
|
+
NUM_KW = NEQ_KW | CMP_KW
|
|
86
|
+
ANY_KW = DIV_KW | NUM_KW | ARR_KW
|
|
87
|
+
if root:
|
|
88
|
+
ANY_KW |= ROOT_KW
|
|
100
89
|
|
|
101
90
|
def finiteRef(model: str) -> bool:
|
|
102
91
|
ref, recref, recid, ljm = model, [], [], jm
|
|
92
|
+
smodel = json.dumps(model)
|
|
103
93
|
while isinstance(ref, str) and jm._isRef(ref) and ref not in recref:
|
|
104
94
|
ljm = ljm.resolveRef(ref, path + recref)
|
|
105
95
|
recref.append(ref)
|
|
@@ -107,99 +97,129 @@ def valid(jm: JsonModel, path: ModelPath = [], root: bool = True, extend: bool =
|
|
|
107
97
|
ref = ljm._model
|
|
108
98
|
finite = not jm._isRef(ref) or ref == "$#" # Hmmm…
|
|
109
99
|
if not finite:
|
|
110
|
-
log.debug(f"infinite recursion on {
|
|
100
|
+
log.debug(f"infinite recursion on {smodel}: {recref} ({recid})")
|
|
111
101
|
return finite
|
|
112
102
|
|
|
113
103
|
def validFlt(model: ModelType, path: ModelPath) -> bool:
|
|
114
|
-
|
|
104
|
+
spath, smodel = json_path(path), json.dumps(model)
|
|
115
105
|
match model:
|
|
116
106
|
case None:
|
|
117
107
|
pass
|
|
118
108
|
case bool():
|
|
119
|
-
|
|
109
|
+
assert model, f"boolean model must be true at {spath}"
|
|
120
110
|
case int():
|
|
121
|
-
|
|
111
|
+
assert model in (-1, 0, 1), f"int model values at {spath}"
|
|
122
112
|
case float():
|
|
123
|
-
|
|
113
|
+
assert model in (-1.0, 0.0, 1.0), f"float model values at {spath}"
|
|
124
114
|
case str():
|
|
125
|
-
if model == "":
|
|
115
|
+
if model == "" or model[0] == "_":
|
|
126
116
|
pass
|
|
127
117
|
elif model[0] == "=":
|
|
128
|
-
|
|
118
|
+
assert re.match(CONST_RE, model) is not None, f"constant model {smodel} at {spath}"
|
|
129
119
|
elif model[0] == "/":
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
except Exception:
|
|
134
|
-
is_valid = False
|
|
120
|
+
assert "/" in model[1:], f"regex model {smodel} has closing marker at {spath}"
|
|
121
|
+
pattern, ropts = model[1:].rsplit("/", 1)
|
|
122
|
+
assert (ropts == "" or ropts.isalpha()) and is_regex(pattern), f"regex model {smodel} at {spath}"
|
|
135
123
|
elif model[0] == "$":
|
|
136
124
|
# reject predef extensions
|
|
137
125
|
if not extend and model.startswith("$__EXTENSION_"):
|
|
138
|
-
|
|
139
|
-
else: # TODO more checks
|
|
126
|
+
assert False, f"model extensions are enabled at {spath}"
|
|
127
|
+
else: # TODO more checks?
|
|
140
128
|
pass
|
|
141
129
|
case list():
|
|
142
130
|
pass
|
|
143
131
|
case dict():
|
|
132
|
+
assert len(model.keys() & OP_KW) <= 1, f"no operator mix at {spath}"
|
|
144
133
|
if "#" in model:
|
|
145
|
-
|
|
134
|
+
assert isinstance(model["#"], str), f"model object comment is a string at {spath}"
|
|
146
135
|
if "@" in model:
|
|
147
136
|
if "!" in model:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
137
|
+
assert isinstance(model["!"], bool), f"unique (!) is a boolean at {spath}"
|
|
138
|
+
if ".mo" in model:
|
|
139
|
+
assert isinstance(model[".mo"], (int, float)), f"multiple-of extension is a number at {spath}"
|
|
140
|
+
# @ and comparison consistency
|
|
141
|
+
aro_type = ultimate_type(jm, model["@"])
|
|
142
|
+
if aro_type in (int, float):
|
|
143
|
+
assert all(isinstance(model[op], (int, float)) for op in NUM_KW & model.keys()), \
|
|
144
|
+
f"number model has number constraints at {spath}"
|
|
145
|
+
elif aro_type is str:
|
|
146
|
+
assert all(isinstance(model[op], (int, str)) for op in NUM_KW & model.keys()), \
|
|
147
|
+
f"string model has number or string constraints at {spath}"
|
|
148
|
+
elif aro_type in (list, dict):
|
|
149
|
+
assert all(isinstance(model[op], int) for op in NUM_KW & model.keys()), \
|
|
150
|
+
f"array or object model has integer constraints at {spath}"
|
|
151
|
+
elif aro_type is bool:
|
|
152
|
+
assert len(model.keys() & CMP_KW) == 0, f"boolean model has no comparison constraints at {spath}"
|
|
153
|
+
assert all(isinstance(model[op], bool) for op in NEQ_KW & model.keys()), \
|
|
154
|
+
f"boolean model has boolean eq/neq constraints at {spath}"
|
|
155
|
+
elif aro_type is NullType:
|
|
156
|
+
assert len(model.keys() & CMP_KW) == 0, f"null model has no comparison constraints at {spath}"
|
|
157
|
+
assert all(isinstance(model[op], NullType) for op in NEQ_KW & model.keys()), \
|
|
158
|
+
f"null model has null eq/neq constraints at {spath}"
|
|
159
|
+
elif aro_type is TopType:
|
|
160
|
+
assert len(model.keys() & (NUM_KW | ARR_KW)) == 0, \
|
|
161
|
+
f"multi typed model has no constraints at {spath}"
|
|
162
|
+
elif aro_type is None:
|
|
163
|
+
assert len(model.keys() & (NUM_KW | ARR_KW)) == 0, \
|
|
164
|
+
f"no type model has no constraints at {spath}"
|
|
165
|
+
else:
|
|
166
|
+
assert False, f"unexpected model type {aro_type} at {spath}"
|
|
167
|
+
# only comments
|
|
168
|
+
assert all(prop.startswith("#") for prop in model.keys() - ANY_KW), \
|
|
169
|
+
f"miscellaneous keywords are comments at {spath}"
|
|
170
|
+
# lattice consistency
|
|
171
|
+
if model.keys() & ARR_KW:
|
|
172
|
+
assert aro_type is list, f"array model for array constraints at {spath}"
|
|
154
173
|
elif "|" in model:
|
|
155
|
-
|
|
156
|
-
# no other keys in recurse
|
|
174
|
+
assert isinstance(model["|"], list), f"or model is an array at {spath}"
|
|
157
175
|
elif "^" in model:
|
|
158
|
-
|
|
159
|
-
# no other keys in recurse
|
|
176
|
+
assert isinstance(model["^"], list), f"xor model is an array at {spath}"
|
|
160
177
|
elif "&" in model:
|
|
161
|
-
|
|
162
|
-
# no other keys in recurse
|
|
178
|
+
assert isinstance(model["&"], list), f"and model is an array at {spath}"
|
|
163
179
|
elif "+" in model:
|
|
164
|
-
|
|
165
|
-
# no other keys in recurse
|
|
180
|
+
assert isinstance(model["+"], list), f"merge model is an array at {spath}"
|
|
166
181
|
else: # check object
|
|
167
|
-
props = set() # property name collisions
|
|
182
|
+
props = set() # check property name collisions
|
|
168
183
|
for p, m in model.items():
|
|
169
184
|
if p == "#":
|
|
170
185
|
continue
|
|
171
|
-
|
|
186
|
+
assert isinstance(p, str), f"property name {p} is a string at {spath}"
|
|
172
187
|
if p and p[0] not in ("$", "/"):
|
|
173
188
|
name = p[1:] if p[0] in ("?", "_", "!") else p
|
|
174
|
-
|
|
189
|
+
assert name not in props, f"no property name collison at {spath}"
|
|
175
190
|
props.add(name)
|
|
176
191
|
# more checks on p if p[0] == "$"
|
|
177
192
|
case _:
|
|
178
|
-
|
|
193
|
+
assert False, f"unexpected model base type at {spath}"
|
|
179
194
|
return True
|
|
180
195
|
|
|
181
|
-
|
|
196
|
+
try:
|
|
182
197
|
for name, jmr in jm._defs.items():
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
198
|
+
assert not re.search(r"^[A-Z_][A-Z_0-9]*$", name), \
|
|
199
|
+
f"all caps reserved for predefs at ${name}"
|
|
200
|
+
assert finiteRef("$" + name), f"finite recursion on ${name}"
|
|
201
|
+
check(jm, validFlt, "JSON Model Structural Validity")
|
|
202
|
+
is_valid = True
|
|
203
|
+
except AssertionError as e:
|
|
204
|
+
is_valid = False
|
|
205
|
+
if jm._debug > 0:
|
|
206
|
+
log.error(e, exc_info=True)
|
|
207
|
+
else:
|
|
208
|
+
log.warning(e)
|
|
209
|
+
if jm._debug:
|
|
210
|
+
raise
|
|
195
211
|
|
|
196
212
|
return is_valid
|
|
197
213
|
|
|
214
|
+
#
|
|
215
|
+
# ULTIMATE TYPE
|
|
216
|
+
#
|
|
198
217
|
|
|
199
218
|
# ultimate type of predefs
|
|
200
219
|
_UTYPE = {
|
|
201
|
-
"$ANY":
|
|
202
|
-
"$NULL":
|
|
220
|
+
"$ANY": TopType,
|
|
221
|
+
"$NULL": NullType,
|
|
222
|
+
"$NONE": None, # bottom for infeasible
|
|
203
223
|
}
|
|
204
224
|
|
|
205
225
|
for predef in BOOL_MODEL_PREDEFS:
|
|
@@ -212,18 +232,23 @@ for predef in STR_MODEL_PREDEFS:
|
|
|
212
232
|
_UTYPE[predef] = str
|
|
213
233
|
|
|
214
234
|
def _ultimate_type(jm: JsonModel, model: ModelType, names: set[str]) -> type|None:
|
|
235
|
+
if model is None:
|
|
236
|
+
return NullType
|
|
215
237
|
match model:
|
|
216
238
|
case str():
|
|
217
239
|
if model == "" or model[0] not in ("$", "="):
|
|
240
|
+
# cover strings, regex...
|
|
218
241
|
return type(model)
|
|
219
242
|
elif model[0] == "=": # constants
|
|
220
|
-
return (
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
243
|
+
return (
|
|
244
|
+
NullType if model == "=null" else
|
|
245
|
+
bool if model in ("=true", "=false") else
|
|
246
|
+
float if "." in model else
|
|
247
|
+
int
|
|
248
|
+
)
|
|
249
|
+
elif model in _UTYPE: # predefs
|
|
225
250
|
return _UTYPE[model]
|
|
226
|
-
else: # "$..."
|
|
251
|
+
else: # reference "$..."
|
|
227
252
|
# stop detected recursion
|
|
228
253
|
if model in names:
|
|
229
254
|
return None
|
|
@@ -237,26 +262,40 @@ def _ultimate_type(jm: JsonModel, model: ModelType, names: set[str]) -> type|Non
|
|
|
237
262
|
types = set(_ultimate_type(jm, m, names) for m in models)
|
|
238
263
|
if len(types) == 1:
|
|
239
264
|
return types.pop()
|
|
240
|
-
|
|
265
|
+
elif len(types) == 0: # |() == $NONE
|
|
241
266
|
return None
|
|
267
|
+
else:
|
|
268
|
+
return TopType
|
|
242
269
|
elif "^" in model:
|
|
243
270
|
assert isinstance(models := model["^"], list)
|
|
244
271
|
types = set(_ultimate_type(jm, m, names) for m in models)
|
|
245
272
|
if len(types) == 1:
|
|
246
273
|
return types.pop()
|
|
247
|
-
|
|
274
|
+
elif len(types) == 0:
|
|
248
275
|
return None
|
|
276
|
+
else:
|
|
277
|
+
return TopType
|
|
249
278
|
elif "&" in model:
|
|
250
279
|
assert isinstance(models := model["&"], list)
|
|
251
280
|
types = set(_ultimate_type(jm, m, names) for m in models)
|
|
252
281
|
if len(types) == 1:
|
|
253
282
|
return types.pop()
|
|
254
|
-
|
|
255
|
-
# possibly not feasible
|
|
283
|
+
elif None in types:
|
|
256
284
|
return None
|
|
285
|
+
elif len(types) == 0: # &() == $ANY
|
|
286
|
+
return TopType
|
|
287
|
+
else:
|
|
288
|
+
otypes = types - {TopType}
|
|
289
|
+
return (
|
|
290
|
+
None if len(otypes) > 1 else
|
|
291
|
+
otypes.pop() if len(otypes) == 1 else
|
|
292
|
+
TopType
|
|
293
|
+
)
|
|
294
|
+
elif "+" in model:
|
|
295
|
+
return dict
|
|
257
296
|
else:
|
|
258
297
|
return type(model) # dict
|
|
259
|
-
case _: #
|
|
298
|
+
case _: # bool, int, float, list
|
|
260
299
|
return type(model)
|
|
261
300
|
|
|
262
301
|
def ultimate_type(jm: JsonModel, model: ModelType) -> type|None:
|
|
@@ -852,8 +852,8 @@ class CLangJansson(Language):
|
|
|
852
852
|
elif nparts == 2:
|
|
853
853
|
first, second = min(part_code.keys()), max(part_code.keys())
|
|
854
854
|
return (f"({self.num_cmp(var, '<=', first, True, True)}) "
|
|
855
|
-
f"? (\n {part_code[first]} ) "
|
|
856
|
-
f": (\n {part_code[second]} )")
|
|
855
|
+
f"? (\n {part_code[first]}\n ) "
|
|
856
|
+
f": (\n {part_code[second]}\n )")
|
|
857
857
|
else:
|
|
858
858
|
limit = list(sorted(part_code.keys()))[nparts // 2 - 1]
|
|
859
859
|
_ex = self._part_expr
|
|
@@ -879,8 +879,8 @@ class CLangJansson(Language):
|
|
|
879
879
|
hash_size, partitions = 0, {0: names}
|
|
880
880
|
|
|
881
881
|
part_code = {
|
|
882
|
-
p: " || ".join(
|
|
883
|
-
(_str_cmp("s", json.dumps(s), self._byte_order, True) + f" // {self.esc(s)}
|
|
882
|
+
p: "\n || ".join(
|
|
883
|
+
(_str_cmp("s", json.dumps(s), self._byte_order, True) + f" // {self.esc(s)}")
|
|
884
884
|
for s in sorted(strs, key=lambda s: (len(s), s)))
|
|
885
885
|
for p, strs in partitions.items()
|
|
886
886
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.0.60
|