Closed
Description
Given the following rescript code:
type status =
| /** If this is started or not */ Started(t) | /** Stopped? */ Stopped | /** Now idle.*/ Idle
is supposed to be extracted as the following (partial) json:
{
"id": "DocExtractionRes.SomeInnerModule.status",
"kind": "type",
"name": "status",
"signature": "type status = Started(t) | Stopped | Idle",
"docstrings": [],
"detail":
{
"kind": "variant",
"items": [
{
"name": "Started",
"docstrings": ["If this is started or not"],
"signature": "Started(t)" <-- HERE
},
{
"name": "Stopped",
"docstrings": ["Stopped?"],
"signature": "Stopped"
},
{
"name": "Idle",
"docstrings": ["Now idle."],
"signature": "Idle"
}]
}
},
Especially mind the Started
constructor having it's payload present in the json details' signature
field!
Whereas it seems that the payload is not exported into it's json signature
field, if it is an inline-record:
e.g. the following code:
type someVariantWithInlineRecords = | /** This has inline records...*/ SomeStuff({offline: bool})
is currently tested to result in the following (partial) json:
{
"id": "DocExtractionRes.AnotherModule.someVariantWithInlineRecords",
"kind": "type",
"name": "someVariantWithInlineRecords",
"signature": "type someVariantWithInlineRecords =\\n | SomeStuff({offline: bool})",
"docstrings": ["Trying how it looks with an inline record in a variant."],
"detail":
{
"kind": "variant",
"items": [
{
"name": "SomeStuff",
"docstrings": ["This has inline records..."],
"signature": "SomeStuff" <-- HERE
}]
}
},
Even though the SomeStuff
Variant Constructor has a payload, it is not reflected in the extracted details contents.
I woult at least expect the detail item json to be:
{
"name": "SomeStuff",
"docstrings": ["This has inline records..."],
"signature": "SomeStuff({offline: bool})" <-- HERE
}
Is this a bug or a technical limitation?
edit:
Ideally, the docs of the inline-record would get extracted as well, by the same rules a "normal record" would be.
Metadata
Metadata
Assignees
Labels
No labels