Skip to content

CLI Workflow[Template] documentation generator #1447

@elliotgunton

Description

@elliotgunton

Is your feature request related to a problem? Please describe.
Originally described in #670. Would be good to get consistent docs for Workflow[Templates].

Describe the solution you'd like
hera generate docs FROM [--to <filepath>] [-o yaml|json|markdown]

Which would output the input/output interface of the templates in the Workflow[Template], as well as any doc strings in labels/annotations. e.g. in markdown form, it might look something like:

# Hello World Workflow

This is a test workflow

entrypoint: [Hello World](#hello world)

## Hello World

This prints "Hello <name>" to stdout.

### Inputs

Param | Type | Default
--- | --- | ---
name | str | "World"

which renders as:

Hello World Workflow

This is a test workflow

entrypoint: [Hello World](#hello world)

Hello World

This prints "Hello " to stdout.

Inputs

Param Type Default
name str "World"

from a workflow like:

@script(
    constructor="runner",
    image="something:v1",
    annotations={"com.hera.docstring": 'This prints "Hello <name>" to stdout.'},
)
def hello(name: str):
    print("Hello, {name}!".format(name=name))


with Workflow(
    generate_name="hello-world-",
    entrypoint="hello",
    arguments={"s": "world"},
    annotations={
        "com.hera.docstring": "This is a test workflow",
    },
) as w:
    hello()

Unsure about json/yaml format but probably useful for devs to create their own docs.

Describe alternatives you've considered
Write your own custom thing.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions