stardoc icon indicating copy to clipboard operation
stardoc copied to clipboard

Provider `init` callback needs to be documented

Open tetromino opened this issue 2 years ago • 0 comments

If a provider has init specified, we want to document it.

In other words,

def _my_info_init(a, c = "hello"):
    """
    MyInfo constructor

    Args:
          a: Value of field a
          c: Value to frobnicate
    """
    return {"a": a, "b": frobnicate(c)}

MyInfo = provider(
    doc = """This is my provider""",
    fields = {
        "a": "Field a",
        "b": "Field b (frobnicated)",
    },
    init = _my_info_init,
)

should get documented as something like


MyInfo

This is my provider

MyInfo(a, c)

MyInfo constructor

CONSTRUCTOR PARAMETERS

Name Description Default Value
a Value of field a none
c Value to frobnicate "hello"

FIELDS

Name Description
a Field a
b Field b (frobnicated)

This is a prerequisite for switching to stardoc / starlark_doc_extract for generating Bazel's own documentation.

tetromino avatar Aug 16 '23 14:08 tetromino