Skip to content

YAML: group should also accept a key actions: like the Python API #931

@emersonknapp

Description

@emersonknapp

Description

Especially given the lack of documentation, children: in the YAML frontend is an opaque implementation detail. The Python API takes Group(actions=...) so I believe so should YAML.

Motivation

More intuitive usage for YAML

Design / Implementation Considerations

The children: special key is an implementation detail that is not present in XML because of its structure.

<group if="condition">
  <child />
</group>

In YAML the various lists of items that would go into the XML tag body are instead implemented as keys. The catch-all key is children:

group:
  if: condition
  children:
    - child:

In some other cases the children may be heterogenous attribute lists instead of Actions, so those are always implemented with an explicit name,

<node>
  <param name="x" value="y" />
</node>
- node:
    param:
      - name: x
        value: y

I think it's fine to continue to have children: as the fallback, especially to not break existing usage, but adding an additional option for actions: to match the Python API makes a lot of sense. This would apply to any other Actions that take child actions (as noted, attributes must always be explicitly named so that's not a problem), if there are any

Additional Information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions