-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathTools_Docgen.res
105 lines (96 loc) · 2.18 KB
/
Tools_Docgen.res
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
type field = {
name: string,
docstrings: array<string>,
signature: string,
optional: bool,
deprecated?: string,
}
@tag("kind")
type constructorPayload = | @as("inlineRecord") InlineRecord({fields: array<field>})
type constructor = {
name: string,
docstrings: array<string>,
signature: string,
deprecated?: string,
payload?: constructorPayload,
}
type rec typeInSignature = {
path: string,
genericTypeParameters: array<typeInSignature>,
}
type signatureDetais = {
parameters: array<typeInSignature>,
returnType: typeInSignature,
}
@tag("kind")
type detail =
| @as("record") Record({items: array<field>})
| @as("variant") Variant({items: array<constructor>})
| @as("alias") Signature({details:signatureDetais})
type source = {
filepath: string,
line: int,
col: int,
}
@tag("kind")
type rec item =
| @as("value")
Value({
id: string,
docstrings: array<string>,
signature: string,
name: string,
deprecated?: string,
source: source,
/** Additional documentation of signature, if available. */
detail?: detail,
})
| @as("type")
Type({
id: string,
docstrings: array<string>,
signature: string,
name: string,
deprecated?: string,
source: source,
/** Additional documentation for constructors and record fields, if available. */
detail?: detail,
})
| @as("module")
Module({
id: string,
docstrings: array<string>,
deprecated?: string,
name: string,
moduletypeid?: string,
source: source,
items: array<item>,
})
| @as("moduleType")
ModuleType({
id: string,
docstrings: array<string>,
deprecated?: string,
name: string,
source: source,
items: array<item>,
})
| @as("moduleAlias")
ModuleAlias({
id: string,
docstrings: array<string>,
name: string,
source: source,
items: array<item>,
})
type doc = {
name: string,
deprecated: option<string>,
docstrings: array<string>,
source: source,
items: array<item>,
}
/**
`decodeFromJson(json)` parse JSON generated from `restool doc` command
*/
external decodeFromJson: Js.Json.t => doc = "%identity"