@isdk/json-repair 0.2.0 → 0.3.0

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 (35) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.cn.md +24 -9
  3. package/README.md +40 -12
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.d.cts +269 -49
  6. package/dist/index.d.ts +269 -49
  7. package/dist/index.js +1 -1
  8. package/package.json +6 -5
  9. package/docs/README.md +0 -387
  10. package/docs/_media/README.cn.md +0 -333
  11. package/docs/classes/RepairParser.md +0 -130
  12. package/docs/classes/SchemaWalker.md +0 -241
  13. package/docs/functions/compareScores.md +0 -32
  14. package/docs/functions/discardedText.md +0 -42
  15. package/docs/functions/expectsArrayRoot.md +0 -23
  16. package/docs/functions/findImplicitRecordRegion.md +0 -32
  17. package/docs/functions/jsonRepair.md +0 -49
  18. package/docs/functions/jsonRepairResult.md +0 -50
  19. package/docs/functions/locateJsonCandidates.md +0 -33
  20. package/docs/functions/looksLikeSchemaEcho.md +0 -29
  21. package/docs/functions/renderValidatorErrors.md +0 -32
  22. package/docs/functions/scoreCandidate.md +0 -45
  23. package/docs/functions/validateValue.md +0 -38
  24. package/docs/globals.md +0 -43
  25. package/docs/interfaces/CandidateScore.md +0 -63
  26. package/docs/interfaces/JsonCandidate.md +0 -71
  27. package/docs/interfaces/LocatedJson.md +0 -48
  28. package/docs/interfaces/RepairOptions.md +0 -301
  29. package/docs/interfaces/RepairResult.md +0 -58
  30. package/docs/interfaces/ValidationError.md +0 -27
  31. package/docs/type-aliases/CommentStyle.md +0 -13
  32. package/docs/type-aliases/EscapeMode.md +0 -13
  33. package/docs/type-aliases/JSONPath.md +0 -14
  34. package/docs/type-aliases/LiteralDialect.md +0 -13
  35. package/docs/type-aliases/RepairFlag.md +0 -11
@@ -1,63 +0,0 @@
1
- [**@isdk/json-repair**](../README.md)
2
-
3
- ***
4
-
5
- [@isdk/json-repair](../globals.md) / CandidateScore
6
-
7
- # Interface: CandidateScore
8
-
9
- Defined in: [types.ts:325](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L325)
10
-
11
- How well one fragment fits the Schema. Compared in this order:
12
- `errors` ascending, then `requiredCovered`, `declaredCovered` descending,
13
- then `schemaEchoKeys` ascending. A single extra key is not held against a fragment -
14
- `additionalProperties` is the caller's business, not a ranking signal - but a fragment
15
- built out of Schema keywords is.
16
-
17
- Coverage counts only fields that carry a usable value: `""` and a `null` the Schema does
18
- not allow are not "covered", which is what stops a placeholder-only fragment from beating
19
- a fragment with real data.
20
-
21
- ## Properties
22
-
23
- ### declaredCovered
24
-
25
- > **declaredCovered**: `number`
26
-
27
- Defined in: [types.ts:328](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L328)
28
-
29
- ***
30
-
31
- ### errors
32
-
33
- > **errors**: `number`
34
-
35
- Defined in: [types.ts:326](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L326)
36
-
37
- ***
38
-
39
- ### requiredCovered
40
-
41
- > **requiredCovered**: `number`
42
-
43
- Defined in: [types.ts:327](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L327)
44
-
45
- ***
46
-
47
- ### schemaEchoKeys
48
-
49
- > **schemaEchoKeys**: `number`
50
-
51
- Defined in: [types.ts:332](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L332)
52
-
53
- How many of those undeclared keys are JSON Schema keywords - the echo signature.
54
-
55
- ***
56
-
57
- ### undeclaredKeys
58
-
59
- > **undeclaredKeys**: `number`
60
-
61
- Defined in: [types.ts:330](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L330)
62
-
63
- Keys the Schema never declared. Reported, and used to rank only via `schemaEchoKeys`.
@@ -1,71 +0,0 @@
1
- [**@isdk/json-repair**](../README.md)
2
-
3
- ***
4
-
5
- [@isdk/json-repair](../globals.md) / JsonCandidate
6
-
7
- # Interface: JsonCandidate
8
-
9
- Defined in: [types.ts:349](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L349)
10
-
11
- A JSON fragment found in the input text, with the score it earned against the Schema.
12
-
13
- ## Extends
14
-
15
- - [`LocatedJson`](LocatedJson.md)
16
-
17
- ## Properties
18
-
19
- ### end
20
-
21
- > **end**: `number`
22
-
23
- Defined in: [types.ts:341](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L341)
24
-
25
- #### Inherited from
26
-
27
- [`LocatedJson`](LocatedJson.md).[`end`](LocatedJson.md#end)
28
-
29
- ***
30
-
31
- ### flags
32
-
33
- > **flags**: [`RepairFlag`](../type-aliases/RepairFlag.md)[]
34
-
35
- Defined in: [types.ts:343](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L343)
36
-
37
- #### Inherited from
38
-
39
- [`LocatedJson`](LocatedJson.md).[`flags`](LocatedJson.md#flags)
40
-
41
- ***
42
-
43
- ### score
44
-
45
- > **score**: [`CandidateScore`](CandidateScore.md)
46
-
47
- Defined in: [types.ts:350](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L350)
48
-
49
- ***
50
-
51
- ### start
52
-
53
- > **start**: `number`
54
-
55
- Defined in: [types.ts:340](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L340)
56
-
57
- #### Inherited from
58
-
59
- [`LocatedJson`](LocatedJson.md).[`start`](LocatedJson.md#start)
60
-
61
- ***
62
-
63
- ### text
64
-
65
- > **text**: `string`
66
-
67
- Defined in: [types.ts:342](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L342)
68
-
69
- #### Inherited from
70
-
71
- [`LocatedJson`](LocatedJson.md).[`text`](LocatedJson.md#text)
@@ -1,48 +0,0 @@
1
- [**@isdk/json-repair**](../README.md)
2
-
3
- ***
4
-
5
- [@isdk/json-repair](../globals.md) / LocatedJson
6
-
7
- # Interface: LocatedJson
8
-
9
- Defined in: [types.ts:339](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L339)
10
-
11
- A JSON region located inside a larger piece of text, given as offsets into that text so
12
- the caller can line it up against what the model actually returned.
13
-
14
- ## Extended by
15
-
16
- - [`JsonCandidate`](JsonCandidate.md)
17
-
18
- ## Properties
19
-
20
- ### end
21
-
22
- > **end**: `number`
23
-
24
- Defined in: [types.ts:341](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L341)
25
-
26
- ***
27
-
28
- ### flags
29
-
30
- > **flags**: [`RepairFlag`](../type-aliases/RepairFlag.md)[]
31
-
32
- Defined in: [types.ts:343](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L343)
33
-
34
- ***
35
-
36
- ### start
37
-
38
- > **start**: `number`
39
-
40
- Defined in: [types.ts:340](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L340)
41
-
42
- ***
43
-
44
- ### text
45
-
46
- > **text**: `string`
47
-
48
- Defined in: [types.ts:342](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L342)
@@ -1,301 +0,0 @@
1
- [**@isdk/json-repair**](../README.md)
2
-
3
- ***
4
-
5
- [@isdk/json-repair](../globals.md) / RepairOptions
6
-
7
- # Interface: RepairOptions
8
-
9
- Defined in: [types.ts:4](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L4)
10
-
11
- Options for the JSON repair process.
12
-
13
- ## Properties
14
-
15
- ### additionalProperties?
16
-
17
- > `optional` **additionalProperties?**: `"keep"` \| `"remove"`
18
-
19
- Defined in: [types.ts:76](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L76)
20
-
21
- Defines how to handle properties not defined in the Schema.
22
-
23
- - `'keep'` (default): Keeps these extra properties in the output.
24
- - `'remove'`: Drops them. Only applies at a level whose Schema declares `properties`;
25
- a free-form level has no "extra" keys and is left untouched.
26
-
27
- This option is independent from the JSON Schema keyword `additionalProperties: false`,
28
- which is respected on its own when validating incoming keys.
29
-
30
- ***
31
-
32
- ### coerceTypes?
33
-
34
- > `optional` **coerceTypes?**: `boolean`
35
-
36
- Defined in: [types.ts:64](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L64)
37
-
38
- Whether to coerce values to the type the Schema declares. Enabled by default.
39
-
40
- - `true` (default): `"Approx. 1,200.50 USD"` becomes `1200.5`, `"yes"` becomes `true`,
41
- `"Processing!"` becomes the enum entry it fuzzy matches, `12` becomes `"12"` when the
42
- Schema says `type: 'string'`.
43
- - `false`: values are returned exactly as they were parsed.
44
-
45
- Coercion needs the Schema of the property the value belongs to; a level that declares
46
- no types is left alone.
47
-
48
- Coercing to a declared `string` reuses the text the document wrote, not the number it
49
- parsed to, so a leading zero survives: `{ id: 01234 }` becomes `"01234"`.
50
- `null` and structures (`{}` / `[]`) are never stringified - `"null"` and
51
- `"[object Object]"` are not what a `type: 'string'` declaration asks for.
52
-
53
- A coercion that keeps part of a value and gives up the text around it says so:
54
- `coerced-text-dropped`. A unit given up that way (`Approx. USD`) is the option doing its
55
- job; text long enough to read as a sentence is listed in [RepairResult.discarded](RepairResult.md#discarded)
56
- too, because greedy capture can run a value into prose the model wrote after it
57
- (`age: 30\n\nHope this helps!}` -> `30`) and the sentence would otherwise leave no trace.
58
-
59
- ***
60
-
61
- ### comments?
62
-
63
- > `optional` **comments?**: `boolean` \| [`CommentStyle`](../type-aliases/CommentStyle.md)[]
64
-
65
- Defined in: [types.ts:115](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L115)
66
-
67
- Which comment styles are skipped, and only where a member is expected: between two
68
- fields, after `{` or `[`, before a closing bracket, and after a completed value.
69
-
70
- Strict JSON has no comments, so this is off by default - skipping one consumes
71
- characters, and only the caller knows which style its models write. Open the style you
72
- actually see.
73
-
74
- - `'line'` - `//` to the end of the line (JSONC, and most JavaScript-trained models).
75
- - `'block'` - `/* ... */`, and only when it is closed: an unterminated `/*` stays text.
76
- - `'hash'` - `#` to the end of the line (Python-trained models).
77
- - `true` - all three. `false` or `[]` - none, which is the default.
78
-
79
- A style is never recognised inside a string or inside a bare token, so
80
- `url: https://x.com/a`, `issue: #123` and `"#ff0000"` survive every setting. With the
81
- default, a comment written between two fields ends up inside one of them; turning the
82
- switch on is what prevents that. Emits `comment-skipped`.
83
-
84
- ***
85
-
86
- ### dangling?
87
-
88
- > `optional` **dangling?**: `boolean`
89
-
90
- Defined in: [types.ts:175](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L175)
91
-
92
- Whether a key or separator the output was cut off at is dropped or kept.
93
-
94
- `{"a": 1, "b`: `true` (default) gives `{ a: 1 }`. `false` gives `{ a: '1, "b' }` - the
95
- fragment written into a field that was already correct, which is exactly what this option
96
- exists to prevent. Dropping is the default, and the dropped text is listed in
97
- [RepairResult.discarded](RepairResult.md#discarded) and flagged `dangling-dropped`, so nothing disappears
98
- without a trace. Only the fragment is dropped: the container closes and a record written
99
- after it is still read, so `{"a": 1, "b"} {"c": 2}` becomes `[{ a: 1 }, { c: 2 }]`. A
100
- broken key with a value after it is syntax to repair, not a fragment, and is left alone.
101
-
102
- ***
103
-
104
- ### escapes?
105
-
106
- > `optional` **escapes?**: [`EscapeMode`](../type-aliases/EscapeMode.md)
107
-
108
- Defined in: [types.ts:162](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L162)
109
-
110
- How much the parser trusts the backslashes a document writes.
111
-
112
- The three settings read as one axis - how far the document's escapes are escapes:
113
-
114
- - `'json5'` (default): JSON's own escapes decode, the JSON5-style `\xNN` decodes to the
115
- character it names, and an escape of a character that needs none is unwrapped
116
- (`"\$10"` -> `$10`, `"C:\Users"` -> `C:Users`) the way JSON5 reads one.
117
- - `'json'`: only the escapes JSON defines decode. Anything else stays exactly as the
118
- document wrote it, backslash included (`"C:\Users"` -> `C:\Users`), so markdown and
119
- LaTeX punctuation keeps its backslashes and a path keeps its separators.
120
- - `'raw'`: nothing decodes - a backslash is content. `"C:\temp"` is a path, not a tab,
121
- and `"\frac{a}{b}"` is a LaTeX command, not a form feed. The setting is honest about
122
- what it costs: it applies to escapes JSON defines too, so `"a\nb"` stays two characters
123
- and a value can no longer carry a newline. Use it when the values are paths, regular
124
- expressions or markup rather than prose.
125
-
126
- A backslash is structural in every setting: it always keeps the character behind it inside
127
- the string, so a value is never cut where the model escaped something. An incomplete hex
128
- escape (`\xg`, `\uZZ`) decodes nothing in every setting and stays as written.
129
- Whichever is chosen, an escape strict JSON would reject is reported as `invalid-escape`.
130
-
131
- ***
132
-
133
- ### keyMatching?
134
-
135
- > `optional` **keyMatching?**: `boolean` \| ((`key`, `properties`) => `string` \| `undefined`)
136
-
137
- Defined in: [types.ts:21](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L21)
138
-
139
- Fuzzy matching of property keys against the Schema's declared `properties`.
140
-
141
- - `false` (default): Only an exactly declared key counts as a match.
142
- - `true`: Case-insensitive and separator-insensitive matching, so `user_name`,
143
- `userName`, `USER-NAME` and `user name` all resolve to the declared key.
144
- - `(key: string, properties: string[]) => string | undefined`: Custom mapping logic;
145
- it receives the incoming key and the declared names, and returns the name to use
146
- (or `undefined` to fall back to the incoming key).
147
-
148
- A match renames the key to the Schema's name in the output and makes nested Schema
149
- lookups (and therefore type coercion) work for it.
150
- It also decides where greedy capture stops: with `true` a separator or case variant of a
151
- declared key (`user_name:` for `userName`) ends the value in front of it.
152
- When you reuse a `SchemaWalker`, pass this option to `SchemaWalker.create()`.
153
-
154
- ***
155
-
156
- ### literals?
157
-
158
- > `optional` **literals?**: `boolean` \| [`LiteralDialect`](../type-aliases/LiteralDialect.md)[]
159
-
160
- Defined in: [types.ts:138](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L138)
161
-
162
- Which bare tokens (tokens with no quotes around them) are read as a literal of another
163
- language.
164
-
165
- `ok: True` means `true`, not the word `True`: the token carries no quotes, so it is not a
166
- string in any JSON dialect either - reading it as a literal is reading the model, while
167
- turning it into `'True'` invents a value.
168
-
169
- - `'python'` - `True` -> `true`, `False` -> `false`, `None` -> `null`.
170
- - `'js'` - `undefined` -> `null`. `NaN` is left as the text it spells: no JSON number
171
- can carry it, so the reported errors point at the field instead of the parser inventing
172
- a value that cannot be serialised.
173
- - `true` - both dialects, which is the default. `false` or `[]` - neither: the token
174
- becomes the string it spells.
175
-
176
- A model trained on JavaScript does not write `None` and a Python-trained one rarely writes
177
- `undefined`, so the list is how you say which of them can occur. It never applies to a
178
- quoted `"True"` (always a string), never to a key, and never to a path whose Schema names
179
- a type - there [coerceTypes](#coercetypes) decides, and it already reads `True` as `true`.
180
- Emits `non-json-literal`.
181
-
182
- ***
183
-
184
- ### locate?
185
-
186
- > `optional` **locate?**: `boolean`
187
-
188
- Defined in: [types.ts:201](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L201)
189
-
190
- Whether to look for the JSON inside the input text first.
191
-
192
- LLM output is text, not a document: the JSON often sits inside a Markdown fence and
193
- between sentences. With `true` (the default) the input is scanned for
194
- quote-aware, escape-aware, bracket-balanced JSON regions and the best one is repaired;
195
- prose and fences around it are dropped and reported. With `false` the whole string is
196
- parsed as if it were already a JSON document (the behaviour up to 0.1.x).
197
-
198
- Input that already parses as JSON is never touched either way.
199
-
200
- ***
201
-
202
- ### onDiscard?
203
-
204
- > `optional` **onDiscard?**: `"throw"` \| `"report"` \| `"ignore"`
205
-
206
- Defined in: [types.ts:230](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L230)
207
-
208
- What to do with text the repair dropped on the floor (prose, fences, losing fragments).
209
-
210
- - `'report'` (default): drop it, but list it in `RepairResult.discarded`.
211
- - `'throw'`: refuse the input - a caller that cannot afford to lose content should not
212
- accept a repair that discards any.
213
- - `'ignore'`: drop it silently.
214
-
215
- ***
216
-
217
- ### onMultiple?
218
-
219
- > `optional` **onMultiple?**: `"best"` \| `"last"` \| `"first"` \| `"throw"`
220
-
221
- Defined in: [types.ts:220](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L220)
222
-
223
- How to choose when the input contains more than one JSON fragment.
224
-
225
- - `'best'` (default): rank the fragments by how well they fit the Schema - fewer
226
- validation errors, more `required` fields carrying real values, more declared fields,
227
- fewer Schema keywords in the answer - and take the winner. A tie is decided by position,
228
- last first, because a model usually drafts before it answers; the tie is then reported as
229
- `ambiguous-candidates` rather than hidden. An extra key the Schema never named is not held
230
- against a fragment ([CandidateScore.undeclaredKeys](CandidateScore.md#undeclaredkeys) reports it); only an answer built
231
- out of the Schema itself is.
232
- - `'last'` / `'first'`: take the position regardless of how well the fragment fits. The
233
- Schema errors of the chosen fragment are still reported.
234
- - `'throw'`: reject the input outright and list the candidates with their scores.
235
-
236
- Without a Schema the ranking has no information to work with, so it collapses to the
237
- position rule (the last fragment).
238
-
239
- ***
240
-
241
- ### stringCaptureStrategy?
242
-
243
- > `optional` **stringCaptureStrategy?**: `"conservative"` \| `"aggressive"`
244
-
245
- Defined in: [types.ts:40](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L40)
246
-
247
- Strategy for greedy string capture when the strict JSON path failed for a value.
248
-
249
- - `'aggressive'` (default): When the Schema declares property names for the current
250
- level, the captured value only ends at one of those declared keys. Text that merely
251
- looks like `"some words":` stays inside the value.
252
- - `'conservative'`: Any text matching the `"key":` / `key:` pattern ends the value,
253
- which keeps the structure of the document at the cost of cutting values short.
254
-
255
- A whitespace-containing key the Schema declares is a breakpoint in both strategies even
256
- when the document left it unquoted (`{ Capital: Berlin, Official language: Italian }`),
257
- because it can only be recognised from the declaration.
258
- Neither strategy affects values that were parsed by the strict JSON path; the
259
- boundary rules described in the README apply to those unchanged.
260
-
261
- ***
262
-
263
- ### unescapedQuotes?
264
-
265
- > `optional` **unescapedQuotes?**: `"keep"` \| `"declared"` \| `"lookahead"`
266
-
267
- Defined in: [types.ts:95](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L95)
268
-
269
- Where a quoted value ends when the model left one of its quotes unescaped -
270
- `{"t": "The "Best" Paper", "y": 2020}`.
271
-
272
- - `'keep'` (default) - what the document spells, delimiters included:
273
- `t = '"The "Best" Paper"'`. Nothing is inferred, which is the rule the README section
274
- "How Property Boundaries Are Detected" describes.
275
- - `'declared'` - the first quote after which a member the Schema declares begins:
276
- `t = 'The "Best" Paper'`. The Schema named that member, so the boundary is known rather
277
- than guessed - and where the Schema names nothing at that level, nothing is inferred
278
- either.
279
- - `'lookahead'` - the same rule judged by the shape of the text alone, for documents with
280
- no Schema. It reads more, and guesses more.
281
-
282
- A document that `JSON.parse` accepts is never affected: the strict parse is tried first,
283
- and only a quoted value it could not close comes here. Emits `unescaped-quote-inferred`.
284
-
285
- ***
286
-
287
- ### wrapArrays?
288
-
289
- > `optional` **wrapArrays?**: `boolean`
290
-
291
- Defined in: [types.ts:188](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L188)
292
-
293
- Whether a record the Schema expects inside a list is read as one item: a single object
294
- under a root `array` becomes `[object]`, and sibling records written side by side
295
- (`{...} {...}`, or the same without braces) become the items of that list.
296
-
297
- Enabled by default - the structure was declared by the Schema, so it is not a guess.
298
- Set it to `false` to keep the value exactly as the document wrote it and let the
299
- reported `errors` say what is missing. The cost: the record is no longer looked up
300
- against `items`, so its own keys lose their Schema guide - coercion stops applying and
301
- a value can run into the next key. That is why the default is `true`.
@@ -1,58 +0,0 @@
1
- [**@isdk/json-repair**](../README.md)
2
-
3
- ***
4
-
5
- [@isdk/json-repair](../globals.md) / RepairResult
6
-
7
- # Interface: RepairResult\<T\>
8
-
9
- Defined in: [types.ts:365](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L365)
10
-
11
- Everything a repair produced: the value, what was noticed about the input, what still
12
- fails against the Schema, and what was discarded to get there.
13
-
14
- ## Type Parameters
15
-
16
- ### T
17
-
18
- `T` = `any`
19
-
20
- ## Properties
21
-
22
- ### candidates
23
-
24
- > **candidates**: [`JsonCandidate`](JsonCandidate.md)[]
25
-
26
- Defined in: [types.ts:369](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L369)
27
-
28
- ***
29
-
30
- ### discarded
31
-
32
- > **discarded**: `string`[]
33
-
34
- Defined in: [types.ts:370](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L370)
35
-
36
- ***
37
-
38
- ### errors
39
-
40
- > **errors**: [`ValidationError`](ValidationError.md)[]
41
-
42
- Defined in: [types.ts:368](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L368)
43
-
44
- ***
45
-
46
- ### flags
47
-
48
- > **flags**: [`RepairFlag`](../type-aliases/RepairFlag.md)[]
49
-
50
- Defined in: [types.ts:367](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L367)
51
-
52
- ***
53
-
54
- ### value
55
-
56
- > **value**: `T`
57
-
58
- Defined in: [types.ts:366](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L366)
@@ -1,27 +0,0 @@
1
- [**@isdk/json-repair**](../README.md)
2
-
3
- ***
4
-
5
- [@isdk/json-repair](../globals.md) / ValidationError
6
-
7
- # Interface: ValidationError
8
-
9
- Defined in: [types.ts:356](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L356)
10
-
11
- A JSON Schema violation, located by path so it can be handed back to a model verbatim.
12
-
13
- ## Properties
14
-
15
- ### message
16
-
17
- > **message**: `string`
18
-
19
- Defined in: [types.ts:358](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L358)
20
-
21
- ***
22
-
23
- ### path
24
-
25
- > **path**: [`JSONPath`](../type-aliases/JSONPath.md)
26
-
27
- Defined in: [types.ts:357](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L357)
@@ -1,13 +0,0 @@
1
- [**@isdk/json-repair**](../README.md)
2
-
3
- ***
4
-
5
- [@isdk/json-repair](../globals.md) / CommentStyle
6
-
7
- # Type Alias: CommentStyle
8
-
9
- > **CommentStyle** = `"line"` \| `"block"` \| `"hash"`
10
-
11
- Defined in: [types.ts:257](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L257)
12
-
13
- A comment style. See [RepairOptions.comments](../interfaces/RepairOptions.md#comments).
@@ -1,13 +0,0 @@
1
- [**@isdk/json-repair**](../README.md)
2
-
3
- ***
4
-
5
- [@isdk/json-repair](../globals.md) / EscapeMode
6
-
7
- # Type Alias: EscapeMode
8
-
9
- > **EscapeMode** = `"json5"` \| `"json"` \| `"raw"`
10
-
11
- Defined in: [types.ts:263](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L263)
12
-
13
- How much a backslash is trusted as an escape. See [RepairOptions.escapes](../interfaces/RepairOptions.md#escapes).
@@ -1,14 +0,0 @@
1
- [**@isdk/json-repair**](../README.md)
2
-
3
- ***
4
-
5
- [@isdk/json-repair](../globals.md) / JSONPath
6
-
7
- # Type Alias: JSONPath
8
-
9
- > **JSONPath** = (`string` \| `number`)[]
10
-
11
- Defined in: [types.ts:237](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L237)
12
-
13
- Represents the current path in a JSON structure.
14
- A list of strings (keys) and numbers (indices).
@@ -1,13 +0,0 @@
1
- [**@isdk/json-repair**](../README.md)
2
-
3
- ***
4
-
5
- [@isdk/json-repair](../globals.md) / LiteralDialect
6
-
7
- # Type Alias: LiteralDialect
8
-
9
- > **LiteralDialect** = `"js"` \| `"python"`
10
-
11
- Defined in: [types.ts:260](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L260)
12
-
13
- A language whose bare-token literals a model may write. See [RepairOptions.literals](../interfaces/RepairOptions.md#literals).
@@ -1,11 +0,0 @@
1
- [**@isdk/json-repair**](../README.md)
2
-
3
- ***
4
-
5
- [@isdk/json-repair](../globals.md) / RepairFlag
6
-
7
- # Type Alias: RepairFlag
8
-
9
- > **RepairFlag** = `"markdown-fence"` \| `"prose-prefix"` \| `"trailing-chatter"` \| `"implicit-structure"` \| `"truncated-candidate"` \| `"sibling-objects-merged"` \| `"extra-fragments-dropped"` \| `"duplicate-candidates"` \| `"ambiguous-candidates"` \| `"empty-required"` \| `"schema-echo-detected"` \| `"unescaped-quote-inferred"` \| `"comment-skipped"` \| `"comment-in-value"` \| `"non-json-literal"` \| `"invalid-escape"` \| `"dangling-dropped"` \| `"unparsed-tail"` \| `"coerced-text-dropped"` \| `"nesting-limited"`
10
-
11
- Defined in: [types.ts:265](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/types.ts#L265)