json-model-compiler 2.0b1__tar.gz → 2.0b11__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 (193) hide show
  1. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/.gitignore +5 -0
  2. json_model_compiler-2.0b11/API.md +325 -0
  3. {json_model_compiler-2.0b1/site → json_model_compiler-2.0b11}/BACKLOG.md +167 -34
  4. json_model_compiler-2.0b11/DESIGN.md +35 -0
  5. json_model_compiler-2.0b11/DEV.md +24 -0
  6. json_model_compiler-2.0b11/DOC.md +23 -0
  7. json_model_compiler-2.0b11/HOWTO.md +298 -0
  8. json_model_compiler-2.0b11/Makefile +142 -0
  9. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/PKG-INFO +62 -79
  10. json_model_compiler-2.0b11/PUBS.md +66 -0
  11. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/README.md +57 -77
  12. json_model_compiler-2.0b11/SPEC.md +672 -0
  13. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/TUTO.md +189 -74
  14. json_model_compiler-2.0b11/about.sh +124 -0
  15. json_model_compiler-2.0b11/docker/.dockerignore +3 -0
  16. json_model_compiler-2.0b11/docker/.gitignore +1 -0
  17. json_model_compiler-2.0b11/docker/Dockerfile +107 -0
  18. json_model_compiler-2.0b11/docker/Makefile +61 -0
  19. json_model_compiler-2.0b11/docker/README.md +99 -0
  20. json_model_compiler-2.0b11/docker/jmc +26 -0
  21. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/README.md +12 -7
  22. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/analyze.py +2 -1
  23. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/clang.py +22 -16
  24. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/convert.py +2 -0
  25. json_model_compiler-2.0b11/json_model/data/java_free.java +8 -0
  26. json_model_compiler-2.0b11/json_model/data/java_init.java +13 -0
  27. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/javascript_foot.js +1 -0
  28. json_model_compiler-2.0b11/json_model/data/jmc.pod +320 -0
  29. json_model_compiler-2.0b11/json_model/data/perl_entry.pl +7 -0
  30. json_model_compiler-2.0b11/json_model/data/perl_exe.pl +1 -0
  31. json_model_compiler-2.0b11/json_model/data/perl_free.pl +8 -0
  32. json_model_compiler-2.0b11/json_model/data/perl_init.pl +12 -0
  33. json_model_compiler-2.0b11/json_model/data/perl_main.pl +6 -0
  34. json_model_compiler-2.0b11/json_model/data/perl_pkg.pl +9 -0
  35. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/python_main.py +1 -0
  36. json_model_compiler-2.0b11/json_model/export.py +196 -0
  37. json_model_compiler-2.0b11/json_model/java.py +437 -0
  38. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/javascript.py +6 -8
  39. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/language.py +53 -24
  40. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/model.py +25 -7
  41. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/objmerge.py +10 -2
  42. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/optim.py +48 -11
  43. json_model_compiler-2.0b11/json_model/perl.py +365 -0
  44. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/plpgsql.py +22 -7
  45. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/python.py +8 -9
  46. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/recurse.py +4 -4
  47. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/resolver.py +18 -6
  48. json_model_compiler-2.0b11/json_model/runtime/Makefile +17 -0
  49. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/runtime/__init__.py +1 -0
  50. json_model_compiler-2.0b11/json_model/runtime/c/Makefile +9 -0
  51. {json_model_compiler-2.0b1/json_model/runtime → json_model_compiler-2.0b11/json_model/runtime/c}/json-model.c +196 -31
  52. {json_model_compiler-2.0b1/json_model/runtime → json_model_compiler-2.0b11/json_model/runtime/c}/json-model.h +20 -0
  53. {json_model_compiler-2.0b1/json_model/runtime → json_model_compiler-2.0b11/json_model/runtime/c}/main.c +26 -15
  54. json_model_compiler-2.0b11/json_model/runtime/java/.gitignore +6 -0
  55. json_model_compiler-2.0b11/json_model/runtime/java/Makefile +65 -0
  56. json_model_compiler-2.0b11/json_model/runtime/java/README.md +18 -0
  57. json_model_compiler-2.0b11/json_model/runtime/java/env.bash +10 -0
  58. json_model_compiler-2.0b11/json_model/runtime/java/json_model/Checker.java +20 -0
  59. json_model_compiler-2.0b11/json_model/runtime/java/json_model/GSON.java +147 -0
  60. json_model_compiler-2.0b11/json_model/runtime/java/json_model/JSON.java +163 -0
  61. json_model_compiler-2.0b11/json_model/runtime/java/json_model/JSONP.java +181 -0
  62. json_model_compiler-2.0b11/json_model/runtime/java/json_model/Jackson.java +166 -0
  63. json_model_compiler-2.0b11/json_model/runtime/java/json_model/Main.java +369 -0
  64. json_model_compiler-2.0b11/json_model/runtime/java/json_model/ModelChecker.java +60 -0
  65. json_model_compiler-2.0b11/json_model/runtime/java/json_model/Path.java +54 -0
  66. json_model_compiler-2.0b11/json_model/runtime/java/json_model/Report.java +76 -0
  67. json_model_compiler-2.0b11/json_model/runtime/java/json_model/Runtime.java +350 -0
  68. json_model_compiler-2.0b11/json_model/runtime/java/pom.xml +142 -0
  69. {json_model_compiler-2.0b1/js_runtime → json_model_compiler-2.0b11/json_model/runtime/js}/index.js +15 -1
  70. {json_model_compiler-2.0b1/js_runtime → json_model_compiler-2.0b11/json_model/runtime/js}/main.js +48 -36
  71. {json_model_compiler-2.0b1/js_runtime → json_model_compiler-2.0b11/json_model/runtime/js}/package.json +1 -1
  72. json_model_compiler-2.0b11/json_model/runtime/pl/.gitignore +18 -0
  73. json_model_compiler-2.0b11/json_model/runtime/pl/Changes +6 -0
  74. json_model_compiler-2.0b11/json_model/runtime/pl/LICENSE +133 -0
  75. json_model_compiler-2.0b11/json_model/runtime/pl/MANIFEST +10 -0
  76. json_model_compiler-2.0b11/json_model/runtime/pl/Makefile.PL +49 -0
  77. json_model_compiler-2.0b11/json_model/runtime/pl/README +48 -0
  78. json_model_compiler-2.0b11/json_model/runtime/pl/ignore.txt +19 -0
  79. json_model_compiler-2.0b11/json_model/runtime/pl/lib/JSON/JsonModel.pm +787 -0
  80. json_model_compiler-2.0b11/json_model/runtime/pl/t/00-load.t +13 -0
  81. json_model_compiler-2.0b11/json_model/runtime/pl/t/manifest.t +15 -0
  82. json_model_compiler-2.0b11/json_model/runtime/pl/t/pod-coverage.t +24 -0
  83. json_model_compiler-2.0b11/json_model/runtime/pl/t/pod.t +16 -0
  84. json_model_compiler-2.0b11/json_model/runtime/pl/xt/boilerplate.t +54 -0
  85. {json_model_compiler-2.0b1/json_model/runtime → json_model_compiler-2.0b11/json_model/runtime/sql}/META.json +2 -2
  86. {json_model_compiler-2.0b1/json_model/runtime → json_model_compiler-2.0b11/json_model/runtime/sql}/Makefile +10 -4
  87. {json_model_compiler-2.0b1/json_model/runtime → json_model_compiler-2.0b11/json_model/runtime/sql}/json_model--2.0.sql +16 -0
  88. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/runtime/support.py +31 -8
  89. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/script.py +217 -82
  90. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/url_cache.py +14 -3
  91. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/utils.py +35 -4
  92. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/xstatic.py +40 -16
  93. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model_compiler.egg-info/PKG-INFO +62 -79
  94. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model_compiler.egg-info/SOURCES.txt +77 -15
  95. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/ansiblelint-meta.model.json +2 -1
  96. json_model_compiler-2.0b11/models/everything.model.json +200 -0
  97. json_model_compiler-2.0b11/models/geo-easy.model.json +74 -0
  98. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/geo.model.json +3 -1
  99. json_model_compiler-2.0b11/models/json-model-moschin.model.json +19 -0
  100. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-model-v2.model.json +17 -11
  101. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-model.model.json +17 -11
  102. json_model_compiler-2.0b11/models/json-schema-draft-04-mongodb.model.json +29 -0
  103. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-04.model.json +0 -1
  104. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-06.model.json +0 -1
  105. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-07.model.json +0 -1
  106. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/lazygit.model.json +2 -1
  107. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/openapi-311.model.json +2 -1
  108. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/person.model.json +1 -0
  109. json_model_compiler-2.0b11/models/person2.model.json +7 -0
  110. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/pgxn.model.json +2 -2
  111. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/package.json +4 -2
  112. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/pyproject.toml +5 -2
  113. json_model_compiler-2.0b11/site/API.md +325 -0
  114. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11/site}/BACKLOG.md +167 -34
  115. json_model_compiler-2.0b11/site/DOC.md +23 -0
  116. json_model_compiler-2.0b11/site/DOCKER.md +99 -0
  117. json_model_compiler-2.0b11/site/HOWTO.md +298 -0
  118. json_model_compiler-2.0b11/site/PUBS.md +66 -0
  119. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/site/README.md +57 -77
  120. json_model_compiler-2.0b11/site/SPEC.md +672 -0
  121. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/site/TUTO.md +189 -74
  122. json_model_compiler-2.0b11/site/cover.md +7 -0
  123. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/site/index.html +13 -5
  124. json_model_compiler-2.0b1/DESIGN-v2.md +0 -130
  125. json_model_compiler-2.0b1/HOWTO.md +0 -36
  126. json_model_compiler-2.0b1/Makefile +0 -82
  127. json_model_compiler-2.0b1/jmc.md +0 -109
  128. json_model_compiler-2.0b1/models/json-model-tight.model.json +0 -54
  129. json_model_compiler-2.0b1/models/person2.model.json +0 -6
  130. json_model_compiler-2.0b1/site/HOWTO.md +0 -36
  131. json_model_compiler-2.0b1/site/jmc.md +0 -109
  132. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/.gitmodules +0 -0
  133. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/INTEGRATION.md +0 -0
  134. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/MANIFEST.in +0 -0
  135. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/__init__.py +0 -0
  136. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/clang_entry.c +0 -0
  137. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/clang_free.c +0 -0
  138. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/clang_init.c +0 -0
  139. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/clang_pcre2_fun.c +0 -0
  140. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/clang_re2_fun.c +0 -0
  141. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/javascript_exe.js +0 -0
  142. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/javascript_free.js +0 -0
  143. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/javascript_head.js +0 -0
  144. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/javascript_init.js +0 -0
  145. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/javascript_main.js +0 -0
  146. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/plpgsql_entry.sql +0 -0
  147. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/python_entry.py +0 -0
  148. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/python_exe.py +0 -0
  149. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/python_free.py +0 -0
  150. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/data/python_init.py +0 -0
  151. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/mtypes.py +0 -0
  152. {json_model_compiler-2.0b1/js_runtime → json_model_compiler-2.0b11/json_model/runtime/js}/README.md +0 -0
  153. {json_model_compiler-2.0b1/json_model/runtime → json_model_compiler-2.0b11/json_model/runtime/sql}/json_model.control +0 -0
  154. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model/runtime/types.py +0 -0
  155. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model_compiler.egg-info/dependency_links.txt +0 -0
  156. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model_compiler.egg-info/entry_points.txt +0 -0
  157. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model_compiler.egg-info/requires.txt +0 -0
  158. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/json_model_compiler.egg-info/top_level.txt +0 -0
  159. /json_model_compiler-2.0b1/models/json-mode-latest.model.json → /json_model_compiler-2.0b11/models/json-model-latest.model.json +0 -0
  160. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-model-no-merge.model.json +0 -0
  161. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-model-v1.model.json +0 -0
  162. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-model-v2-en.model.json +0 -0
  163. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-01-fuzzy.model.json +0 -0
  164. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-01-nesting.model.json +0 -0
  165. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-01.model.json +0 -0
  166. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-02-fuzzy.model.json +0 -0
  167. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-02-nesting.model.json +0 -0
  168. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-02.model.json +0 -0
  169. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-03-fuzzy.model.json +0 -0
  170. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-03-nesting.model.json +0 -0
  171. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-03.model.json +0 -0
  172. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-04-fuzzy.model.json +0 -0
  173. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-04-nesting.model.json +0 -0
  174. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-06-fuzzy.model.json +0 -0
  175. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-07-fuzzy.model.json +0 -0
  176. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-2019-09-fuzzy.model.json +0 -0
  177. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-2019-09.model.json +0 -0
  178. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-2020-12-fuzzy.model.json +0 -0
  179. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-2020-12-tight.model.json +0 -0
  180. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-2020-12.model.json +0 -0
  181. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-next-fuzzy.model.json +0 -0
  182. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-next.model.json +0 -0
  183. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-tight.model.json +0 -0
  184. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-tighter-loose.model.json +0 -0
  185. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-draft-tighter.model.json +0 -0
  186. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/json-schema-linter.model.json +0 -0
  187. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/jsound.model.json +0 -0
  188. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/l10n.model.json +0 -0
  189. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/openapi-311-fuzzy.model.json +0 -0
  190. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/models/openapi-311-models.model.json +0 -0
  191. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/setup.cfg +0 -0
  192. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/site/favicon.ico +0 -0
  193. {json_model_compiler-2.0b1 → json_model_compiler-2.0b11}/site/json_logo.svg +0 -0
@@ -6,7 +6,12 @@ dist
6
6
  *.swp
7
7
  *.o
8
8
  *.out
9
+ *.class
9
10
  package-lock.json
10
11
  node_modules/
11
12
  *.values.csv
12
13
  jmc.1
14
+ site/MODELS.md
15
+ site/JMC.md
16
+ site/ABOUT.md
17
+ local.mk
@@ -0,0 +1,325 @@
1
+ # JSON Model APIs
2
+
3
+ Each JSON Model compiler language target presents a similar API to check whether
4
+ a JSON value validates against a model.
5
+
6
+ ## APIs Common Behavior
7
+
8
+ Most generated functions are prefixed with `check_model`.
9
+ The prefix may be changed with compiler option `--entry`.
10
+ When appropriate, compiler option `--package` allows to generate a module inside
11
+ a particular namespace for the language.
12
+ Most language API have a initialization and cleanup function for managing internal data structures.
13
+
14
+ The following illustrations assume that the `jmc` compiler is available and a `Person.model.json`
15
+ file containing this model:
16
+
17
+ ```json
18
+ {
19
+ "#": "Model for a person",
20
+ "$": {
21
+ "Name": "/^\\w+([-' ]\\w+)*$/",
22
+ "Person": {
23
+ "name": "$Name",
24
+ "birth": "$DATE",
25
+ "?friends": [ "$Name" ]
26
+ }
27
+ },
28
+ "@": "$Person"
29
+ }
30
+ ```
31
+
32
+ ## Python Static API
33
+
34
+ Model compilation to Python generates either a module or a python script,
35
+ which is the same as the module plus an added `main`.
36
+
37
+ This generated module exposes 4 useful functions:
38
+
39
+ - `check_model_init()`: initialize internal model checking data structures,
40
+ must be called **before** invoking `check_model`.
41
+ - `check_model(value, model, report) -> bool`:
42
+ - check JSON _value_ (eg loaded with the `json` module) against model named _model_.
43
+ - append rejection information to _report_, use _None_ for skipping reporting.
44
+ - `check_model_fun(model) -> CheckFun`:
45
+ - return the lower level function to check the model named _model_.
46
+ - its signature is `fun(value, path, report) -> bool`:
47
+ the second argument is used for keeping track of the JSON path when walking through _value_;
48
+ use _None_ for both path and report to skip reporting;
49
+ use _[]_ for path and `report = []` for gathering the report.
50
+ - the report is a list of tuples with the explanation for each rejections, and an associated path.
51
+ - `check_model_free()`: cleanup internal model checking data structures.
52
+
53
+ The generated functions depend on `json_model.runtime` which is part of the
54
+ [`json-model-compiler` Python package](https://pypi.org/project/json-model-compiler/).
55
+
56
+ For instance, generate a Python module:
57
+
58
+ ```sh
59
+ jmc -o person.py --module Person
60
+ ```
61
+
62
+ Then use it from your code:
63
+
64
+ ```python
65
+ import person # adjust depending on where the generated module is stored
66
+
67
+ person.check_model_init()
68
+ print("hobbes is a person:", person.check_model({"name": "Hobbes", "birth": "2020-07-29"}))
69
+ person.check_model_free()
70
+ ```
71
+
72
+ ## Python Dynamic API
73
+
74
+ As the JSON Model compiler is written in Python, it can be invoked directly for generating
75
+ a validation function.
76
+
77
+ Currently, two functions are available:
78
+
79
+ - `model_checker_from_json`: generate a model from a JSON value which must be a valid model.
80
+
81
+ This function expects a Python JSON value, eg loaded with `json` module, as a first parameter.
82
+ - `model_checker_from_url`: generate a model from a JSON value loaded from a URL.
83
+
84
+ This function expects a URL as a first parameter, which should dowload a JSON model possibly
85
+ as JSON or YAML.
86
+
87
+ The following named parameters are available to both functions:
88
+
89
+ - `auto`: boolean, whether to automatically map url to local path, default is _False_;
90
+ this feature is mostly for testing.
91
+ - `debug`: integer, debug level, default is _0_ for no debug.
92
+ - `resolver`: instance of Resolver class to load models from URLs.
93
+ - `loose_int`: boolean, whether integers a loose, eg `1.0` can be considered an int.
94
+ - `loose_float`: boolean, whether floats are loose, eg `42` can be considered a float.
95
+
96
+ To create a custom `Resolver` instance, use `json_model.resolver.Resolver` with the following arguments:
97
+
98
+ - `cache_dir`: string, where to store downloaded models, default is `$HOME/cache/json-model`.
99
+ - `maps`: dict, mapping urls to local directories, where to retrieve models, default is empty.
100
+ - `allow_duplicates`: boolean, whether to allow duplicated property names in an object.
101
+ - `cache_ignore`: boolean, whether not use a cache.
102
+
103
+ If not provided, a resolver is created based on defaults.
104
+
105
+ For instance, with the `json-model-compiler` Python package installed:
106
+
107
+ ```python
108
+ import json_model as jm
109
+
110
+ is_person = jm.model_checker_from_url("./Person.model.json")
111
+ print("hobbes is a person:", is_person({"name": "Hobbes", "birth": "2020-07-29"}))
112
+ ```
113
+
114
+ ## JavaScript API
115
+
116
+ Model compilation to JavaScript generates either a module (`.mjs`) or a node script (`.js`),
117
+ which is the same as the module plus an added `main`.
118
+
119
+ This generated module exposes 3 useful functions:
120
+
121
+ - `check_model_init()`: initialize internal model checking data structures,
122
+ must be called **before** invoking `check_model`.
123
+ - `check_model(value, model, report)`:
124
+ - check JSON _value_ (eg loaded with the `json` module) against model named _model_.
125
+ - append rejection information to _report_, use _null_ for skipping reporting.
126
+ - `check_model_free()`: cleanup internal model checking data structures.
127
+
128
+ The module also contains a `check_model_map` map of model names to check functions:
129
+
130
+ - its signature is `fun(value, path, report)`, and it returns a boolean:
131
+ the second argument is used for keeping track of the JSON path when walking through _value_;
132
+ use _null_ for both path and report to skip reporting;
133
+ use _[]_ for path and `report = []` for actually gathering a rejection report.
134
+ - the report is a list of tuples with the explanation for each rejections, and an associated path.
135
+
136
+ The generated functions depend on
137
+ the [`json_model_runtime`](https://www.npmjs.com/package/json_model_runtime) npm package
138
+ which must be available in your js environment.
139
+
140
+ For instance, generate a JavaScript module:
141
+
142
+ ```sh
143
+ jmc --loose -o person.mjs Person
144
+ ```
145
+
146
+ Then use it from your code, for instance with `node`:
147
+
148
+ ```js
149
+ #! /bin/env node
150
+ import { check_model_init, check_model, check_model_free } from "./person.mjs"
151
+
152
+ check_model_init()
153
+ console.log(`hobbes is a person: ${check_model({name: "Hobbes", birth: "2020-07-29"}, '', null)}`)
154
+ check_model_free()
155
+ ```
156
+
157
+ ## C API
158
+
159
+ Model compilation to C generates source code (`.c`), an object file (`.o`) or
160
+ an executable (`.out`).
161
+
162
+ This generated code exposes 4 useful functions:
163
+
164
+ ```c
165
+ #include <json-model.h>
166
+ extern const char *check_model_init(void);
167
+ extern bool check_model(const json_t *, const char *, bool *, char **);
168
+ extern void check_model_free(void);
169
+ extern jm_check_fun_t check_model_map(const char *);
170
+ ```
171
+
172
+ - `check_model_init`: initialize internal model checking data structures,
173
+ must be called **before** invoking `check_model`.
174
+ It returns an error string if the initialization failed (eg a bad regex).
175
+ - `check_model(value, model, error, msg)`:
176
+ - check JSON _value_ against model named _model_.
177
+ - tells whether there was some error (eg non existing name), and return a string for reporting.
178
+ - if `msg` is _NULL_, there is no reporting.
179
+ - `check_model_free`: cleanup internal model checking data structures.
180
+ - `check_model_map`: returns the lower-level function to check a `json_t *` value for a model,
181
+ with a `jm_path_t *` and `jm_report_t *` as additional parameters.
182
+ This function returns `NULL` if the model name is unknown.
183
+
184
+ The generated functions depend on a specific C runtime library,
185
+ plus either `cre2` (re2 wrapper for C) or `pcre2` as a regex engine, and
186
+ Jansson for managing JSON values, which must be compiled and installed.
187
+
188
+ For instance, generate a C object module:
189
+
190
+ ```sh
191
+ jmc -o person.o Person
192
+ ```
193
+
194
+ Then use it from your code:
195
+
196
+ ```c
197
+ // see "json_model/runtime/c/main.c"
198
+ ```
199
+
200
+ ## PL/pgSQL API
201
+
202
+ Model compilation to PL/pgSQL generates source code (`.sql`) to be loaded into a
203
+ Postgres database.
204
+
205
+ This generated code exposes one useful function `check_model(value, model, NULL)`,
206
+ to check JSONB _value_ against model named _model_.
207
+
208
+ The generated function depends on Postgres extension `json_model`, which must be
209
+ installed from sources or pgxn (see [HowTo](HOWTO#-use-json-model-in-my-postgres-database)).
210
+
211
+ For instance, generate the PL/pgSQL script and load it:
212
+
213
+ ```sh
214
+ jmc --loose -o person.sql Person
215
+ createdb jm_test
216
+ psql -f person.sql jm_test
217
+ ```
218
+
219
+ Use it, for instance for checking a JSON value integrity:
220
+
221
+ ```sql
222
+ CREATE TABLE SomeOne(
223
+ sid SERIAL8 PRIMARY KEY,
224
+ data JSONB NOT NULL CHECK (check_model(data, '', NULL))
225
+ );
226
+ CREATE UNIQUE INDEX SomeOne_Name ON SomeOne ((data->>'name'));
227
+
228
+ INSERT INTO SomeOne(data) VALUES ('{"name": "Hobbes", "birth": "2020-07-29"}'); -- pass
229
+ INSERT INTO SomeOne(data) VALUES ('{"name": "Pi", "birth": "1592-04-31"}'); -- fail
230
+
231
+ SELECT 'hobbes is a person' AS test, check_model(data, '', NULL)
232
+ FROM SomeOne WHERE data->>'name' = 'Hobbes';
233
+ ```
234
+
235
+ ## Perl API
236
+
237
+ Model compilation to Perl generates a module (`.pm`) or a script (`.pl`),
238
+ which is the same but with a `main` function.
239
+ Perl does not support for strict numbers.
240
+
241
+ This generated code exports 4 useful functions:
242
+
243
+ - `check_model_init`: initialize internal model checking data structures,
244
+ must be called **before** invoking `check_model`.
245
+ - `check_model($value, $model, undef)`:
246
+ check JSON _value_ against model named _model_.
247
+ - `check_model_free`: cleanup internal model checking data structures.
248
+ - `check_model_map`: a hash from model names to the lower-level function to check a value,
249
+ plus two parameters which must be `undef` for now.
250
+
251
+ The generated functions and runtime depends in `JSON::JsonModel`, `re::engine::RE2`,
252
+ `JSON::MaybeXS` for JSON.
253
+
254
+ For instance, generate a Perl module:
255
+
256
+ ```sh
257
+ jmc --loose -o Person.pm Person
258
+ ```
259
+
260
+ Then use it from your Perl code:
261
+
262
+ ```perl
263
+ #! /bin/env perl
264
+
265
+ use strict;
266
+ use warnings;
267
+ use Person;
268
+ use JSON::MaybeXS;
269
+
270
+ check_model_init();
271
+ my $hobbes = decode_json('{"name": "Hobbes", "birth": "2020-07-29"}');
272
+ print "hobbes is a person: ", check_model($hobbes, "", undef), "\n";
273
+ check_model_free();
274
+ ```
275
+
276
+ ## Java API
277
+
278
+ Model compilation to Java generates a class source (`.java`) or a compile class (`.class`).
279
+ The generate class includes a `main` for testing.
280
+
281
+ The generated class implements `ModelChecker`, which provides 4 useful methods:
282
+
283
+ - `void init(JSON)`: initialize internal model checking data structures, in particular
284
+ it provides the wrapper instance around the expected JSON library, see below.
285
+ - `Checker get(model)`: returns a checker instance which can be called:
286
+ The signature is `call(Object json, Path path, Report report);` for reporting or
287
+ `call(Object o)` (no reporting).
288
+ - `void free()`: cleanup internal model checking data structures.
289
+ - `Set<String> models()`: return all available model names.
290
+
291
+ The generated class depends in the `json_model` Java runtime, and must be initialized with
292
+ a `JSON` object to abstract the underlying JSON library.
293
+ Currently, three JSON libraries are supported: **GSON**, **Jackson**
294
+ and **JSONP** (tested with implementations **Johnzon** and **Joy**).
295
+
296
+ For instance, generate a Java source class:
297
+
298
+ ```sh
299
+ jmc -o Person.java Person
300
+ ```
301
+
302
+ Then use it from your Java code, eg in the same directory:
303
+
304
+ ```java
305
+ import json_model.*;
306
+
307
+ public class api_java {
308
+ static public void main(String[] args) throws JSON.Exception {
309
+ JSON json = new GSON();
310
+ ModelChecker person = new Person();
311
+ person.init(json);
312
+ Object hobbes = json.fromJSON("{\"name\": \"Hobbes\", \"birth\": \"2020-07-29\"}");
313
+ System.out.println("hobbes is a person: " + person.get("").call(hobbes));
314
+ }
315
+ }
316
+ ```
317
+
318
+ ```sh
319
+ javac api_java.java
320
+ java api_java # yes!
321
+ ```
322
+
323
+ ## Web API
324
+
325
+ :warning: :construction_worker: :construction:
@@ -2,38 +2,88 @@
2
2
 
3
3
  ## Current Tasks
4
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
5
+ - [x] pr: howto entry about python dyn code
6
+ - [x] pr: add about project page which include some stats
7
+ - [x] pr: howto entry about python projects
8
+ - [x] pr: restructure web site, avoid some duplication
9
+ - [x] pr: python static api
10
+ - [x] pr: python dynamic api
11
+ - [x] pr: js api
12
+ - [x] pr: c api
13
+ - [x] tests: fix generated json model schema test by switching to jschon
14
+ - [x] pr: plpgsql api
15
+ - [x] pr: perl api
16
+ - [x] pr: java api
17
+ - [x] pr: js howto
18
+ - [x] c-backend: add inlining and branch hints
19
+ - [x] c-frontend: fix --version display
20
+ - [x] py-frontend: fix line display for jsonl and test vectors
21
+ - [x] java-frontend: improve check interface and calls
22
+ - [x] js-frontend: fix line numbering for jsonl
23
+ - [x] py-frontend: fix line numbering for jsonl
24
+ - [x] js-frontend: do several iterations to measure the loop overhead
25
+ - [ ] python: fix venv installation issue with `pl/JSON` directory?
26
+ - [ ] tests: fix sql test errors from `Makefile`
27
+ - [ ] pr: web api
28
+ - [ ] pr: remove wip cover page from web site
29
+ - [ ] tests: fix test with generated json model meta schema
30
+ - [ ] java: joy/johnzon bugs `mv-16/or_0b` JSONP, 100E99 <> 10E100; other JSONP issues, maybe int/float
31
+ - [ ] tests: test generated JSON schema with test vectors.
32
+ - [ ] pr: write `optimizations.model.json` for illustration
33
+ - [ ] pr: write `transformation.model.json` for illustration
34
+ - [ ] pr: sync version number for **all** published parts for _2.0_ release
35
+ - [ ] design: review `$URI` and other predefs
36
+ - [ ] design: transformation rename, `~` with a map? move path to path? eg mandatory to optional?
37
+ - [ ] design: add predefs for `$UUIDx`…
38
+ - [ ] predefs: implement `$I32 $I64 $U32 $U64`
39
+ - [ ] pr: tuto add perl and java environment directives? dependencies?
40
+ - [ ] export: improve pydantic, do not generate bad fields (dash and other chars)
41
+ - [ ] test: some pydantic exports? imports?
42
+ - [ ] pr: submit jsonschema-benchmark java PR
43
+ - [ ] pr: submit jsonschema-benchmark PL/pgSQL PR
44
+ - [ ] frontends: reject json with duplicated props
45
+ - [ ] pr: howto entry about javascript projects/code
46
+ - [ ] pr: howto entry about C executable/code
47
+ - [ ] api: web interface with caching and security
48
+ - [ ] c-backend: header file for generated code?
49
+ - [ ] tests: perl _uninitialized value $tag_0 in hash element at `./mv-18/dis_01.pl:171._
50
+
51
+ ## Re Do
52
+
53
+ - [ ] pr: publish web page
54
+ - [ ] pr: publish python jmc package
55
+ - [ ] pr: publish js runtime package
56
+ - [ ] pr: publish pgxn package
57
+ - [ ] pr: publish docker image
58
+ - [ ] pr: publish perl package
59
+ - [ ] pr: publish java package
60
+ - [ ] pr: check jsonschema-benchmark integration
61
+ - [ ] pr: renew domain
62
+
63
+ ## To Do
64
+
65
+ - [ ] pr: add docker compose for postgres testing?
16
66
  - [ ] schema: inline external reference to generate valid schemas
17
- - [ ] pr: provide a docker
18
- - [ ] design: compile exreg to regex when possible
67
+ - [ ] xstatic: use threshold limit for cset as well
68
+ - [ ] xstatic: any array, skip empty code
69
+ - [ ] backend: add check constraint variants per constant type?
70
+ - [ ] xstatic: compile exreg to regex when possible
19
71
  - [ ] xstatic: add option support to property regex?
20
- - [ ] design: allow comments starting with `#`, not just `#`?
21
72
  - [ ] optim: simplify float constraints
22
- - [ ] pr: add documentation page
23
- - [ ] pr: add reference / spec page
24
73
  - [ ] command: add bash completion
25
74
  - [ ] python: separate python interface in some file
26
75
  - [ ] python: check python interface consistency
27
76
  - [ ] tests: reorganize tests cases in smaller thematic directories
28
77
  - [ ] tests: review allowed exceptions on schemas
29
78
  - [ ] model: fix rw issue in `openapi-311-fuzzy`
79
+ - [ ] pl-backend: fix reporting
30
80
  - [ ] sql-backend: fix generated code under `--reporting`
31
- - [ ] design: add predefs for `$UUIDx`…
32
81
  - [ ] js-backend: cleanup map and set
33
82
  - [ ] js-backend: `let` vs `var` consistency?
34
83
  - [ ] doc: document `re2` support for C
35
84
  - [ ] design: rewrite reuse path? rather force defs?
36
85
  - [ ] tests: with multiple regex engine
86
+ - [ ] tests: with multiple java json libs
37
87
  - [ ] use: js/ts type export?
38
88
  - [ ] use: py type dataclass/pydantic export?
39
89
  - [ ] use: test with corrector? ref? kiva?
@@ -45,7 +95,7 @@
45
95
  - [ ] ts-backend: js sharing?
46
96
  - [ ] optim: allow more substitutions _after_ transformations? when/where to trigger optims?
47
97
  - [ ] py-backend: heterogeneous enum (`enum_05`) improved implementation with `ConstSet`
48
- - [ ] py-backend: heterogeneous disjunction is `ConstMap`?
98
+ - [ ] py-backend: heterogeneous disjunction with `ConstMap`?
49
99
  - [ ] py-backend: unique for scalars (`set` only works for str)
50
100
  - [ ] c-backend: optimize unique for scalar types using `constant_t`
51
101
  - [ ] c-backend: remove path build under no reporting code gen
@@ -60,28 +110,20 @@
60
110
  - [ ] design: add `$URI-REF` or similar? `$PATH`?
61
111
  - [ ] c-backend: add reporting to predef failures?
62
112
  - [ ] 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?
113
+ - [ ] backend: what about a specialize IR [Blaze](https://arxiv.org/abs/2503.02770)?
65
114
  - [ ] tests: put generated exe in `/dev/shm` instead of locally from `Makefile`?
66
115
  - [ ] static: improve constraint failing message (length, unique…)
67
116
  - [ ] schema: inline external references to generate working schemas in more cases? (openapi-311)
68
117
  - [ ] mongodb-backend: generate bson stuff, as an option to schema generation?
69
118
  - [ ] php-backend: should it stoop so low?
70
119
  - [ ] perf: geo, ansible meta, openapi
71
- - [ ] python: refactor preproc vs compile vs codegen…
72
120
  - [ ] c-backend: multithreading? one one value??
73
121
  - [ ] 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
-
122
+ - [ ] pl-backend: run perltidy?
123
+ - [ ] docker: improve caching/no-caching of some commands (eg force weekly rebuild?).
124
+ - [ ] jsu-model: generate `"#.title"` and others to keep all schema docs
125
+ - [ ] py-backend: package independent runtime?
126
+ - [ ] command: improve cache to keep track of urls?
85
127
  - [ ] project: establish priority
86
128
  - [ ] frontend: accept raw sequence of values? list of values?
87
129
  - [ ] project: improve backlog management with thematic sections
@@ -181,7 +223,6 @@
181
223
  - [ ] rust-backend: see [json crate](https://docs.rs/json/latest/json/).
182
224
  - [ ] cpp-backend: see [json](https://github.com/nlohmann/json) and `re2`. json lib popularity?
183
225
  - [ ] cpp-backend: also see [simdjson](https://github.com/simdjson/simdjson)?
184
- - [ ] java-backend: see [jackson](https://github.com/FasterXML/jackson).
185
226
  - [ ] kotlin-backend: see [serialization](https://kotlinlang.org/docs/serialization.html).
186
227
  - [ ] go-backend: encoding/json vs various faster replacements…
187
228
  - [ ] ruby-backend: for rails people?
@@ -382,7 +423,7 @@
382
423
  - [x] backend: add `path` and `rep` to str functions
383
424
  - [x] tests: fix strange issue with `make check` in `mv-03`
384
425
  - [x] docs: add a tutorial tour
385
- - [x] js-backend: add official npm module on `npmjs`.
426
+ - [x] js-backend: add official [npm module](https://www.npmjs.com/package/json_model_runtime) on `npmjs`.
386
427
  - [x] design: add `"$DATETIME"` and `"$TIME"`
387
428
  - [x] command: regex engine selection
388
429
  - [x] c-backend: add `re2` support
@@ -430,3 +471,95 @@
430
471
  - [x] python: fix internal checker on test cases
431
472
  - [x] js-backend: warn about strict/loose
432
473
  - [x] sql-backend: warn about strict/loose
474
+ - [x] sql-backend: package support as an extension
475
+ - [x] pr: register `json-model.org` domain
476
+ - [x] doc: bootstrap jmc manpage with pandoc
477
+ - [x] pr: setup official http/https web page
478
+ - [x] pr: improve official web page with docsify
479
+ - [x] optim: simplify int constraints
480
+ - [x] optim: simplify some property regex
481
+ - [x] model: add `pgxn` model
482
+ - [x] pr: register as an [official pgxs extension](https://pgxn.org/dist/json_model/).
483
+ - [x] doc: complete jmc manpage
484
+ - [x] pr: publish as a [python package](https://pypi.org/project/json-model-compiler/)
485
+ - [x] pr: howto entry about installation
486
+ - [x] pr: bootstrap spec
487
+ - [x] pr: bootstrap doc
488
+ - [x] pr: bootstrap api
489
+ - [x] pr: add cover page
490
+ - [x] pr: add front page to `models`
491
+ - [x] pr: fix http requests without `.model.json` suffix (cri conf)
492
+ - [x] pr: provide a non-root docker
493
+ - [x] command: add --static compilation option to avoid dependencies?
494
+ - [x] pr: publish the docker image `zx80/jmc:2.0b1`
495
+ - [x] pr: use docker for tuto
496
+ - [x] docker: allow to execute stuff inside the docker
497
+ - [x] pl-backend: add a Perl backend
498
+ - [x] tests: add pl tests
499
+ - [x] backends: generate a short version string for internal tests
500
+ - [x] tests: fix `test_models_pl`
501
+ - [x] command: reject models and values with duplicated props by default
502
+ - [x] pr: add pl to docker
503
+ - [x] pr: add pl to tuto
504
+ - [x] pr: add pl to readme
505
+ - [x] pl-backend: fix `--jsonl` loading and improve jsonschema-benchmark output
506
+ - [x] pr: add jmc-pl to jsonschema-benchmark
507
+ - [x] docker: add `help` and `run` to docker wrapper
508
+ - [x] pr: review readme for docker
509
+ - [x] python: refactor preproc vs compile vs codegen…
510
+ - [x] command: write a man-page or similar?
511
+ - [x] pl-frontend: expand `--help`
512
+ - [x] pr: add pl to howto
513
+ - [x] pl-backend: check perl module package generation.
514
+ - [x] design: object comments starting with `#`, not just `#`
515
+ - [x] design: array comments `# …` to be ignored
516
+ - [x] frontends: add `--no-report`
517
+ - [x] pr: howto entry about python code
518
+ - [x] pr: update `models/...` to take advantage of multi-comments
519
+ - [x] pr: ask for pause account
520
+ - [x] pr: ship man page with `--doc` option
521
+ - [x] pl-backend: move to subdir + jsb PR update
522
+ - [x] export: simple stuff to python pydantic
523
+ - [x] pr: tuto pydantic export example
524
+ - [x] export: use pydantic predefs and the class syntax
525
+ - [x] pr: readme pydantic export example
526
+ - [x] export: possible generate the root model
527
+ - [x] java-backend: jackson gson ~jsonp moshi~
528
+ see [perfs](https://github.com/fabienrenaud/java-json-benchmark)
529
+ - [x] java-backend: add code generator and runtime, with abstracted json representation
530
+ - [x] java-backend: pass validation tests with jackson
531
+ - [x] java-backend: pass validation tests with gson
532
+ - [x] java-backend: fix `mv-18/dis_0[13]` `mv-19/tag01` `mv-1a/opt_07` GSON/Jackson diff
533
+ - [x] test: enable java tests with pytest
534
+ - [x] command: allow direct java compilation
535
+ - [x] pr: update tuto with some Java
536
+ - [x] command: fix handling of stdin for a model
537
+ - [x] pr: publish pl runtime on cpan
538
+ - [x] java-backend: env `JSON_MODEL_JAVA_JSON_LIB` can control JSON lib selection
539
+ - [x] java-fe: add help stuff
540
+ - [x] java-backend: use package if set
541
+ - [x] sql-backend: handle package as schema name if set
542
+ - [x] java-fe: implement list option
543
+ - [x] pr: add java to docker
544
+ - [x] \*-backend: add `$JSON` predef for all
545
+ - [x] pr: add java to tuto
546
+ - [x] pr: fix java utf8 with docker
547
+ - [x] pl-backend: fix utf8 JSON handling `mv-21/pJSON`
548
+ - [x] pr: docker tuto script fix pull
549
+ - [x] command: add `--jsonl` support
550
+ - [x] pr: java-backend maven packaging and publication
551
+ - [x] pr: update example re in tuto
552
+ - [x] dev: complete publish task in root makefile
553
+ - [x] pr: review readme, what is the introductory story?
554
+ - [x] java-backend: fix `mv-0a/base-18` unique
555
+ - [x] qa: rerun all pytest checks
556
+ - [x] qa: rerun all source checks
557
+ - [x] qa: ensure that full validation runs in docker zx80/jmc
558
+ - [x] src: restructure runtime per language
559
+ - [x] pr: write `everything.model.json` for illustration and test
560
+ - [x] command: add cache management options, eg cleaning, ignore…
561
+ - [x] java-backend: jsonp tested with joy
562
+ - [x] java-backend: jsonp with johnzon, same issues compared to joy…
563
+ - [x] design: check `$BOOL` vs `$BOOLEAN` support
564
+ - [x] pr: complete spec
565
+ - [x] design: force static information on `@` constraints for optimizations
@@ -0,0 +1,35 @@
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 static optimizations
10
+ - export to other syntax, eg JSON Schema, pydantic
11
+ - extensions? see moshi
12
+
13
+ ## Usability use cases
14
+
15
+ - def only models are ok
16
+ - manage (related) models:
17
+ - in files
18
+ - in files in a directory
19
+ - through a URL
20
+ - inlined in source files
21
+ - tooling, file derivation
22
+ - how to manage model changes and file derivations depending on the output
23
+ - (easy) integration into the JS (npm) ecosystem?
24
+ - (easy) integration into the Python (pip) ecosystem?
25
+ - web development specific ecosystems: Flask, Django, express.js, Spring…
26
+ - derive/import JSON Model from an actual/existing data structure:
27
+ - how to import and use such definitions?
28
+ - non JSON format:
29
+ - yaml: for convenient data structure documentation
30
+ - js/ts: for convenient data structure documentation (i.e. JSON with comments)
31
+ - py: for convenient data structure documentation (?!)
32
+ - ORM, tables, pydantic, dataclass, python types…
33
+ - extensions: derive models for distinct usages?
34
+ - provide with default values for initialization
35
+ - rewrite: compare with dynamic reference JSON Schema use case.
@@ -0,0 +1,24 @@
1
+ # JSON Model Developer Stuff
2
+
3
+ ## Publication Accounts
4
+
5
+ See `publish.*` targets in `Makefile`.
6
+
7
+ - Sources on [GitHub](https://github.com/clairey-zx81)
8
+ - Python Package on [PyPI](https://pypi.org/user/zx80/)
9
+ - JavaScript module on [npmjs](https://www.npmjs.com/~calvin-5432)
10
+ - Perl module on [CPAN](https://metacpan.org/author/ZXHZ)
11
+ - Java Jar on [Maven Central](https://central.sonatype.com/account)
12
+ - Postgres extension on [PGXN](https://pgxn.org/user/fabien)
13
+ - Docker image on [Docker](https://hub.docker.com/u/zx80)
14
+ - Website on [CRI Web](https://www.cri.minesparis.psl.eu/)
15
+
16
+ ## Hardcoded Versions
17
+
18
+ - [pyproject](./pyproject.toml)
19
+ - [pom](./json_model/runtime/java/pom.xml)
20
+ - [pm](./json_model/runtime/pl/JSON/JsonModel.pm) (twice)
21
+ - [pg](./json_model/META.json) (twice)
22
+ - [js](./json_model/runtime/js/package.json)
23
+ - docker tag is extracted from `jmc`
24
+ - git tag?
@@ -0,0 +1,23 @@
1
+ # JSON Model Documentation
2
+
3
+ Following the [diátaxis](https://diataxis.fr/) approach, this project provides:
4
+
5
+ ## Explanations and discussions
6
+
7
+ See [introduction](README.md) and [research papers](PUBS#research-papers).
8
+
9
+ ## Tutorial
10
+
11
+ See [tutorial](TUTO.md) about JSON Model and the `jmc` command,
12
+ using a [docker](DOCKER.md) [image](https://hub.docker.com/r/zx80/jmc) for easy deployment.
13
+
14
+ ## How To
15
+
16
+ See [how-to](HOWTO.md) for common tasks to integrate JSON Model seamlessly in a project.
17
+
18
+ ## References
19
+
20
+ JSON Model [specification](SPEC.md),
21
+ `jmc` [command](JMC.md),
22
+ language [APIs](API.md),
23
+ distribution [packages](PUBS#packages).