Skip to content

Crash on list with mixed dict and str items #27

Description

@roastduck

Hi,

In the following case

#' hello world
a: 1

a_list_of_mixed_dict_and_str:
  - x: 123
  - y

The following exception will be raised:

# Configuration Parameters Reference

Any information about this page goes here.

| Key | Value | Information |
| :-: | :-: | :-- |
| `a` | `1` | hello world |
Traceback (most recent call last):
  File "/home/rd/.local/bin/yamldoc", line 6, in <module>
    sys.exit(cli())
  File "/home/rd/.local/lib/python3.10/site-packages/yamldoc/cli.py", line 32, in cli
    yamldoc.main(**(vars(args)))
  File "/home/rd/.local/lib/python3.10/site-packages/yamldoc/parser.py", line 569, in main
    print(value.to_markdown())
  File "/home/rd/.local/lib/python3.10/site-packages/yamldoc/entries.py", line 144, in to_markdown
    output += entry.to_markdown(schema) + "\n"
AttributeError: 'ListElement' object has no attribute 'to_markdown'

It's fine with either one of - x: 123 or - y, but fails when both exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions