Skip to content

docgen should name module type for explicitly annotated module type #1010

Closed
@woeps

Description

@woeps

Once #1009 is implemented, I think we should include the annotated module type in the generated json:

// Example.res
module type MT = {
  let x: int
}

module M: MT = {
  let x = 42
}

should generate

{
  "name": "Example",
  "docstrings": [],
  "source": {
    "filepath": "src/Example.res",
    "line": 1,
    "col": 1
  },
  "items": [
  {
    "id": "Example.MT",
    "name": "MT",
    "kind": "moduleType",
    "docstrings": [],
    "source": {
      "filepath": "src/Example.res",
      "line": 1,
      "col": 13
    },
    "items": [
    {
      "id": "Example.MT.x",
      "kind": "value",
      "name": "x",
      "signature": "let x: int",
      "docstrings": [],
      "source": {
        "filepath": "src/Example.res",
        "line": 2,
        "col": 3
      }
    }]
  }, 
  {
    "id": "Example.M",
    "name": "M",
    "kind": "module",
    "moduleType": "Example.MT"  <-- this is new!
    "docstrings": [],
    "source": {
      "filepath": "src/Example.res",
      "line": 5,
      "col": 8
    },
    "items": [
    {
      "id": "Example.M.x",
      "kind": "value",
      "name": "x",
      "signature": "let x: int",
      "docstrings": [],
      "source": {
        "filepath": "src/Example.res",
        "line": 6,
        "col": 7
      }
    }]
  }]
}

Note in the above example, a moduleType field got added and id of the annotated module type was used as a value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions