Skip to content

Commit a67efa5

Browse files
committed
add full id
1 parent 0114650 commit a67efa5

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

tools/npm/Tools_Docgen.res

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type rec item =
5656
docstrings: array<string>,
5757
deprecated?: string,
5858
name: string,
59+
moduletypeid?: string,
5960
source: source,
6061
items: array<item>,
6162
})

tools/npm/Tools_Docgen.resi

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ type rec item =
5555
docstrings: array<string>,
5656
deprecated?: string,
5757
name: string,
58+
moduletypeid?: string,
5859
source: source,
5960
items: array<item>,
6061
})

tools/src/tools.ml

+13-6
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ and docsForModule = {
6464
docstring: string list;
6565
deprecated: string option;
6666
name: string;
67-
moduletype: string option;
67+
moduletypeid: string option;
6868
source: source;
6969
items: docItem list;
7070
}
@@ -203,8 +203,8 @@ let rec stringifyDocItem ?(indentation = 0) ~originalEnv (item : docItem) =
203203
match m.deprecated with
204204
| Some d -> Some (wrapInQuotes d)
205205
| None -> None );
206-
( "moduletype",
207-
match m.moduletype with
206+
( "moduletypeid",
207+
match m.moduletypeid with
208208
| Some path -> Some (wrapInQuotes path)
209209
| None -> None );
210210
("docstrings", Some (stringifyDocstrings m.docstring));
@@ -368,7 +368,7 @@ let extractDocs ~entryPointFile ~debug =
368368
id = modulePath |> List.rev |> ident;
369369
docstring = structure.docstring |> List.map String.trim;
370370
name = structure.name;
371-
moduletype = None;
371+
moduletypeid = None;
372372
deprecated = structure.deprecated;
373373
source =
374374
{
@@ -452,7 +452,7 @@ let extractDocs ~entryPointFile ~debug =
452452
{
453453
id = modulePath |> List.rev |> ident;
454454
name = m.name;
455-
moduletype = None;
455+
moduletypeid = None;
456456
docstring = item.docstring @ m.docstring;
457457
deprecated = item.deprecated;
458458
source;
@@ -489,7 +489,14 @@ let extractDocs ~entryPointFile ~debug =
489489
extractDocsForModule ~modulePath:(m.name :: modulePath)
490490
m
491491
in
492-
Some (Module {docs with moduletype = Some (Path.name p)})
492+
Some
493+
(Module
494+
{
495+
docs with
496+
moduletypeid =
497+
Some
498+
(makeId ~identifier:(Path.name p) modulePath);
499+
})
493500
| _ -> None);
494501
}
495502
in

tools/tests/src/expected/DocExtractionRes.res.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@
311311
"id": "DocExtractionRes.M",
312312
"name": "M",
313313
"kind": "module",
314-
"moduletype": "Example",
314+
"moduletypeid": "DocExtractionRes.Example",
315315
"docstrings": ["implementation of Example module type"],
316316
"source": {
317317
"filepath": "src/DocExtractionRes.res",

0 commit comments

Comments
 (0)