json-model-compiler 2.0b0__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.0b0/.gitignore +12 -0
- json_model_compiler-2.0b0/.gitmodules +3 -0
- json_model_compiler-2.0b0/BACKLOG.md +432 -0
- json_model_compiler-2.0b0/DESIGN-v2.md +130 -0
- json_model_compiler-2.0b0/HOWTO.md +36 -0
- json_model_compiler-2.0b0/INTEGRATION.md +58 -0
- json_model_compiler-2.0b0/MANIFEST.in +1 -0
- json_model_compiler-2.0b0/Makefile +82 -0
- json_model_compiler-2.0b0/PKG-INFO +201 -0
- json_model_compiler-2.0b0/README.md +172 -0
- json_model_compiler-2.0b0/TUTO.md +717 -0
- json_model_compiler-2.0b0/jmc.md +109 -0
- json_model_compiler-2.0b0/js_runtime/README.md +8 -0
- json_model_compiler-2.0b0/js_runtime/index.js +225 -0
- json_model_compiler-2.0b0/js_runtime/main.js +228 -0
- json_model_compiler-2.0b0/js_runtime/package.json +12 -0
- json_model_compiler-2.0b0/json_model/README.md +32 -0
- json_model_compiler-2.0b0/json_model/__init__.py +18 -0
- json_model_compiler-2.0b0/json_model/analyze.py +409 -0
- json_model_compiler-2.0b0/json_model/clang.py +563 -0
- json_model_compiler-2.0b0/json_model/convert.py +430 -0
- json_model_compiler-2.0b0/json_model/data/clang_entry.c +21 -0
- json_model_compiler-2.0b0/json_model/data/clang_free.c +10 -0
- json_model_compiler-2.0b0/json_model/data/clang_init.c +11 -0
- json_model_compiler-2.0b0/json_model/data/clang_pcre2_fun.c +6 -0
- json_model_compiler-2.0b0/json_model/data/clang_re2_fun.c +5 -0
- json_model_compiler-2.0b0/json_model/data/javascript_exe.js +4 -0
- json_model_compiler-2.0b0/json_model/data/javascript_foot.js +9 -0
- json_model_compiler-2.0b0/json_model/data/javascript_free.js +9 -0
- json_model_compiler-2.0b0/json_model/data/javascript_head.js +1 -0
- json_model_compiler-2.0b0/json_model/data/javascript_init.js +11 -0
- json_model_compiler-2.0b0/json_model/data/javascript_main.js +5 -0
- json_model_compiler-2.0b0/json_model/data/plpgsql_entry.sql +16 -0
- json_model_compiler-2.0b0/json_model/data/python_entry.py +11 -0
- json_model_compiler-2.0b0/json_model/data/python_exe.py +1 -0
- json_model_compiler-2.0b0/json_model/data/python_free.py +6 -0
- json_model_compiler-2.0b0/json_model/data/python_init.py +9 -0
- json_model_compiler-2.0b0/json_model/data/python_main.py +4 -0
- json_model_compiler-2.0b0/json_model/javascript.py +310 -0
- json_model_compiler-2.0b0/json_model/language.py +748 -0
- json_model_compiler-2.0b0/json_model/model.py +1084 -0
- json_model_compiler-2.0b0/json_model/mtypes.py +42 -0
- json_model_compiler-2.0b0/json_model/objmerge.py +165 -0
- json_model_compiler-2.0b0/json_model/optim.py +486 -0
- json_model_compiler-2.0b0/json_model/plpgsql.py +422 -0
- json_model_compiler-2.0b0/json_model/python.py +269 -0
- json_model_compiler-2.0b0/json_model/recurse.py +127 -0
- json_model_compiler-2.0b0/json_model/resolver.py +106 -0
- json_model_compiler-2.0b0/json_model/runtime/META.json +30 -0
- json_model_compiler-2.0b0/json_model/runtime/Makefile +21 -0
- json_model_compiler-2.0b0/json_model/runtime/__init__.py +32 -0
- json_model_compiler-2.0b0/json_model/runtime/json-model.c +1054 -0
- json_model_compiler-2.0b0/json_model/runtime/json-model.h +183 -0
- json_model_compiler-2.0b0/json_model/runtime/json_model--2.0.sql +261 -0
- json_model_compiler-2.0b0/json_model/runtime/json_model.control +2 -0
- json_model_compiler-2.0b0/json_model/runtime/main.c +473 -0
- json_model_compiler-2.0b0/json_model/runtime/support.py +485 -0
- json_model_compiler-2.0b0/json_model/runtime/types.py +16 -0
- json_model_compiler-2.0b0/json_model/script.py +585 -0
- json_model_compiler-2.0b0/json_model/url_cache.py +82 -0
- json_model_compiler-2.0b0/json_model/utils.py +623 -0
- json_model_compiler-2.0b0/json_model/xstatic.py +1444 -0
- json_model_compiler-2.0b0/json_model_compiler.egg-info/PKG-INFO +201 -0
- json_model_compiler-2.0b0/json_model_compiler.egg-info/SOURCES.txt +123 -0
- json_model_compiler-2.0b0/json_model_compiler.egg-info/dependency_links.txt +1 -0
- json_model_compiler-2.0b0/json_model_compiler.egg-info/entry_points.txt +2 -0
- json_model_compiler-2.0b0/json_model_compiler.egg-info/requires.txt +20 -0
- json_model_compiler-2.0b0/json_model_compiler.egg-info/top_level.txt +1 -0
- json_model_compiler-2.0b0/models/ansiblelint-meta.model.json +371 -0
- json_model_compiler-2.0b0/models/geo.model.json +69 -0
- json_model_compiler-2.0b0/models/json-mode-latest.model.json +9 -0
- json_model_compiler-2.0b0/models/json-model-no-merge.model.json +14 -0
- json_model_compiler-2.0b0/models/json-model-tight.model.json +54 -0
- json_model_compiler-2.0b0/models/json-model-v1.model.json +30 -0
- json_model_compiler-2.0b0/models/json-model-v2-en.model.json +16 -0
- json_model_compiler-2.0b0/models/json-model-v2.model.json +66 -0
- json_model_compiler-2.0b0/models/json-model.model.json +66 -0
- json_model_compiler-2.0b0/models/json-schema-draft-01-fuzzy.model.json +12 -0
- json_model_compiler-2.0b0/models/json-schema-draft-01-nesting.model.json +12 -0
- json_model_compiler-2.0b0/models/json-schema-draft-01.model.json +35 -0
- json_model_compiler-2.0b0/models/json-schema-draft-02-fuzzy.model.json +12 -0
- json_model_compiler-2.0b0/models/json-schema-draft-02-nesting.model.json +12 -0
- json_model_compiler-2.0b0/models/json-schema-draft-02.model.json +37 -0
- json_model_compiler-2.0b0/models/json-schema-draft-03-fuzzy.model.json +15 -0
- json_model_compiler-2.0b0/models/json-schema-draft-03-nesting.model.json +12 -0
- json_model_compiler-2.0b0/models/json-schema-draft-03.model.json +39 -0
- json_model_compiler-2.0b0/models/json-schema-draft-04-fuzzy.model.json +15 -0
- json_model_compiler-2.0b0/models/json-schema-draft-04-nesting.model.json +12 -0
- json_model_compiler-2.0b0/models/json-schema-draft-04.model.json +47 -0
- json_model_compiler-2.0b0/models/json-schema-draft-06-fuzzy.model.json +15 -0
- json_model_compiler-2.0b0/models/json-schema-draft-06.model.json +55 -0
- json_model_compiler-2.0b0/models/json-schema-draft-07-fuzzy.model.json +15 -0
- json_model_compiler-2.0b0/models/json-schema-draft-07.model.json +62 -0
- json_model_compiler-2.0b0/models/json-schema-draft-2019-09-fuzzy.model.json +20 -0
- json_model_compiler-2.0b0/models/json-schema-draft-2019-09.model.json +97 -0
- json_model_compiler-2.0b0/models/json-schema-draft-2020-12-fuzzy.model.json +22 -0
- json_model_compiler-2.0b0/models/json-schema-draft-2020-12-tight.model.json +108 -0
- json_model_compiler-2.0b0/models/json-schema-draft-2020-12.model.json +99 -0
- json_model_compiler-2.0b0/models/json-schema-draft-next-fuzzy.model.json +19 -0
- json_model_compiler-2.0b0/models/json-schema-draft-next.model.json +100 -0
- json_model_compiler-2.0b0/models/json-schema-draft-tight.model.json +95 -0
- json_model_compiler-2.0b0/models/json-schema-draft-tighter-loose.model.json +23 -0
- json_model_compiler-2.0b0/models/json-schema-draft-tighter.model.json +83 -0
- json_model_compiler-2.0b0/models/json-schema-linter.model.json +83 -0
- json_model_compiler-2.0b0/models/jsound.model.json +72 -0
- json_model_compiler-2.0b0/models/l10n.model.json +12 -0
- json_model_compiler-2.0b0/models/lazygit.model.json +330 -0
- json_model_compiler-2.0b0/models/openapi-311-fuzzy.model.json +14 -0
- json_model_compiler-2.0b0/models/openapi-311-models.model.json +32 -0
- json_model_compiler-2.0b0/models/openapi-311.model.json +290 -0
- json_model_compiler-2.0b0/models/person.model.json +5 -0
- json_model_compiler-2.0b0/models/person2.model.json +6 -0
- json_model_compiler-2.0b0/models/pgxn.model.json +68 -0
- json_model_compiler-2.0b0/package.json +13 -0
- json_model_compiler-2.0b0/pyproject.toml +56 -0
- json_model_compiler-2.0b0/setup.cfg +4 -0
- json_model_compiler-2.0b0/site/BACKLOG.md +432 -0
- json_model_compiler-2.0b0/site/HOWTO.md +36 -0
- json_model_compiler-2.0b0/site/README.md +172 -0
- json_model_compiler-2.0b0/site/TUTO.md +717 -0
- json_model_compiler-2.0b0/site/favicon.ico +0 -0
- json_model_compiler-2.0b0/site/index.html +42 -0
- json_model_compiler-2.0b0/site/jmc.md +109 -0
- json_model_compiler-2.0b0/site/json_logo.svg +15 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
# Backlog v2
|
|
2
|
+
|
|
3
|
+
## Current Tasks
|
|
4
|
+
|
|
5
|
+
- [x] sql-backend: package support as an extension
|
|
6
|
+
- [x] pr: register `json-model.org` domain
|
|
7
|
+
- [x] doc: bootstrap jmc manpage with pandoc
|
|
8
|
+
- [x] pr: setup official http/https web page
|
|
9
|
+
- [x] pr: improve official web page with docsify
|
|
10
|
+
- [x] optim: simplify int constraints
|
|
11
|
+
- [x] optim: simplify some property regex
|
|
12
|
+
- [x] model: add `pgxn` model
|
|
13
|
+
- [x] pr: register as an [official pgxs extension](https://pgxn.org/dist/json_model/).
|
|
14
|
+
- [x] doc: complete jmc manpage
|
|
15
|
+
- [x] pr: publish python `json_model` package
|
|
16
|
+
- [ ] schema: inline external reference to generate valid schemas
|
|
17
|
+
- [ ] pr: provide a docker
|
|
18
|
+
- [ ] design: compile exreg to regex when possible
|
|
19
|
+
- [ ] xstatic: add option support to property regex?
|
|
20
|
+
- [ ] design: allow comments starting with `#`, not just `#`?
|
|
21
|
+
- [ ] optim: simplify float constraints
|
|
22
|
+
- [ ] pr: add documentation page
|
|
23
|
+
- [ ] pr: add reference / spec page
|
|
24
|
+
- [ ] command: add bash completion
|
|
25
|
+
- [ ] python: separate python interface in some file
|
|
26
|
+
- [ ] python: check python interface consistency
|
|
27
|
+
- [ ] tests: reorganize tests cases in smaller thematic directories
|
|
28
|
+
- [ ] tests: review allowed exceptions on schemas
|
|
29
|
+
- [ ] model: fix rw issue in `openapi-311-fuzzy`
|
|
30
|
+
- [ ] sql-backend: fix generated code under `--reporting`
|
|
31
|
+
- [ ] design: add predefs for `$UUIDx`…
|
|
32
|
+
- [ ] js-backend: cleanup map and set
|
|
33
|
+
- [ ] js-backend: `let` vs `var` consistency?
|
|
34
|
+
- [ ] doc: document `re2` support for C
|
|
35
|
+
- [ ] design: rewrite reuse path? rather force defs?
|
|
36
|
+
- [ ] tests: with multiple regex engine
|
|
37
|
+
- [ ] use: js/ts type export?
|
|
38
|
+
- [ ] use: py type dataclass/pydantic export?
|
|
39
|
+
- [ ] use: test with corrector? ref? kiva?
|
|
40
|
+
- [ ] static: sort list of models? option?
|
|
41
|
+
- [ ] optim: merge `&` of objects in some cases?
|
|
42
|
+
- [ ] static: fix double reports, eg constraint type and constraints or object props and object
|
|
43
|
+
- [ ] py-backend: fix failure verbosity `ref/json-model.py.check` vs others
|
|
44
|
+
- [ ] static: keep deeper names?
|
|
45
|
+
- [ ] ts-backend: js sharing?
|
|
46
|
+
- [ ] optim: allow more substitutions _after_ transformations? when/where to trigger optims?
|
|
47
|
+
- [ ] py-backend: heterogeneous enum (`enum_05`) improved implementation with `ConstSet`
|
|
48
|
+
- [ ] py-backend: heterogeneous disjunction is `ConstMap`?
|
|
49
|
+
- [ ] py-backend: unique for scalars (`set` only works for str)
|
|
50
|
+
- [ ] c-backend: optimize unique for scalar types using `constant_t`
|
|
51
|
+
- [ ] c-backend: remove path build under no reporting code gen
|
|
52
|
+
- [ ] static: make loose/strict work locally, triggered by `$name` root comments
|
|
53
|
+
- [ ] optim: root xor should be simplified in `geo.model.json`, maybe with inlining?
|
|
54
|
+
- [ ] python: how to keep looseness after inlining?
|
|
55
|
+
- [ ] static: multi-type object disjunction?
|
|
56
|
+
- [ ] tests: fix `./rwt/json-schema-draft-next-fuzzy.x.c unused variable res`
|
|
57
|
+
- [ ] tests: allow options for specific tests from pytest
|
|
58
|
+
- [ ] tests: improve schema tests by allowing more cases
|
|
59
|
+
- [ ] static: improve failure reporting of extended regex
|
|
60
|
+
- [ ] design: add `$URI-REF` or similar? `$PATH`?
|
|
61
|
+
- [ ] c-backend: add reporting to predef failures?
|
|
62
|
+
- [ ] c-backend: generate thread-safe code? option? this currently would require malloc'ed stuff
|
|
63
|
+
- [ ] static: what about a specialize IR [Blaze](https://arxiv.org/abs/2503.02770)?
|
|
64
|
+
- [ ] command: write a man-page or similar?
|
|
65
|
+
- [ ] tests: put generated exe in `/dev/shm` instead of locally from `Makefile`?
|
|
66
|
+
- [ ] static: improve constraint failing message (length, unique…)
|
|
67
|
+
- [ ] schema: inline external references to generate working schemas in more cases? (openapi-311)
|
|
68
|
+
- [ ] mongodb-backend: generate bson stuff, as an option to schema generation?
|
|
69
|
+
- [ ] php-backend: should it stoop so low?
|
|
70
|
+
- [ ] perf: geo, ansible meta, openapi
|
|
71
|
+
- [ ] python: refactor preproc vs compile vs codegen…
|
|
72
|
+
- [ ] c-backend: multithreading? one one value??
|
|
73
|
+
- [ ] pr: deb and rpm packaging? github package distribution?
|
|
74
|
+
|
|
75
|
+
## Re Do
|
|
76
|
+
|
|
77
|
+
- [ ] pr: publish python jmc package
|
|
78
|
+
- [ ] pr: publish js runtime package
|
|
79
|
+
- [ ] pr: publish pgxn package
|
|
80
|
+
- [ ] pr: publish other packages?
|
|
81
|
+
- [ ] pr: renew domain
|
|
82
|
+
|
|
83
|
+
## To Do
|
|
84
|
+
|
|
85
|
+
- [ ] project: establish priority
|
|
86
|
+
- [ ] frontend: accept raw sequence of values? list of values?
|
|
87
|
+
- [ ] project: improve backlog management with thematic sections
|
|
88
|
+
- [ ] design: $-refs may only appear in defs for simpler compiler AND better readability?
|
|
89
|
+
- [ ] project: move all code's TODO here
|
|
90
|
+
- [ ] py-backend: multi-type enum `enum_05`
|
|
91
|
+
- [ ] optim: more constraint simplifications, eg redundant `<` and `<=`.
|
|
92
|
+
- [ ] static: if loose, cast all int constants to double?
|
|
93
|
+
- [ ] c-backend: add arr and obj to cst management?
|
|
94
|
+
- [ ] c-backend: more separate headers to avoid unused warnings.
|
|
95
|
+
- [ ] c-backend: add a common prefix to all internal functions.
|
|
96
|
+
- [ ] design: should it allow unexpected ints as constants?
|
|
97
|
+
- [ ] dynamic: JSON IR to lambda?!
|
|
98
|
+
- [ ] backend: add JSON output?
|
|
99
|
+
- [ ] backend: direct code for blaze?
|
|
100
|
+
- [ ] dynamic: rely on static and eval
|
|
101
|
+
- [ ] frontend: add multi-level naming option
|
|
102
|
+
- [ ] optim: ultimate type on loose should yield `float`
|
|
103
|
+
- [ ] static: abstract imperative language code generation (wip)
|
|
104
|
+
- [ ] backend: do not generate intermediate empty functions for direct objects?
|
|
105
|
+
- [ ] backend: do not generate intermediate empty functions for property values when possible
|
|
106
|
+
- [ ] backend: reduce/minimize language abstraction? `T_var_val`?
|
|
107
|
+
- [ ] backend: rethink function boundaries?
|
|
108
|
+
- [ ] backend: rethink `with_report` and `with_path`, keep the former only?
|
|
109
|
+
- [ ] c-backend: add support for `re2` wrapper?
|
|
110
|
+
- [ ] backend: name-based selector optimized for root.
|
|
111
|
+
- [ ] perfs: measure performance against blaze benchmark for openapi at least
|
|
112
|
+
- [ ] python: refactor in preproc tools…
|
|
113
|
+
- [ ] optim: remove unused introduced names `__external_...`
|
|
114
|
+
- [ ] optim: remove unused names at depth 1 and more?
|
|
115
|
+
- [ ] optim: remove unused local (not exported) definitions?
|
|
116
|
+
- [ ] static: detect and remove duplicate functions!
|
|
117
|
+
- [ ] static: generate pyright compatible code…
|
|
118
|
+
- [ ] tests: remove unstable DO output? remove empty lines?
|
|
119
|
+
- [ ] design: handle `.` and `/` references as relative url
|
|
120
|
+
- [ ] design: namespace, only some defs exported, and cannot have multi-level refs `$r#N#xxx`?
|
|
121
|
+
- [ ] python: use mandatory keyword parameters where appropriate
|
|
122
|
+
- [ ] feature: `--extension openapi` to activate an extension ? default `none`, `moschin`…
|
|
123
|
+
- [ ] design: add convention for local vs exported definitions? capital?
|
|
124
|
+
- [ ] static: separate compilation of included models
|
|
125
|
+
- [ ] jmc: add option to do/skip check of `~` model
|
|
126
|
+
- [ ] feature: control url caching, change dir location or disable
|
|
127
|
+
- [ ] feature: cache expiration?
|
|
128
|
+
- [ ] feature: improve error messages, eg missing "$" on a URL reference
|
|
129
|
+
- [ ] feature: restrict definitions as proper identifiers
|
|
130
|
+
- [ ] tests: re-check some results of json schema analysis paper
|
|
131
|
+
- [ ] feature: self trafo example, eg create a variant between local defs
|
|
132
|
+
- [ ] tests: measure coverage
|
|
133
|
+
- [ ] feature: simplify lib usage wrt script-like features with some functions
|
|
134
|
+
- [ ] feature: full inline of externals to generate a working model without includes
|
|
135
|
+
- [ ] feature: check/forbid/allow url references with an anchor
|
|
136
|
+
- [ ] static: remove spurious newlines
|
|
137
|
+
- [ ] tests: move/add more tests to rwt, modval, bads
|
|
138
|
+
- [ ] tests: what if a trafo adds/replaces an external reference, is it resolved?
|
|
139
|
+
- [ ] tests: fix tests in `bads/wip`?
|
|
140
|
+
- [ ] tests: add github CI
|
|
141
|
+
- [ ] tests: raise coverage, possibly to 100%?
|
|
142
|
+
- [ ] tests: skip url cache while testing
|
|
143
|
+
- [ ] tests: move Makefile tasks as `pytest` items with target content as reference
|
|
144
|
+
- [ ] output: improve `-P` to have a re-intrant model (see also: inline)
|
|
145
|
+
- [ ] output: prettyprint rejection reasons?
|
|
146
|
+
- [ ] feature: direct validator
|
|
147
|
+
- [ ] feature: static/dynamic js/ts compiler?
|
|
148
|
+
- [ ] feature: (limited) pydantic export?
|
|
149
|
+
- [ ] feature: integrate or remove `stats`?
|
|
150
|
+
- [ ] feature: think about code integration in a realistic project? usability? doc?
|
|
151
|
+
- [ ] design: (online) extension register?
|
|
152
|
+
- [ ] doc: check and document API entry points
|
|
153
|
+
- [ ] extend: direct forms for instance, eg types, constraints, layout? see [FormBuilder](https://formbuilder.online/).
|
|
154
|
+
- [ ] extend: direct relational mapping? (eg foreign key/primary key/unique)
|
|
155
|
+
- [ ] extend: direct object creation (Python pydantic, JS)?
|
|
156
|
+
- [ ] extend: ORM support, eg in the Python ecosystem, see `SQLAlchemy` and `Django`?
|
|
157
|
+
- [ ] extend: data structure _documentation_
|
|
158
|
+
- [ ] extend: accepting any extension?! eg opened objects?
|
|
159
|
+
- [ ] extend: variants, see `models/json-schema-*`
|
|
160
|
+
- [ ] extend: pg storage, extension
|
|
161
|
+
- [ ] extend: mongodb storage ?
|
|
162
|
+
- [ ] perf: schema validation on yac data
|
|
163
|
+
- [ ] perf: open data, eg RNCP and FRESQ
|
|
164
|
+
- [ ] frontend: loop load/valid for perf
|
|
165
|
+
- [ ] perf: reuse blaze data set where possible (implies schema to model)
|
|
166
|
+
- [ ] design: conditionals or not conditionals… eg for interfaces?
|
|
167
|
+
if not in the description language, it should be easy to express outside.
|
|
168
|
+
- [ ] doc: create a clean documentation, following Diátaxis (tuto | howto / explain | reference).
|
|
169
|
+
- [ ] doc: setup mkdocs
|
|
170
|
+
- [ ] doc: tutorial which mimics [json schema](https://tour.json-schema.org/)?
|
|
171
|
+
- [ ] research: paper themes? extensions, compilation (CGO tools), ...?
|
|
172
|
+
- [ ] feature: use actual JSON path spec for transformations with a filter for applying changes
|
|
173
|
+
- [ ] pr: register `json-model.org`? use `github.io`?
|
|
174
|
+
- [ ] pr: article submission about data structure trafo? validation performance? high-level IR?
|
|
175
|
+
perf is important because value validation is pure (useless) in-depth overhead in practice.
|
|
176
|
+
- [ ] perf: two phase check, without collection and with collection if needed.
|
|
177
|
+
- [ ] perf: no reasons/path collection and run with collection only when bad.
|
|
178
|
+
- [ ] schema: handle includes? inline?!
|
|
179
|
+
- [ ] js/ts-backend: look at JSON Schema implementations?
|
|
180
|
+
- [ ] dyn-backend: is dynamic mergeable in xstatic, beyond using `eval`?
|
|
181
|
+
- [ ] rust-backend: see [json crate](https://docs.rs/json/latest/json/).
|
|
182
|
+
- [ ] cpp-backend: see [json](https://github.com/nlohmann/json) and `re2`. json lib popularity?
|
|
183
|
+
- [ ] cpp-backend: also see [simdjson](https://github.com/simdjson/simdjson)?
|
|
184
|
+
- [ ] java-backend: see [jackson](https://github.com/FasterXML/jackson).
|
|
185
|
+
- [ ] kotlin-backend: see [serialization](https://kotlinlang.org/docs/serialization.html).
|
|
186
|
+
- [ ] go-backend: encoding/json vs various faster replacements…
|
|
187
|
+
- [ ] ruby-backend: for rails people?
|
|
188
|
+
- [ ] pl-backend: for CGI people?
|
|
189
|
+
- [ ] feature: add model predef for URI, URI-REF and the like
|
|
190
|
+
- [ ] design: URI vs URL?
|
|
191
|
+
- [ ] service: json to lang conversion API :-)
|
|
192
|
+
- [ ] design: documentation use case, with added _markdown description_
|
|
193
|
+
- [ ] pr: validation must be optimized for the valid case, as it is the most likely.
|
|
194
|
+
- [ ] case: use trafo in geo to have either 2 or 3 vectors, no mix.
|
|
195
|
+
|
|
196
|
+
## Done
|
|
197
|
+
|
|
198
|
+
- [x] refactor: move schema to model conversion to json-schema-utils.
|
|
199
|
+
- [x] design: change `%` to `$` and remove `$` intra-model naming shortcut.
|
|
200
|
+
- [x] design: name space decision, there is only one name space per file. trafo path are exceptions?
|
|
201
|
+
- [x] design: ~readability and style: `:verbose` version of single char keywords!? (see extensions)~
|
|
202
|
+
- [x] design: clarify stuff inside the root `#`? or use `%` for specific purpose?
|
|
203
|
+
- [x] design: extension for preprocessed (merged and trafo).
|
|
204
|
+
- [x] dynamic: python compiler
|
|
205
|
+
- [x] static: python compiler
|
|
206
|
+
- [x] design: variants, i.e. form in progress vs final form with more constraints?
|
|
207
|
+
- [x] design: extensions could allow synonyms enabling JSON Model l10n?
|
|
208
|
+
- [x] tests: declaration of the meta model?
|
|
209
|
+
- [x] feature: accept js suffix as input, possibly removing comments.
|
|
210
|
+
- [x] feature: add `--auto` option to automatically extract url mappings
|
|
211
|
+
- [x] static: generate separate `check_model` root function and simplify code.
|
|
212
|
+
- [x] tests: recheck existing tests in rwt
|
|
213
|
+
- [x] static: deterministic set output
|
|
214
|
+
- [x] dynamic: fix output instability
|
|
215
|
+
- [x] python: pyright
|
|
216
|
+
- [x] python: ruff
|
|
217
|
+
- [x] python: flake8
|
|
218
|
+
- [x] refactor: move basic script pre processing as functions
|
|
219
|
+
- [x] tests: test schemas and values with jsu
|
|
220
|
+
- [x] extend: `.schema` extension to add JSON Schema specific stuff, and `.mo` and `.in`
|
|
221
|
+
- [x] tests: rename without explicit `-v2`
|
|
222
|
+
- [x] python: remove global list in Symbols
|
|
223
|
+
- [x] tests: move bads up
|
|
224
|
+
- [x] tests: move bads data to bads directory
|
|
225
|
+
- [x] feature: use `-` for standard input and output
|
|
226
|
+
- [x] feature: yaml file input
|
|
227
|
+
- [x] tests: working `make check`
|
|
228
|
+
- [x] tests: make check for bads
|
|
229
|
+
- [x] tests: add malformed bad models
|
|
230
|
+
- [x] tests: with an actual url! (hello2)
|
|
231
|
+
- [x] python: rename `types.py` which is a pain
|
|
232
|
+
- [x] feature: yaml url input
|
|
233
|
+
- [x] tests: True/False -> PASS/FAIL
|
|
234
|
+
- [x] feature: ~how to remove a definition? nope, must be nullified (eg `$NONE`) because refs~
|
|
235
|
+
- [x] tests: upgrade all models in `models/` and check them as well
|
|
236
|
+
- [x] tests: add expected "$schema" value to schema models
|
|
237
|
+
- [x] static: do not inline unused support function (`is_valid_*` and possibly others)
|
|
238
|
+
- [x] schema: control keyword sorting to put type-related stuff on top (-ns)
|
|
239
|
+
- [x] static: use mandatory keyword parameters where appropriate
|
|
240
|
+
- [x] feature: clarify and implement options management `JSON_MODEL_…`
|
|
241
|
+
- [x] feature: allow scalar value for `/`
|
|
242
|
+
- [x] schema: test output json schema (strict) conformity
|
|
243
|
+
- [x] jmc: use exclusive options where appropriate
|
|
244
|
+
- [x] tests: check all models wrt to the meta model, once
|
|
245
|
+
- [x] static: remove pyright asserts from generated code
|
|
246
|
+
- [x] schema: warn when generating schema with strict options
|
|
247
|
+
- [x] pr: submit with _JSU_ as JSON Schema tool (export feature) (_PR 1636_)
|
|
248
|
+
- [x] static: add option to report where it fails (aka reasons)
|
|
249
|
+
- [x] static: fast vs slow with path and reasons (if rep is _None_)
|
|
250
|
+
- [x] static: update path
|
|
251
|
+
- [x] feature: --format yaml to show yaml instead of json
|
|
252
|
+
- [x] design: official (meta) model url: ~`https://models.json-model.org/...`~ vs `https://json-model.org/models/...`
|
|
253
|
+
- [x] static: optimize simple regex cases (from Blaze paper)
|
|
254
|
+
- [x] python: remove global list in JsonModel
|
|
255
|
+
- [x] python: remove all globals in Symbols and JsonModel
|
|
256
|
+
- [x] static: generate executable script with minimal main
|
|
257
|
+
- [x] jmc: add option `-J` to show json IR, set default to `-P` (preprocessed)
|
|
258
|
+
- [x] jmc: change default to `-ns` (unsorted json properties)
|
|
259
|
+
- [x] jmc: also use prettyprint options for yaml generation
|
|
260
|
+
- [x] static: add a `_` to the default prefix to separate exports
|
|
261
|
+
- [x] static: rename all internal stuff with a `_` prefix
|
|
262
|
+
- [x] python: refactor in optim analyze merge…
|
|
263
|
+
- [x] feature: warn when mixing loose/strict int/float
|
|
264
|
+
- [x] feature: implement `$UUID` predef
|
|
265
|
+
- [x] backend: remove `decl_` variants
|
|
266
|
+
- [x] feature: make static compiled exported defs accessible…
|
|
267
|
+
- [x] frontend: select named model with `--name name`
|
|
268
|
+
- [x] frontend: use `--list` to show available models
|
|
269
|
+
- [x] jmc: add option `--name` to control name of generated function
|
|
270
|
+
- [x] frontend: add `--version` or `-v` to show jmc version
|
|
271
|
+
- [x] backend: add free
|
|
272
|
+
- [x] backend: no path option generation in `Language`
|
|
273
|
+
- [x] c-backend: path previous and next, and back and forth scan
|
|
274
|
+
- [x] c-backend: add report collection with path
|
|
275
|
+
- [x] frontend: add option `-r` to collect report.
|
|
276
|
+
- [x] input: accept raw js, not just json with comments
|
|
277
|
+
- [x] c-backend: main API does not need to know about internal structs.
|
|
278
|
+
- [x] frontend: report init errors.
|
|
279
|
+
- [x] py-backend: fix nested if in inlined code generation.
|
|
280
|
+
- [x] c-backend: unique shortcut while sorting
|
|
281
|
+
- [x] c-backend: json anything comparison for sorting and searching
|
|
282
|
+
- [x] static: constant string and int enum
|
|
283
|
+
- [x] c-backend: unique for any
|
|
284
|
+
- [x] static: or implementation
|
|
285
|
+
- [x] static: object disjunction on str
|
|
286
|
+
- [x] static: support or constants, aka enum.
|
|
287
|
+
- [x] static: object disjunction on int, bool, float, null
|
|
288
|
+
- [x] jmc: allow value checking under `-X -F py`
|
|
289
|
+
- [x] api: load model from file, load model from string…
|
|
290
|
+
- [x] py-frontend: handle test vector files
|
|
291
|
+
- [x] c-frontend: handle test vector files
|
|
292
|
+
- [x] c-backend: separate headers and functions to allow compiling a support library.
|
|
293
|
+
- [x] backend: move runtime in a runtime directory.
|
|
294
|
+
- [x] backend: working c and py "$REGEX".
|
|
295
|
+
- [x] tests: check test vector files
|
|
296
|
+
- [x] py-backend: import runtime.
|
|
297
|
+
- [x] static: generate separate lib
|
|
298
|
+
- [x] backend: clarify runtime vs data.
|
|
299
|
+
- [x] c-backend: fix `-l` implementation.
|
|
300
|
+
- [x] all: remove dynamic compiler code, tests and doc.
|
|
301
|
+
- [x] tests: values with name field
|
|
302
|
+
- [x] static: xor code generation
|
|
303
|
+
- [x] c-backend: issue with "$xxx" properties, `char*` is not `json_t*` (`ex_08 ex_09`)
|
|
304
|
+
- [x] py-backend: improve url validation
|
|
305
|
+
- [x] frontent: add `-T 1000` to trigger measuring performance.
|
|
306
|
+
- [x] static: unique constraint
|
|
307
|
+
- [x] static: cmp constraint implementation
|
|
308
|
+
- [x] python: use local loose settings if appropriate (but not with inlining!)
|
|
309
|
+
- [x] tests: remove SO stuff
|
|
310
|
+
- [x] python: remove `static.py`
|
|
311
|
+
- [x] jmc: remove `-S`
|
|
312
|
+
- [x] doc: remove about S
|
|
313
|
+
- [x] optim: predef normalization and or/and included type cleanups
|
|
314
|
+
- [x] tests: parallelism with `pytest-xdist`
|
|
315
|
+
- [x] c-backend: heterogeneous enum (`enum_05`)
|
|
316
|
+
- [x] py-backend: unique for any
|
|
317
|
+
- [x] backend: fix `untype00` issue (c, py)
|
|
318
|
+
- [x] c-backend: simplify entry by moving parts to `json-model.c`
|
|
319
|
+
- [x] tests: remove `.x.`
|
|
320
|
+
- [x] tests: add `tmp_dir` fixture.
|
|
321
|
+
- [x] tests: improve compilation locking for parallel pytest.
|
|
322
|
+
- [x] tests: split modval directory for better parallelization (wip)
|
|
323
|
+
- [x] tests: refactor all tests with `pytest` to avoid SSD file delete/create cycles (wip)
|
|
324
|
+
- [x] project: switch version to beta.
|
|
325
|
+
- [x] tests: drop `fuzzy` name, re-test for stricter versions
|
|
326
|
+
- [x] tests: chunk tests in smaller directories to please xdist
|
|
327
|
+
- [x] jmc: add test vector mode with `--test-vector`
|
|
328
|
+
- [x] tests: fix `wip/obj_04` (double processing from `jmc` yielded to more substitions)
|
|
329
|
+
- [x] tests: fix `wip/openapi-310-models`
|
|
330
|
+
- [x] tests: optimized openapi-310-models should have fully removed schema stuff
|
|
331
|
+
- [x] static: optimize 1 must or may property case with a direct comparison
|
|
332
|
+
- [x] static: choose threshold for switching between few/may must/may props
|
|
333
|
+
- [x] static: reuse already generated may/must maps when possible (under `--map-share`)
|
|
334
|
+
- [x] static: ~use common must/may map with must/may boolean? maybe not?~
|
|
335
|
+
- [x] c-backend: fast `$REGEX` implementation based on re2 syntax
|
|
336
|
+
- [x] c-frontend: allow to switch between the C slow and fast `$REGEX` implementations
|
|
337
|
+
- [x] c-frontend: use `getopt_long` instead of `getopt`
|
|
338
|
+
- [x] static: reporting clean slate on or when one is found!
|
|
339
|
+
- [x] static: add option to skip reporting generation `--no-report`
|
|
340
|
+
- [x] frontend: improve performance measures with stdev and removing overheads
|
|
341
|
+
- [x] jmc: allow direct compilation with cc-like options?
|
|
342
|
+
- [x] static: report missing must props
|
|
343
|
+
- [x] jmc: rethink option usage for compilation
|
|
344
|
+
- [x] jmc: allow to pass actual compiler options?
|
|
345
|
+
- [x] static: disjunct could share identical may/must tabs between objects (optional)
|
|
346
|
+
- [x] c-backend: also prefix type name and extensions with `jm_`
|
|
347
|
+
- [x] static: use `[.]` for root in error messages
|
|
348
|
+
- [x] static: simplify unexpected prop message
|
|
349
|
+
- [x] jmc: generate executable python script
|
|
350
|
+
- [x] jmc: make `-O` the default, add `-nO` to disable.
|
|
351
|
+
- [x] frontend: align python and C pass/fail outputs
|
|
352
|
+
- [x] static: fix `untyped...` with `value_len` when type is unknown
|
|
353
|
+
- [x] static: fast mode, check that it returns as early as possible (or, xor, and, obj, arr)
|
|
354
|
+
- [x] backend: move python-specifics from `language.py` to `python.py`
|
|
355
|
+
- [x] backend: ~report which several xor succeeded? no, implicit with rejects~
|
|
356
|
+
- [x] tests: run with dynamic python
|
|
357
|
+
- [x] tests: run generated schema (partial)
|
|
358
|
+
- [x] schema: ~nearly always add explicit `"$schema"` property, nope, fixed in tests?~
|
|
359
|
+
- [x] schema: fix `untype00` schema
|
|
360
|
+
- [x] optim: detect non feasible constraints wrt values
|
|
361
|
+
- [x] optim: remove unfeasible `!=`
|
|
362
|
+
- [x] python: refactoring, drop `Validator` class
|
|
363
|
+
- [x] python: refactoring, remove `defines.py` and `validator.py`
|
|
364
|
+
- [x] design: regex recursion extension `"/^/($REGEX)/\$/X"`
|
|
365
|
+
- [x] design: more use-case related predefs: `"$EMAIL"`, `"$URI"`
|
|
366
|
+
- [x] c-backend: get rid of `mktime` for fast date validation
|
|
367
|
+
- [x] design: add `$EXREG' for JSON Model extended regex
|
|
368
|
+
- [x] c-backend: see [jansson](https://jansson.readthedocs.io/en/latest/), avoid cJSON
|
|
369
|
+
- [x] c-backend: predefs for $DATE, $URL, $REGEX
|
|
370
|
+
- [x] backend: report errors
|
|
371
|
+
- [x] python: cleanup ultimate model reliance on local defs
|
|
372
|
+
- [x] backend: switch all `Inst` functions to `Block` to simplify code concatenation
|
|
373
|
+
- [x] static: prioritize c for speed, js for usability
|
|
374
|
+
- [x] js-backend: fix unique for non scalars (still 0 === 0.0)
|
|
375
|
+
- [x] tests: move `FOO-check.out` to `FOO.check`
|
|
376
|
+
- [x] js-backend: allow to generate a module only, with `mjs`
|
|
377
|
+
- [x] py-backend: allow to generate a simple module only, with `mpy`
|
|
378
|
+
- [x] c-backend: allow to generate a simple object file only
|
|
379
|
+
- [x] command: rethink code/executable/module generation options
|
|
380
|
+
- [x] js-backend: add javascript backend and runtime and working tests
|
|
381
|
+
- [x] c-backend: add `qsort_r` code for Windows and MacOS (blind)
|
|
382
|
+
- [x] backend: add `path` and `rep` to str functions
|
|
383
|
+
- [x] tests: fix strange issue with `make check` in `mv-03`
|
|
384
|
+
- [x] docs: add a tutorial tour
|
|
385
|
+
- [x] js-backend: add official npm module on `npmjs`.
|
|
386
|
+
- [x] design: add `"$DATETIME"` and `"$TIME"`
|
|
387
|
+
- [x] command: regex engine selection
|
|
388
|
+
- [x] c-backend: add `re2` support
|
|
389
|
+
- [x] c-backend: default to `re2`
|
|
390
|
+
- [x] js-backend: add `re2` (backend, node only) support
|
|
391
|
+
- [x] command: allow `-I` and `-L` for C compilation
|
|
392
|
+
- [x] static: re optimize `^...` using starts with when possible (idea from blaze paper)
|
|
393
|
+
- [x] static: re optimize `...$` and `^...$`
|
|
394
|
+
- [x] pr: collect cloc about compiler (parts) and runtimes
|
|
395
|
+
- [x] design: allow merge to handle `$ANY` values on one side
|
|
396
|
+
- [x] design: import definitions with `<` in `%`
|
|
397
|
+
- [x] command: check loose option propagation
|
|
398
|
+
- [x] c-frontend: add support for `jsonl`
|
|
399
|
+
- [x] static: optimize open must/may prop checks by dropping loop
|
|
400
|
+
- [x] static: implement varlen
|
|
401
|
+
- [x] py-frontend: add support for `jsonl`
|
|
402
|
+
- [x] js-frontend: add support for `jsonl`
|
|
403
|
+
- [x] py-frontend: add specific `--jsonschema-benchmark` option
|
|
404
|
+
- [x] js-frontend: add specific `--jsonschema-benchmark` option
|
|
405
|
+
- [x] design: add more predefs such as `OBJECT` or `ANYOBJECT`, `ARRAY` or `ANYARRAY`? NO.
|
|
406
|
+
- [x] sql-backend: generate PL/pgSQL functions to validate JSONB data
|
|
407
|
+
- [x] sql-backend: add generic entry function
|
|
408
|
+
- [x] sql-backend: add testing capability
|
|
409
|
+
- [x] sql-backend: add necessary support function (nearly)
|
|
410
|
+
- [x] sql-backend: implement basic regex
|
|
411
|
+
- [x] tests: add sql to pytest
|
|
412
|
+
- [x] tests: parallelize sql checks in makefile
|
|
413
|
+
- [x] sql-backend: implement extended regex
|
|
414
|
+
- [x] tests: add sql.check to pytest
|
|
415
|
+
- [x] tests: parallelize sql checks in pytest
|
|
416
|
+
- [x] tuto: add PL/pgSQL entry
|
|
417
|
+
- [x] python: rerun type check (some ignore added, but a few fixes as well)
|
|
418
|
+
- [x] python: rerun style check (ruff, drop microsoft uncooperative flake8)
|
|
419
|
+
- [x] design: add import `<` with scalar
|
|
420
|
+
- [x] js: ~allow to run with nvm stable?~ nope, nvm is a shell function, must use path
|
|
421
|
+
- [x] sql-backend: reduce extension loading verbosity
|
|
422
|
+
- [x] model: warn on url-looking definitions
|
|
423
|
+
- [x] tests: improve meta model for constants, predefs and regex/X (`rwt/json-model.model.json`)
|
|
424
|
+
- [x] tests: fix test vector numbering to count actual tests, not items
|
|
425
|
+
- [x] schema: improve generation with some constraints
|
|
426
|
+
- [x] tests: fix `mv-0a/base-021.model.json` issue with C json-model
|
|
427
|
+
- [x] tuto: add further reading pointers in the conclusion
|
|
428
|
+
- [x] static: keep some model comments in generated code
|
|
429
|
+
- [x] schema: generate valid schema from JSON Model meta-model
|
|
430
|
+
- [x] python: fix internal checker on test cases
|
|
431
|
+
- [x] js-backend: warn about strict/loose
|
|
432
|
+
- [x] sql-backend: warn about strict/loose
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
## Design of JSON Model v2
|
|
2
|
+
|
|
3
|
+
## Ambition
|
|
4
|
+
|
|
5
|
+
- an intuitive and compact JSON syntax to describe JSON data
|
|
6
|
+
- take advantage of type inference as much as possible
|
|
7
|
+
- relevant to a wide range of use cases
|
|
8
|
+
- allow adapting a existing model with import and transformation
|
|
9
|
+
- very fast implementations through compiler optimizations, dynamic and static
|
|
10
|
+
- export to other syntax, eg JSON Schema.
|
|
11
|
+
|
|
12
|
+
## WIP
|
|
13
|
+
|
|
14
|
+
- integration of json-model extensions?
|
|
15
|
+
|
|
16
|
+
- could be a simplified version of JSON Schema vocabularies?
|
|
17
|
+
- can also be loaded through a reference?
|
|
18
|
+
- available characters
|
|
19
|
+
- json characters to avoid (?) by decreasing frequency: `" : , {} [] - .`
|
|
20
|
+
- used as keywords: `# $ @ ! = < > & | ^ +`…
|
|
21
|
+
- used as sentinels: `$ _ ? ! = /`…
|
|
22
|
+
- thus: `% ~ * / . ; ( ) ? `` -`…
|
|
23
|
+
|
|
24
|
+
- examples
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"~": "https://json-model.org/models/json-model-v2",
|
|
29
|
+
"$": {
|
|
30
|
+
"": "https://json-model.org/models/json-model-v2-form"
|
|
31
|
+
"Model": "$https://json-model.org/models/json-model-v2"
|
|
32
|
+
},
|
|
33
|
+
"%": {
|
|
34
|
+
"$Model#Elem.+.0": {
|
|
35
|
+
"*": { "?.readOnly": true }
|
|
36
|
+
},
|
|
37
|
+
"$Model#Or": {
|
|
38
|
+
"*": { "?.selector": { "|": [ "checkbox", "menu", "whatever" ] } }
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"@": "$Model"
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"$": {
|
|
48
|
+
"modelv2": "$https://models.json-model.org/modelv2"
|
|
49
|
+
},
|
|
50
|
+
"%": {
|
|
51
|
+
"#": "path to field to modify, change",
|
|
52
|
+
"$model2#Object": {
|
|
53
|
+
"*": { "?new-keyword": "$..." },
|
|
54
|
+
"/": [ "props", "to", "remove", "in", "target" ]
|
|
55
|
+
},
|
|
56
|
+
"$model2#Common": "replacement_model"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- NOTE we decided to avoid reusing `+ ~` for `* /`.
|
|
62
|
+
|
|
63
|
+
- localization with prefixed keywords: `: ,` (too many?), `*` noizy and ugly, `.` discreet and rare enough?
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"%": { ".or": "|", ".unique": "!" }
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Trafo
|
|
72
|
+
|
|
73
|
+
- how to import automatically all indirect models into the current name space?
|
|
74
|
+
|
|
75
|
+
`~ * / + - ! # @ < > , . ; : $ = _ `
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"~": "./my-model",
|
|
80
|
+
"$": {
|
|
81
|
+
"": "./myself",
|
|
82
|
+
"external": "$./other",
|
|
83
|
+
"???": [ "$external", ... ]
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
or is it a transformation?
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"%": {
|
|
93
|
+
"<": [ "$URL" ]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Arrays
|
|
99
|
+
|
|
100
|
+
- implement the _prefixItems_ semantics?
|
|
101
|
+
|
|
102
|
+
## Merge
|
|
103
|
+
|
|
104
|
+
- [x] merge allow to merge something / ANY by keeping stricter one (see ansible meta model)
|
|
105
|
+
|
|
106
|
+
## Usability use cases
|
|
107
|
+
|
|
108
|
+
- def only models are ok
|
|
109
|
+
|
|
110
|
+
- manage (related) models:
|
|
111
|
+
- in files
|
|
112
|
+
- in files in a directory
|
|
113
|
+
- through a URL
|
|
114
|
+
- inlined in source files
|
|
115
|
+
- tooling, file derivation
|
|
116
|
+
- how to manage model changes and file derivations depending on the output
|
|
117
|
+
- (easy) integration into the JS (npm) ecosystem?
|
|
118
|
+
- (easy) integration into the Python (pip) ecosystem?
|
|
119
|
+
- web development specific ecosystems: Flask, Django, express.js…
|
|
120
|
+
- derive/import JSON Model from an actual/existing data structure:
|
|
121
|
+
- how to import and use such definitions?
|
|
122
|
+
- non JSON format:
|
|
123
|
+
- yaml: for convenient data structure documentation
|
|
124
|
+
- js/ts: for convenient data structure documentation (i.e. JSON with comments)
|
|
125
|
+
- py: for convenient data structure documentation (?!)
|
|
126
|
+
- ORM, tables, pydantic, dataclass, python types…
|
|
127
|
+
- extensions: derive models for distinct usages?
|
|
128
|
+
- provide with default values for initialization
|
|
129
|
+
|
|
130
|
+
- rewrite: compare with dynamic reference JSON Schema use case.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# JSON Model How To …
|
|
2
|
+
|
|
3
|
+
## How to use JSON Model in my _Python_ project?
|
|
4
|
+
|
|
5
|
+
## How to use JSON Model in my _JavaScript_ project?
|
|
6
|
+
|
|
7
|
+
## How to use JSON Model in my _Postgres_ database?
|
|
8
|
+
|
|
9
|
+
1. install the `json_model` Postgres extension, from source _or_
|
|
10
|
+
from [pgxn](https://pgxn.org/dist/json_model/):
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
sudo make -C json_model/runtime install
|
|
14
|
+
sudo pgxn install json_model
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
2. compile a model to PL/pgSQL:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
jmc -o stuff.sql Stuff.model.sql
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
3. load the generated functions into your `stuff` database:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
psql -f stuff.sql stuff
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
4. check the root model (empty name) against a `JSONB` value:
|
|
30
|
+
|
|
31
|
+
```sql
|
|
32
|
+
SELECT check_model(JSONB '3.14', '', NULL); # TRUE or FALSE…
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## How to … ?
|
|
36
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# JSON Schema Integration
|
|
2
|
+
|
|
3
|
+
## Python Flask FSA
|
|
4
|
+
|
|
5
|
+
Maybe add keyword related extension mechanism:
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
@app.get("/foo", authz="OPEN", model="Name")
|
|
9
|
+
def get_foo():
|
|
10
|
+
return a_model_thing, 200
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Not very interesting: it is probably enough to only validate _incoming_ data and let the client
|
|
14
|
+
validate server outgoing data, or the database validate stored data.
|
|
15
|
+
|
|
16
|
+
For incoming data validation, this is already achieved with pydantic, so a pydantic export
|
|
17
|
+
would be enough?
|
|
18
|
+
|
|
19
|
+
## Python Script
|
|
20
|
+
|
|
21
|
+
- direct import and call of the check function?
|
|
22
|
+
|
|
23
|
+
## Python ORM
|
|
24
|
+
|
|
25
|
+
- SQLAlchemy
|
|
26
|
+
- Django
|
|
27
|
+
|
|
28
|
+
## JavaScript Client in Browser
|
|
29
|
+
|
|
30
|
+
- `fetch`
|
|
31
|
+
- `axios`
|
|
32
|
+
- `swr`
|
|
33
|
+
|
|
34
|
+
## JavaScript Server with Node
|
|
35
|
+
|
|
36
|
+
## Ruby on Rails
|
|
37
|
+
|
|
38
|
+
## Postgres JSON Data
|
|
39
|
+
|
|
40
|
+
- JS with `plv8` extension and some glue?
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
pgxnclient install plv8
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The glue is not obvious.
|
|
47
|
+
|
|
48
|
+
- plpython?
|
|
49
|
+
|
|
50
|
+
- PL/pgSQL: Generate a set of PL/pgSQL functions?
|
|
51
|
+
|
|
52
|
+
how to handle variable declaration with the code generator? `Block` is too simplistic for that.
|
|
53
|
+
possibly add a stupid prefix which is grep-ed when generating the final function?
|
|
54
|
+
|
|
55
|
+
## MongoDB JSON Data
|
|
56
|
+
|
|
57
|
+
- JSON Schema (bson) export?
|
|
58
|
+
- MongoDB validation extension, hook? _not found_
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
recursive-exclude tests *
|