Better error message for unsupported YAML file syntax
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 79
Description
**Is your feature request related to a problem? Please describe.**
The `loadYamlContent()` expects single-document YAML content, and does not support document separators. If a multi-document YAML file is provided, the current error message surfaced is _Unable to parse literal YAML value. Please ensure that it is well-formed._
Example multi-document YAML (this is [technically](https://www.rfc-editor.org/rfc/rfc9512.html#section-3.2) valid YAML content):
```yml
abc: 'def'
---
ghi: 'jkl'
```
Bicep:
```bicep
var mydata = loadYamlContent('test.yaml') // Unable to parse literal YAML value. Please ensure that it is well-formed (bicep[BCP340]).
```
**Describe the solution you'd like**
If possible, it would be nice to surface a more specific error message, e.g. something along the lines of _Bicep does not support multi-document YAML content_.
Contributor guide
Research direction
Start by tracing the loadYamlContent() entry point and how it handles YAML document separators. Reproduce the example with two YAML documents, then verify that the resulting diagnostic identifies unsupported multi-document YAML content while single-document YAML still parses normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- yaml
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100