@isdk/json-repair 0.1.2 → 0.2.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.
- package/README.cn.md +245 -14
- package/README.md +293 -14
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +777 -23
- package/dist/index.d.ts +777 -23
- package/dist/index.js +1 -1
- package/docs/README.md +293 -14
- package/docs/_media/README.cn.md +245 -14
- package/docs/classes/RepairParser.md +71 -5
- package/docs/classes/SchemaWalker.md +126 -6
- package/docs/functions/compareScores.md +32 -0
- package/docs/functions/discardedText.md +42 -0
- package/docs/functions/expectsArrayRoot.md +23 -0
- package/docs/functions/findImplicitRecordRegion.md +32 -0
- package/docs/functions/jsonRepair.md +4 -3
- package/docs/functions/jsonRepairResult.md +50 -0
- package/docs/functions/locateJsonCandidates.md +33 -0
- package/docs/functions/looksLikeSchemaEcho.md +29 -0
- package/docs/functions/renderValidatorErrors.md +32 -0
- package/docs/functions/scoreCandidate.md +45 -0
- package/docs/functions/validateValue.md +38 -0
- package/docs/globals.md +19 -0
- package/docs/interfaces/CandidateScore.md +63 -0
- package/docs/interfaces/JsonCandidate.md +71 -0
- package/docs/interfaces/LocatedJson.md +48 -0
- package/docs/interfaces/RepairOptions.md +257 -19
- package/docs/interfaces/RepairResult.md +58 -0
- package/docs/interfaces/ValidationError.md +27 -0
- package/docs/type-aliases/CommentStyle.md +13 -0
- package/docs/type-aliases/EscapeMode.md +13 -0
- package/docs/type-aliases/JSONPath.md +1 -1
- package/docs/type-aliases/LiteralDialect.md +13 -0
- package/docs/type-aliases/RepairFlag.md +11 -0
- package/package.json +38 -12
- package/.prettierignore +0 -4
- package/.prettierrc +0 -8
- package/.versionrc +0 -36
- package/CHANGELOG.md +0 -18
- package/TODO +0 -0
- package/eslint.config.mjs +0 -31
- package/setupVitest.mjs +0 -15
- package/tsconfig.json +0 -19
- package/tsconfig.spec.json +0 -19
- package/tsup.config.ts +0 -34
- package/typedoc.config.cjs +0 -7
- package/vite.config.mjs +0 -16
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[**@isdk/json-repair**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/json-repair](../globals.md) / discardedText
|
|
6
|
+
|
|
7
|
+
# Function: discardedText()
|
|
8
|
+
|
|
9
|
+
> **discardedText**(`text`, `chosen`, `others`): `object`
|
|
10
|
+
|
|
11
|
+
Defined in: [locate.ts:230](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/locate.ts#L230)
|
|
12
|
+
|
|
13
|
+
What the repair threw away around a chosen region: the prose between and around the JSON
|
|
14
|
+
regions (with offsets, so the caller can tell prefix from trailing chatter), and the
|
|
15
|
+
regions it did not pick. Reported separately from the flags because a caller that cannot
|
|
16
|
+
afford to lose content needs the text itself, not just a hint that something went.
|
|
17
|
+
|
|
18
|
+
## Parameters
|
|
19
|
+
|
|
20
|
+
### text
|
|
21
|
+
|
|
22
|
+
`string`
|
|
23
|
+
|
|
24
|
+
### chosen
|
|
25
|
+
|
|
26
|
+
[`LocatedJson`](../interfaces/LocatedJson.md)
|
|
27
|
+
|
|
28
|
+
### others
|
|
29
|
+
|
|
30
|
+
[`LocatedJson`](../interfaces/LocatedJson.md)[]
|
|
31
|
+
|
|
32
|
+
## Returns
|
|
33
|
+
|
|
34
|
+
`object`
|
|
35
|
+
|
|
36
|
+
### fragments
|
|
37
|
+
|
|
38
|
+
> **fragments**: `string`[]
|
|
39
|
+
|
|
40
|
+
### prose
|
|
41
|
+
|
|
42
|
+
> **prose**: `object`[]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[**@isdk/json-repair**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/json-repair](../globals.md) / expectsArrayRoot
|
|
6
|
+
|
|
7
|
+
# Function: expectsArrayRoot()
|
|
8
|
+
|
|
9
|
+
> **expectsArrayRoot**(`walker`): `boolean`
|
|
10
|
+
|
|
11
|
+
Defined in: [locate.ts:38](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/locate.ts#L38)
|
|
12
|
+
|
|
13
|
+
Whether the Schema expects an array at the root of the document.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### walker
|
|
18
|
+
|
|
19
|
+
[`SchemaWalker`](../classes/SchemaWalker.md)
|
|
20
|
+
|
|
21
|
+
## Returns
|
|
22
|
+
|
|
23
|
+
`boolean`
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[**@isdk/json-repair**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/json-repair](../globals.md) / findImplicitRecordRegion
|
|
6
|
+
|
|
7
|
+
# Function: findImplicitRecordRegion()
|
|
8
|
+
|
|
9
|
+
> **findImplicitRecordRegion**(`text`, `walker`): [`LocatedJson`](../interfaces/LocatedJson.md) \| `undefined`
|
|
10
|
+
|
|
11
|
+
Defined in: [locate.ts:85](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/locate.ts#L85)
|
|
12
|
+
|
|
13
|
+
Where a record that has no braces at all starts, when prose sits in front of it:
|
|
14
|
+
`Here you go:\nname: Noah, age: 30`. The only thing that can tell `name` is a key rather
|
|
15
|
+
than part of a sentence is the Schema declaring it, so the Schema supplies the offset.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
### text
|
|
20
|
+
|
|
21
|
+
`string`
|
|
22
|
+
|
|
23
|
+
### walker
|
|
24
|
+
|
|
25
|
+
[`SchemaWalker`](../classes/SchemaWalker.md)
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
[`LocatedJson`](../interfaces/LocatedJson.md) \| `undefined`
|
|
30
|
+
|
|
31
|
+
A region running from the first declared key to the end of the text, or
|
|
32
|
+
`undefined` when the text names none of them.
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
> **jsonRepair**(`input`, `schema?`, `options?`): `Promise`\<`any`\>
|
|
10
10
|
|
|
11
|
-
Defined in: [repair.ts:
|
|
11
|
+
Defined in: [repair.ts:56](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/repair.ts#L56)
|
|
12
12
|
|
|
13
|
-
Repairs and parses a
|
|
13
|
+
Repairs and parses a string generated by an LLM, guided by a JSON Schema.
|
|
14
14
|
This is the main entry point for the library.
|
|
15
15
|
|
|
16
16
|
## Parameters
|
|
@@ -19,7 +19,8 @@ This is the main entry point for the library.
|
|
|
19
19
|
|
|
20
20
|
`string`
|
|
21
21
|
|
|
22
|
-
The
|
|
22
|
+
The text the model returned: broken JSON, or JSON wrapped in a Markdown
|
|
23
|
+
fence and prose. See [RepairOptions.locate](../interfaces/RepairOptions.md#locate).
|
|
23
24
|
|
|
24
25
|
### schema?
|
|
25
26
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[**@isdk/json-repair**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/json-repair](../globals.md) / jsonRepairResult
|
|
6
|
+
|
|
7
|
+
# Function: jsonRepairResult()
|
|
8
|
+
|
|
9
|
+
> **jsonRepairResult**\<`T`\>(`input`, `schema?`, `options?`): `Promise`\<[`RepairResult`](../interfaces/RepairResult.md)\<`T`\>\>
|
|
10
|
+
|
|
11
|
+
Defined in: [repair.ts:79](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/repair.ts#L79)
|
|
12
|
+
|
|
13
|
+
The same repair, plus what it noticed and what it had to give up.
|
|
14
|
+
|
|
15
|
+
A repaired value that validates can still be the wrong answer, and a repair that had to
|
|
16
|
+
choose between fragments or throw prose away has made decisions the caller should be able
|
|
17
|
+
to see. `flags`, `errors`, `candidates` and `discarded` are what a caller needs to decide
|
|
18
|
+
whether to accept the value, hand the `errors` back to the model for another try, or give
|
|
19
|
+
up and ask a bigger model.
|
|
20
|
+
|
|
21
|
+
## Type Parameters
|
|
22
|
+
|
|
23
|
+
### T
|
|
24
|
+
|
|
25
|
+
`T` = `any`
|
|
26
|
+
|
|
27
|
+
## Parameters
|
|
28
|
+
|
|
29
|
+
### input
|
|
30
|
+
|
|
31
|
+
`string`
|
|
32
|
+
|
|
33
|
+
### schema?
|
|
34
|
+
|
|
35
|
+
`any`
|
|
36
|
+
|
|
37
|
+
### options?
|
|
38
|
+
|
|
39
|
+
[`RepairOptions`](../interfaces/RepairOptions.md) = `{}`
|
|
40
|
+
|
|
41
|
+
## Returns
|
|
42
|
+
|
|
43
|
+
`Promise`\<[`RepairResult`](../interfaces/RepairResult.md)\<`T`\>\>
|
|
44
|
+
|
|
45
|
+
## Example
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
const { value, errors, flags } = await jsonRepairResult('```json\n{ name: Ada }\n```', schema)
|
|
49
|
+
if (errors.length) await retryWith(renderValidatorErrors(errors))
|
|
50
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[**@isdk/json-repair**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/json-repair](../globals.md) / locateJsonCandidates
|
|
6
|
+
|
|
7
|
+
# Function: locateJsonCandidates()
|
|
8
|
+
|
|
9
|
+
> **locateJsonCandidates**(`text`, `walker?`): [`LocatedJson`](../interfaces/LocatedJson.md)[]
|
|
10
|
+
|
|
11
|
+
Defined in: [locate.ts:52](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/locate.ts#L52)
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
### text
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The text to scan, normally already trimmed by the caller.
|
|
20
|
+
|
|
21
|
+
### walker?
|
|
22
|
+
|
|
23
|
+
[`SchemaWalker`](../classes/SchemaWalker.md)
|
|
24
|
+
|
|
25
|
+
The Schema in play. It decides three things: whether adjacent sibling
|
|
26
|
+
records may be read as one array, where a record written without braces starts (a key only
|
|
27
|
+
the Schema can name), and nothing at all when no Schema is given.
|
|
28
|
+
|
|
29
|
+
## Returns
|
|
30
|
+
|
|
31
|
+
[`LocatedJson`](../interfaces/LocatedJson.md)[]
|
|
32
|
+
|
|
33
|
+
The regions in document order.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[**@isdk/json-repair**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/json-repair](../globals.md) / looksLikeSchemaEcho
|
|
6
|
+
|
|
7
|
+
# Function: looksLikeSchemaEcho()
|
|
8
|
+
|
|
9
|
+
> **looksLikeSchemaEcho**(`fragment`): `boolean`
|
|
10
|
+
|
|
11
|
+
Defined in: [score.ts:100](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/score.ts#L100)
|
|
12
|
+
|
|
13
|
+
Whether the model reproduced the Schema instead of filling it in.
|
|
14
|
+
|
|
15
|
+
Given the fragment's text, Schema keywords are counted where they are written - the usual
|
|
16
|
+
place to look, because an echo is often swallowed by greedy capture on the way to the real
|
|
17
|
+
keys. Given a repaired value, its own keys are counted: a weaker signal (a document with
|
|
18
|
+
one real `items` field is not an echo), which is why one keyword is never enough here
|
|
19
|
+
either way. Anything else - a number, a string that is not text - is not an echo.
|
|
20
|
+
|
|
21
|
+
## Parameters
|
|
22
|
+
|
|
23
|
+
### fragment
|
|
24
|
+
|
|
25
|
+
`unknown`
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`boolean`
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[**@isdk/json-repair**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/json-repair](../globals.md) / renderValidatorErrors
|
|
6
|
+
|
|
7
|
+
# Function: renderValidatorErrors()
|
|
8
|
+
|
|
9
|
+
> **renderValidatorErrors**(`errors`, `limit?`): `string`
|
|
10
|
+
|
|
11
|
+
Defined in: [validate.ts:35](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/validate.ts#L35)
|
|
12
|
+
|
|
13
|
+
Renders validation errors the way a repair prompt needs them: one `path: message` line
|
|
14
|
+
each, short enough that a 360M-parameter model still follows it. Paths point at the field,
|
|
15
|
+
so the model has something concrete to fix rather than a document to re-read.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
### errors
|
|
20
|
+
|
|
21
|
+
[`ValidationError`](../interfaces/ValidationError.md)[]
|
|
22
|
+
|
|
23
|
+
### limit?
|
|
24
|
+
|
|
25
|
+
`number` = `6`
|
|
26
|
+
|
|
27
|
+
How many lines to emit. More than a handful of simultaneous complaints is
|
|
28
|
+
wasted on a small model; it fixes the first few and breaks the rest.
|
|
29
|
+
|
|
30
|
+
## Returns
|
|
31
|
+
|
|
32
|
+
`string`
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[**@isdk/json-repair**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/json-repair](../globals.md) / scoreCandidate
|
|
6
|
+
|
|
7
|
+
# Function: scoreCandidate()
|
|
8
|
+
|
|
9
|
+
> **scoreCandidate**(`value`, `walker`): `object`
|
|
10
|
+
|
|
11
|
+
Defined in: [score.ts:17](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/score.ts#L17)
|
|
12
|
+
|
|
13
|
+
How well a value fits the Schema, measured rather than felt.
|
|
14
|
+
|
|
15
|
+
Counting declared keys is not the same as counting keys a model happened to write. Two
|
|
16
|
+
real failure modes make that difference decisive:
|
|
17
|
+
|
|
18
|
+
- A model that copies the Schema into its answer (`type`, `properties`, `required`, ...)
|
|
19
|
+
produces the fragment with the *most* keys and the least data.
|
|
20
|
+
- A model that answers with `"name": ""` satisfies `type: string` exactly and says nothing.
|
|
21
|
+
|
|
22
|
+
So coverage counts only fields carrying a usable value, and keys the Schema never declared
|
|
23
|
+
are counted against the fragment.
|
|
24
|
+
|
|
25
|
+
## Parameters
|
|
26
|
+
|
|
27
|
+
### value
|
|
28
|
+
|
|
29
|
+
`any`
|
|
30
|
+
|
|
31
|
+
### walker
|
|
32
|
+
|
|
33
|
+
[`SchemaWalker`](../classes/SchemaWalker.md)
|
|
34
|
+
|
|
35
|
+
## Returns
|
|
36
|
+
|
|
37
|
+
`object`
|
|
38
|
+
|
|
39
|
+
### flags
|
|
40
|
+
|
|
41
|
+
> **flags**: [`RepairFlag`](../type-aliases/RepairFlag.md)[]
|
|
42
|
+
|
|
43
|
+
### score
|
|
44
|
+
|
|
45
|
+
> **score**: [`CandidateScore`](../interfaces/CandidateScore.md)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[**@isdk/json-repair**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/json-repair](../globals.md) / validateValue
|
|
6
|
+
|
|
7
|
+
# Function: validateValue()
|
|
8
|
+
|
|
9
|
+
> **validateValue**(`value`, `walker`): [`ValidationError`](../interfaces/ValidationError.md)[]
|
|
10
|
+
|
|
11
|
+
Defined in: [validate.ts:18](https://github.com/isdk/json-repair.js/blob/5dd9e8689f96f00064dc6c6f8343ca1fd8216d98/src/validate.ts#L18)
|
|
12
|
+
|
|
13
|
+
A small JSON Schema validator, kept inside this package on purpose: the repair already
|
|
14
|
+
knows the Schema through `SchemaWalker`, and the two things a caller needs after a repair
|
|
15
|
+
are "does this still fail?" (to decide whether another model call is worth it) and "where
|
|
16
|
+
does it fail?" (to tell the model). Pulling in a full validator would duplicate the
|
|
17
|
+
walking this library already does.
|
|
18
|
+
|
|
19
|
+
The keywords covered are the ones that describe a shape an LLM can get wrong: `type`
|
|
20
|
+
(including `integer` and unions), `required`, `properties`, `additionalProperties: false`,
|
|
21
|
+
`items`, `enum`, `const`, `pattern`, `format` for dates and times, numeric bounds, string
|
|
22
|
+
length and array length. Unknown keywords are ignored, and so is everything below a Schema
|
|
23
|
+
that says nothing - notably `anyOf` / `oneOf` / `allOf` are not evaluated, so a Schema built
|
|
24
|
+
out of them reports no errors and the fragment ranking falls back to coverage alone.
|
|
25
|
+
|
|
26
|
+
## Parameters
|
|
27
|
+
|
|
28
|
+
### value
|
|
29
|
+
|
|
30
|
+
`any`
|
|
31
|
+
|
|
32
|
+
### walker
|
|
33
|
+
|
|
34
|
+
[`SchemaWalker`](../classes/SchemaWalker.md)
|
|
35
|
+
|
|
36
|
+
## Returns
|
|
37
|
+
|
|
38
|
+
[`ValidationError`](../interfaces/ValidationError.md)[]
|
package/docs/globals.md
CHANGED
|
@@ -13,12 +13,31 @@ A schema-guided JSON repair library specifically designed for LLM-generated outp
|
|
|
13
13
|
|
|
14
14
|
## Interfaces
|
|
15
15
|
|
|
16
|
+
- [CandidateScore](interfaces/CandidateScore.md)
|
|
17
|
+
- [JsonCandidate](interfaces/JsonCandidate.md)
|
|
18
|
+
- [LocatedJson](interfaces/LocatedJson.md)
|
|
16
19
|
- [RepairOptions](interfaces/RepairOptions.md)
|
|
20
|
+
- [RepairResult](interfaces/RepairResult.md)
|
|
21
|
+
- [ValidationError](interfaces/ValidationError.md)
|
|
17
22
|
|
|
18
23
|
## Type Aliases
|
|
19
24
|
|
|
25
|
+
- [CommentStyle](type-aliases/CommentStyle.md)
|
|
26
|
+
- [EscapeMode](type-aliases/EscapeMode.md)
|
|
20
27
|
- [JSONPath](type-aliases/JSONPath.md)
|
|
28
|
+
- [LiteralDialect](type-aliases/LiteralDialect.md)
|
|
29
|
+
- [RepairFlag](type-aliases/RepairFlag.md)
|
|
21
30
|
|
|
22
31
|
## Functions
|
|
23
32
|
|
|
33
|
+
- [compareScores](functions/compareScores.md)
|
|
34
|
+
- [discardedText](functions/discardedText.md)
|
|
35
|
+
- [expectsArrayRoot](functions/expectsArrayRoot.md)
|
|
36
|
+
- [findImplicitRecordRegion](functions/findImplicitRecordRegion.md)
|
|
24
37
|
- [jsonRepair](functions/jsonRepair.md)
|
|
38
|
+
- [jsonRepairResult](functions/jsonRepairResult.md)
|
|
39
|
+
- [locateJsonCandidates](functions/locateJsonCandidates.md)
|
|
40
|
+
- [looksLikeSchemaEcho](functions/looksLikeSchemaEcho.md)
|
|
41
|
+
- [renderValidatorErrors](functions/renderValidatorErrors.md)
|
|
42
|
+
- [scoreCandidate](functions/scoreCandidate.md)
|
|
43
|
+
- [validateValue](functions/validateValue.md)
|
|
@@ -0,0 +1,63 @@
|
|
|
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`.
|
|
@@ -0,0 +1,71 @@
|
|
|
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)
|
|
@@ -0,0 +1,48 @@
|
|
|
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)
|