OneDrive / apidoctor

Application for validating API documentation and generating test cases
Other
40 stars 27 forks source link

YAML validation throws false positive #274

Closed jasonjoh closed 1 month ago

jasonjoh commented 4 months ago

YAML validation is too simplistic, and flags YAML mult-line arrays as Incorrect YAML header format.

New TOC generation tool uses an array for a property called toc.keywords. Putting the value like this:

toc.keywords:
- keyword1
- keyword2

Results in an error. Putting it like this passes:

toc.keywords: [ keyword1, keyword2 ]

Issue is in ParseYamlMetdata, which seems to assume every property will be a name/value pair:

https://github.com/OneDrive/apidoctor/blob/7d2f4a3b6d6689dbf774323b078d00ca876818ad/ApiDoctor.Validation/DocFile.cs#L398-L399

It would be better to replace this custom processing of YAML with a library like YamlDotNet, which can handle all of the YAML formats, and can deserialize into a strongly-typed object.