You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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,
)
…cted docs
Note that init's signature may have little relation to the list of fields of
the constructed provider, so exposing a full StarlarkFunctionInfo for the init
is appropriate.
Working towards bazelbuild/stardoc#182
PiperOrigin-RevId: 559112284
Change-Id: I5a4821cde492676553a40400ff1e7831a069294f
tetromino
added a commit
to tetromino/stardoc
that referenced
this issue
May 20, 2024
If a provider has a custom `init` callback, we want the summary blurb
to show `init`'s parameters (since these are what the user will interact
with); we have to render constructor paramaters and fields separately
(and using separate html anchors) since there is not necessarily a 1-1
relationship between them, and since they may have different docs.
Fixesbazelbuild#182
By default, we want the following behavior:
* Custom init callback specified
* The set of parameters for the init callback equals the set of
fields for the provider; and the docs for the init callback's
parameters are either empty or equal to corresponding field docs
* Some init parameters have a default value:
-> Render a single "Fields" table with 3 columns (name, doc,
default value)
* ... otherwise
-> Render a single "Fields" table with 2 columns
* ... otherwise
-> Render two tables - "Constructor parameters" and "Fields" - with
the links from the summary blurb (interfixed with "_init")
leading to the parameters table (not the fields table)
* ... otherwise
-> Trivial case - single "Fields" table (as before).
Fixes#182
If a provider has
init
specified, we want to document it.In other words,
should get documented as something like
MyInfo
This is my provider
MyInfo constructor
CONSTRUCTOR PARAMETERS
"hello"
FIELDS
This is a prerequisite for switching to stardoc / starlark_doc_extract for generating Bazel's own documentation.
The text was updated successfully, but these errors were encountered: