Commit 5ed3d84
Update JSON handling (#370)
This PR breaks up the JSONUtil [big ball of
mud](https://en.wikipedia.org/wiki/Spaghetti_code#Big_ball_of_mud).
Instead of a single ObjectMapper instance shared by different parts of
the code with different needs, this has no been broken up as needed for
different parts of the code:
* `JsonUtility` has a static "vanilla" object mapper that is used both
by `DBOSPortableSerializer` as well as places in the code where we need
generic to/from JSON support (admin server & conductor protocol,
authenticatedRoles string array)
* `DBOSJavaSerializer` includes an object mapper with a custom type
resolver. This enables java type info to be included in the serialzied
JSON for accurate deserialization.
* 'Conductor` has an object mapper configured for large strings which
may be recived as import requests
Additionally, the custom type resolver approach in `DBOSJavaSerializer`
eliminates the need for boxing or wrapping values in array as `JSONUtil`
did. This allowed us to remove the `noHistoricalWrapper` parameter from
DBOSSerializer methods. Since this is a breaking change for
DBOSSerializer (and because there are other breaking changes in the next
DBOS Java release) we also changed the method names from javascripty
`stringify` & `parse` to `serialize` & `deserialize`.
fixes #369
---------
Co-authored-by: Copilot <copilot@github.com>1 parent 9eea3aa commit 5ed3d84
38 files changed
Lines changed: 806 additions & 839 deletions
File tree
- gradle
- transact-cli/src/main/java/dev/dbos/transact/cli
- transact
- src
- main/java/dev/dbos/transact
- admin
- conductor
- protocol
- database
- execution
- json
- test/java/dev/dbos/transact
- admin
- conductor
- json
- queue
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
Lines changed: 10 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 22 | | |
28 | 23 | | |
29 | 24 | | |
| |||
32 | 27 | | |
33 | 28 | | |
34 | 29 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | 30 | | |
56 | 31 | | |
57 | 32 | | |
| |||
145 | 120 | | |
146 | 121 | | |
147 | 122 | | |
148 | | - | |
| 123 | + | |
149 | 124 | | |
150 | 125 | | |
151 | 126 | | |
| |||
172 | 147 | | |
173 | 148 | | |
174 | 149 | | |
175 | | - | |
| 150 | + | |
176 | 151 | | |
177 | 152 | | |
178 | 153 | | |
| |||
183 | 158 | | |
184 | 159 | | |
185 | 160 | | |
186 | | - | |
| 161 | + | |
187 | 162 | | |
188 | 163 | | |
189 | 164 | | |
| |||
192 | 167 | | |
193 | 168 | | |
194 | 169 | | |
195 | | - | |
| 170 | + | |
196 | 171 | | |
197 | 172 | | |
198 | 173 | | |
| |||
202 | 177 | | |
203 | 178 | | |
204 | 179 | | |
205 | | - | |
| 180 | + | |
206 | 181 | | |
207 | 182 | | |
208 | 183 | | |
| |||
248 | 223 | | |
249 | 224 | | |
250 | 225 | | |
251 | | - | |
| 226 | + | |
252 | 227 | | |
253 | 228 | | |
254 | 229 | | |
| |||
280 | 255 | | |
281 | 256 | | |
282 | 257 | | |
283 | | - | |
| 258 | + | |
284 | 259 | | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
| 260 | + | |
| 261 | + | |
291 | 262 | | |
292 | 263 | | |
293 | 264 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
0 commit comments