YAML editor does not support tagged mappings (!tag / !!map) and reports cascading parse errors
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 935
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 17
Description
### Apache NetBeans version
Apache NetBeans 30
### What happened
The YAML editor reports syntax errors for valid YAML documents that use tagged mappings.
For example, the following YAML is marked as invalid:
```yaml
customTaggedMapping: !example
name: test
enabled: true
plainMapping:
name: test
enabled: true
```
The editor reports:
```text
Mapping values are not allowed here.
```
on the nested mapping entries.
The same behavior occurs when using the standard YAML tag `!!map`:
```yaml
standardTaggedMapping: !!map
name: test
enabled: true
```
I also tested the flow-style equivalent:
```yaml
customTaggedMapping: !example { name: test, enabled: true }
standardTaggedMapping: !!map { name: test, enabled: true }
plainMapping: { name: test, enabled: true }
```
In this case NetBeans reports:
```text
Expected '', but found ''
```
for the second and third lines.
The YAML validates in external YAML validators and is accepted by the application consuming the file. The issue appears to be that NetBeans does not correctly parse tagged nodes and subsequently loses synchronization with the document structure, causing additional valid mappings to be reported as errors.
Expected behavior:
* Tagged mappings should be accepted as valid YAML syntax.
* Unknown custom tags such as `!example` may optionally generate a warning, but should not cause syntax errors.
* Standard YAML tags such as `!!map` should be accepted without syntax errors.
### Language / Project Type / NetBeans Component
YAML Editor
### How to reproduce
1. Open Apache NetBeans IDE 30.
2. Create a new file named `test.yaml`.
3. Paste the following content:
```yaml
a: !!map
b: 1
c:
d: 2
```
4. Save the file.
5. Observe that NetBeans reports:
```text
Mapping values are not allowed here.
```
on the line:
```yaml
b: 1
```
As an additional test, replace the contents with:
```yaml
a: !example
b: 1
c:
d: 2
```
The same error is reported.
As a control test, the following YAML is accepted:
```yaml
a:
b: 1
c:
d: 2
```
Minimal reproducer:
```yaml
a: !!map
b: 1
```
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Linux version 7.0.12-201.fc44.x86_64 running on amd64; UTF-8; en_US (nb)
### JDK
OpenJDK Runtime Environment 25.0.3
### Apache NetBeans packaging
Other
### Anything else
The problem occurs every time with tagged mappings.
One observation is that the parser appears to become confused after encountering a tagged node. Subsequent valid mappings are then reported as invalid as well, suggesting the YAML parser/editor loses synchronization with the document structure after the tagged mapping is encountered.
Because the issue also occurs with the standard YAML tag `!!map`, this does not appear to be limited to application-specific tags such as `!example`.
### Are you willing to submit a pull request?
No
Contributor guide
Research direction
Start by reproducing the issue in a new test.yaml using the minimal !!map and !example examples, then compare the control mapping. Trace how the YAML editor handles tagged nodes and parser errors. Done means tagged mappings are accepted without syntax errors and subsequent valid mappings are not reported as errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- yaml
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 64/100