Bug Description
The encoder creates TOON output that fails to parse with the decoder due to indentation mismatch.
Steps to Reproduce
# Encode JSON to TOON
echo '{"questions":[{"question":"백엔드","header":"백엔드","options":[{"label":"FastAPI","description":"Python"},{"label":"Django","
description":"Python"}],"multiSelect":false}]}' | toon
# Output (generated by encoder):
questions[1]:
- question: 백엔드
header: 백엔드
options[2]{label,description}:
FastAPI,Python
Django,Python
multiSelect: false
# Try to decode the same output
echo 'questions[1]:
- question: 백엔드
header: 백엔드
options[2]{label,description}:
FastAPI,Python
Django,Python
multiSelect: false' | toon --decode
Error
Error: Parse error at line 5, column 12: Invalid indentation for tabular row: expected 6 spaces, found 4
Expected Behavior
The encoder output should be decodable by the decoder (round-trip compatibility).
Environment
- Rust: 1.92.0
- toon-format: 0.4.1
- OS: WSL2 (Linux)
Proposed Fix
The encoder and decoder should agree on indentation rules for tabular rows. Either:
1. Fix encoder to use 6 spaces for tabular rows
2. Fix decoder to accept 4 spaces for tabular rows
Bug Description
The encoder creates TOON output that fails to parse with the decoder due to indentation mismatch.
Steps to Reproduce