Reject duplicate keys and multiple documents instead of silently editing
them. Validate rendered output before writing so edits cannot leave
dangling aliases or introduce duplicate keys. Errors leave files untouched.
Apply the same validation to YAMLText.
JSONToYAML now rejects duplicate keys without creating or replacing the
target, including omp's models.json conversion. Treat a document containing
only --- as empty, matching the top-level YAML editor.
Add regression tests for document loss, dangling aliases and duplicate
keys, alongside existing-behavior coverage for malformed input.
Changing Goose's model or effort could insert a key inside a multiline flow
collection or append a duplicate when the existing key was quoted. Locate
entries through parsed keys, keep complete values together, and validate the
result before writing it. Read and delete use decoded key names too.
Keep other entries, document markers, comments and block-scalar blank lines
in place. Reject invalid input, multiple documents and layouts that cannot
be edited safely as whole lines, with the file path in the error.
Regression tests reproduce the flow-value and quoted-key failures and cover
multiline values, unchanged surrounding content and failed writes.