Erik-Lamers1 / vnet-manager

Virtual network manager - Manages containers and VMs to create a virtual network setup
MIT License
11 stars 7 forks source link

Non-existent keys in configuration file do not trigger an error #64

Open Southparkfan opened 10 months ago

Southparkfan commented 10 months ago

Business as usual, I forgot my ☕:

[snip]
  router3:
    type: router
    interfaces:
      eth123:
        epv6: 2001:db8:beef:29::3/64
        mac: '42:42:42:42:09:03'
        bridge: 9
[snip]

Obviously, 'evp6' should have been 'ipv6'. However, I didn't get a hard failure during vnet-manager create. A configuration without any IPv4 or IPv6 address can be very legitimate, but a configuration with non-existent keys should trigger an error.

Erik-Lamers1 commented 10 months ago

What do you mean with non-existent keys exactly? Keys inside a YAML block, which is not used for anything in Vnet-manager?

Catching typos like these is very hard to do with a validator. Maybe it would be better to write a JSON schema for people to load in their IDE, such that it will provide auto-completion on the configuration file.

Southparkfan commented 10 months ago

Yes, that's what I meant. A JSON schema would be perfect for validation, both in IDE (for comfort) and in the validation code itself (to avoid silent failures).