Skip to content

Commit d8490aa

Browse files
aspeddrozth
authored andcommitted
only emit deprecated
1 parent ec22484 commit d8490aa

File tree

4 files changed

+10
-55
lines changed

4 files changed

+10
-55
lines changed

analysis/src/DocExtraction.ml

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,8 @@ let stringifyDetail ?(indentation = 0) (detail : docItemDetail) =
8282
[
8383
("fieldName", Some (wrapInQuotes fieldDoc.fieldName));
8484
( "deprecated",
85-
Some
86-
(string_of_bool (Option.is_some fieldDoc.deprecated))
87-
);
88-
( "deprecatedMessage",
8985
match fieldDoc.deprecated with
90-
| Some msg -> Some (wrapInQuotes msg)
86+
| Some d -> Some (wrapInQuotes d)
9187
| None -> None );
9288
("optional", Some (string_of_bool fieldDoc.optional));
9389
( "docstrings",
@@ -110,12 +106,8 @@ let stringifyDetail ?(indentation = 0) (detail : docItemDetail) =
110106
( "constructorName",
111107
Some (wrapInQuotes constructorDoc.constructorName) );
112108
( "deprecated",
113-
Some
114-
(string_of_bool
115-
(Option.is_some constructorDoc.deprecated)) );
116-
( "deprecatedMessage",
117109
match constructorDoc.deprecated with
118-
| Some msg -> Some (wrapInQuotes msg)
110+
| Some d -> Some (wrapInQuotes d)
119111
| None -> None );
120112
( "docstrings",
121113
Some (stringifyDocstrings constructorDoc.docstrings) );
@@ -139,32 +131,30 @@ let stringifyLoc loc ~indentation =
139131
let rec stringifyDocItem ?(indentation = 0) ~originalEnv (item : docItem) =
140132
let open Protocol in
141133
match item with
142-
| Value {id; docstring; signature; name; loc; deprecated} ->
134+
| Value {id; docstring; signature; name; deprecated} ->
143135
stringifyObject ~startOnNewline:true ~indentation
144136
[
145137
("id", Some (wrapInQuotes id));
146138
("kind", Some (wrapInQuotes "value"));
147139
("name", Some (name |> Json.escape |> wrapInQuotes));
148-
("deprecated", Some (string_of_bool (Option.is_some deprecated)));
149-
( "deprecatedMessage",
140+
( "deprecated",
150141
match deprecated with
151-
| Some msg -> Some (wrapInQuotes msg)
142+
| Some d -> Some (wrapInQuotes d)
152143
| None -> None );
153144
(* ("location", Some (stringifyLoc loc ~indentation)); *)
154145
( "signature",
155146
Some (signature |> String.trim |> Json.escape |> wrapInQuotes) );
156147
("docstrings", Some (stringifyDocstrings docstring));
157148
]
158-
| Type {id; docstring; signature; name; loc; deprecated; detail} ->
149+
| Type {id; docstring; signature; name; deprecated; detail} ->
159150
stringifyObject ~startOnNewline:true ~indentation
160151
[
161152
("id", Some (wrapInQuotes id));
162153
("kind", Some (wrapInQuotes "type"));
163154
("name", Some (name |> Json.escape |> wrapInQuotes));
164-
("deprecated", Some (string_of_bool (Option.is_some deprecated)));
165-
( "deprecatedMessage",
155+
( "deprecated",
166156
match deprecated with
167-
| Some msg -> Some (wrapInQuotes msg)
157+
| Some d -> Some (wrapInQuotes d)
168158
| None -> None );
169159
(* ("location", Some (stringifyLoc loc ~indentation)); *)
170160
("signature", Some (signature |> Json.escape |> wrapInQuotes));
@@ -199,10 +189,9 @@ and stringifyDocsForModule ?(indentation = 0) ~originalEnv (d : docsForModule) =
199189
stringifyObject ~startOnNewline:true ~indentation
200190
[
201191
("name", Some (wrapInQuotes d.name));
202-
("deprecated", Some (string_of_bool (Option.is_some d.deprecated)));
203-
( "deprecatedMessage",
192+
( "deprecated",
204193
match d.deprecated with
205-
| Some msg -> Some (wrapInQuotes msg)
194+
| Some d -> Some (wrapInQuotes d)
206195
| None -> None );
207196
("docstrings", Some (stringifyDocstrings d.docstring));
208197
( "items",

analysis/tests/src/expected/DocExtraction2.res.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,19 @@ preferring found resi file for impl: src/DocExtraction2.resi
44

55
{
66
"name": "DocExtraction2",
7-
"deprecated": false,
87
"docstrings": ["Module level doc here."],
98
"items": [
109
{
1110
"id": "DocExtraction2.t",
1211
"kind": "type",
1312
"name": "t",
14-
"deprecated": false,
1513
"signature": "type t",
1614
"docstrings": ["Type t is pretty cool."]
1715
},
1816
{
1917
"id": "DocExtraction2.make",
2018
"kind": "value",
2119
"name": "make",
22-
"deprecated": false,
2320
"signature": "let make: unit => t",
2421
"docstrings": ["Makerz of stuffz."]
2522
},
@@ -29,22 +26,19 @@ preferring found resi file for impl: src/DocExtraction2.resi
2926
"item":
3027
{
3128
"name": "InnerModule",
32-
"deprecated": false,
3329
"docstrings": [],
3430
"items": [
3531
{
3632
"id": "DocExtraction2.InnerModule.t",
3733
"kind": "type",
3834
"name": "t",
39-
"deprecated": false,
4035
"signature": "type t",
4136
"docstrings": ["This type is also t."]
4237
},
4338
{
4439
"id": "DocExtraction2.InnerModule.make",
4540
"kind": "value",
4641
"name": "make",
47-
"deprecated": false,
4842
"signature": "let make: unit => t",
4943
"docstrings": ["Maker of tea."]
5044
}]

analysis/tests/src/expected/DocExtraction2.resi.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,19 @@ extracting docs for src/DocExtraction2.resi
33

44
{
55
"name": "DocExtraction2",
6-
"deprecated": false,
76
"docstrings": ["Module level doc here."],
87
"items": [
98
{
109
"id": "DocExtraction2.t",
1110
"kind": "type",
1211
"name": "t",
13-
"deprecated": false,
1412
"signature": "type t",
1513
"docstrings": ["Type t is pretty cool."]
1614
},
1715
{
1816
"id": "DocExtraction2.make",
1917
"kind": "value",
2018
"name": "make",
21-
"deprecated": false,
2219
"signature": "let make: unit => t",
2320
"docstrings": ["Makerz of stuffz."]
2421
},
@@ -28,22 +25,19 @@ extracting docs for src/DocExtraction2.resi
2825
"item":
2926
{
3027
"name": "InnerModule",
31-
"deprecated": false,
3228
"docstrings": [],
3329
"items": [
3430
{
3531
"id": "DocExtraction2.InnerModule.t",
3632
"kind": "type",
3733
"name": "t",
38-
"deprecated": false,
3934
"signature": "type t",
4035
"docstrings": ["This type is also t."]
4136
},
4237
{
4338
"id": "DocExtraction2.InnerModule.make",
4439
"kind": "value",
4540
"name": "make",
46-
"deprecated": false,
4741
"signature": "let make: unit => t",
4842
"docstrings": ["Maker of tea."]
4943
}]

analysis/tests/src/expected/DocExtractionRes.res.txt

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,24 @@ extracting docs for src/DocExtractionRes.res
33

44
{
55
"name": "DocExtractionRes",
6-
"deprecated": false,
76
"docstrings": ["Module level documentation goes here."],
87
"items": [
98
{
109
"id": "DocExtractionRes.t",
1110
"kind": "type",
1211
"name": "t",
13-
"deprecated": false,
1412
"signature": "type t = {name: string, online: bool}",
1513
"docstrings": ["This type represents stuff."],
1614
"detail":
1715
{
1816
"kind": "record",
1917
"fieldDocs": [{
2018
"fieldName": "name",
21-
"deprecated": false,
2219
"optional": false,
2320
"docstrings": ["The name of the stuff."],
2421
"signature": "string"
2522
}, {
2623
"fieldName": "online",
27-
"deprecated": false,
2824
"optional": false,
2925
"docstrings": ["Whether stuff is online."],
3026
"signature": "bool"
@@ -35,15 +31,13 @@ extracting docs for src/DocExtractionRes.res
3531
"id": "DocExtractionRes.make",
3632
"kind": "value",
3733
"name": "make",
38-
"deprecated": false,
3934
"signature": "let make: string => t",
4035
"docstrings": ["Create stuff.\n\n```rescript example\nlet stuff = make(\"My name\")\n```"]
4136
},
4237
{
4338
"id": "DocExtractionRes.asOffline",
4439
"kind": "value",
4540
"name": "asOffline",
46-
"deprecated": false,
4741
"signature": "let asOffline: t => t",
4842
"docstrings": ["Stuff goes offline."]
4943
},
@@ -53,14 +47,12 @@ extracting docs for src/DocExtractionRes.res
5347
"item":
5448
{
5549
"name": "SomeInnerModule",
56-
"deprecated": false,
5750
"docstrings": ["Another module level docstring here."],
5851
"items": [
5952
{
6053
"id": "DocExtractionRes.SomeInnerModule.status",
6154
"kind": "type",
6255
"name": "status",
63-
"deprecated": false,
6456
"signature": "type status = Started(t) | Stopped | Idle",
6557
"docstrings": [],
6658
"detail":
@@ -69,19 +61,16 @@ extracting docs for src/DocExtractionRes.res
6961
"constructorDocs": [
7062
{
7163
"constructorName": "Started",
72-
"deprecated": false,
7364
"docstrings": ["If this is started or not"],
7465
"signature": "Started(t)"
7566
},
7667
{
7768
"constructorName": "Stopped",
78-
"deprecated": false,
7969
"docstrings": ["Stopped?"],
8070
"signature": "Stopped"
8171
},
8272
{
8373
"constructorName": "Idle",
84-
"deprecated": false,
8574
"docstrings": ["Now idle."],
8675
"signature": "Idle"
8776
}]
@@ -91,15 +80,13 @@ extracting docs for src/DocExtractionRes.res
9180
"id": "DocExtractionRes.SomeInnerModule.validInputs",
9281
"kind": "type",
9382
"name": "validInputs",
94-
"deprecated": false,
9583
"signature": "type validInputs = [\\n | #\\\"needs-escaping\\\"\\n | #something\\n | #status(status)\\n | #withPayload(int)\\n]",
9684
"docstrings": ["These are all the valid inputs."]
9785
},
9886
{
9987
"id": "DocExtractionRes.SomeInnerModule.callback",
10088
"kind": "type",
10189
"name": "callback",
102-
"deprecated": false,
10390
"signature": "type callback = (t, ~status: status) => unit",
10491
"docstrings": []
10592
}]
@@ -111,7 +98,6 @@ extracting docs for src/DocExtractionRes.res
11198
"item":
11299
{
113100
"name": "AnotherModule",
114-
"deprecated": false,
115101
"docstrings": ["Mighty fine module here too!"],
116102
"items": [
117103
{
@@ -124,23 +110,20 @@ extracting docs for src/DocExtractionRes.res
124110
"id": "DocExtractionRes.AnotherModule.callback",
125111
"kind": "type",
126112
"name": "callback",
127-
"deprecated": false,
128113
"signature": "type callback = SomeInnerModule.status => unit",
129114
"docstrings": ["Testing what this looks like."]
130115
},
131116
{
132117
"id": "DocExtractionRes.AnotherModule.isGoodStatus",
133118
"kind": "value",
134119
"name": "isGoodStatus",
135-
"deprecated": false,
136120
"signature": "let isGoodStatus: SomeInnerModule.status => bool",
137121
"docstrings": []
138122
},
139123
{
140124
"id": "DocExtractionRes.AnotherModule.someVariantWithInlineRecords",
141125
"kind": "type",
142126
"name": "someVariantWithInlineRecords",
143-
"deprecated": false,
144127
"signature": "type someVariantWithInlineRecords = SomeStuff({offline: bool})",
145128
"docstrings": ["Trying how it looks with an inline record in a variant."],
146129
"detail":
@@ -149,7 +132,6 @@ extracting docs for src/DocExtractionRes.res
149132
"constructorDocs": [
150133
{
151134
"constructorName": "SomeStuff",
152-
"deprecated": false,
153135
"docstrings": ["This has inline records..."],
154136
"signature": "SomeStuff"
155137
}]
@@ -159,7 +141,6 @@ extracting docs for src/DocExtractionRes.res
159141
"id": "DocExtractionRes.AnotherModule.domRoot",
160142
"kind": "type",
161143
"name": "domRoot",
162-
"deprecated": false,
163144
"signature": "type domRoot = unit => ReactDOM.Client.Root.t",
164145
"docstrings": ["Callback to get the DOM root..."]
165146
}]
@@ -171,22 +152,19 @@ extracting docs for src/DocExtractionRes.res
171152
"item":
172153
{
173154
"name": "ModuleWithThingsThatShouldNotBeExported",
174-
"deprecated": false,
175155
"docstrings": [],
176156
"items": [
177157
{
178158
"id": "DocExtractionRes.ModuleWithThingsThatShouldNotBeExported.t",
179159
"kind": "type",
180160
"name": "t",
181-
"deprecated": false,
182161
"signature": "type t",
183162
"docstrings": ["The type t is stuff."]
184163
},
185164
{
186165
"id": "DocExtractionRes.ModuleWithThingsThatShouldNotBeExported.make",
187166
"kind": "value",
188167
"name": "make",
189-
"deprecated": false,
190168
"signature": "let make: unit => t",
191169
"docstrings": ["The maker of stuff!"]
192170
}]

0 commit comments

Comments
 (0)