Skip to content

feat: show line numbers in zone validation errors #32

Description

@cl8dep

Feature Request

When dns-sync validate, plan, or apply reports a zone validation error, it currently shows the record name and type but not the location in the YAML file:

✗ araelespinosa.dev. MX (priority 10): exchange value is empty

It would be more helpful to also show the file and line number:

✗ araelespinosa.dev. MX (priority 10): exchange value is empty
    → zones/araelespinosa.dev.yaml:14

Implementation notes

This requires propagating source location metadata (file path + line number) from the YAML parser through to the DnsRecord model. YamlDotNet supports this via IYamlTypeConverter and Mark objects on parser events.

Rough approach:

  • Add an optional SourceLocation property to DnsRecord (file path + line number)
  • Populate it in YamlProvider.ParseZoneYaml using YamlDotNet's low-level parser API or a post-parse mapping
  • Include it in ZoneValidator error messages when present

Non-trivial — the current parser uses high-level deserialization which discards position info. Switching to the low-level API or a custom converter would be needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions