Skip to content

[Bug] aar-doc defaults generates dict for type of object list of dict when options was specified #203

@seamus-45

Description

@seamus-45

Description

If an element is declared in arguments_specs.yml as a list of dictionaries and has both a default value and options, then the options are assigned to the variable instead of the default value. This results in a change in the variable type (dictionary instead of list) and an incorrect value.

Reproduction steps

  1. Create a role with e.g. the following meta/argument_specs.yml:
argument_specs:
  main:
    short_description: Install php packages and modules
    options:
      php_ver:
        type: int
        required: true
        default: 84
        description: "php version without dots"
      php_additional_pools:
        type: list
        elements: dict
        required: false
        description: "additional php pools"
        default: []
        options:
          name:
            type: str
            required: true
            default: null
            description: "pool name"
  1. Create the defaults using aar-doc:
$ aar-doc rolepath defaults

Current Behavior

The following invalid defaults file is generated:

---
# Automatically generated by aar-doc
# php version without dots
php_ver: 84
# additional php pools
php_additional_pools:
  # pool name
  name: null

Expected Behavior

aar-doc defaults should create:

---
# Automatically generated by aar-doc
# php version without dots
php_ver: 84
# additional php pools
php_additional_pools: []

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions