Open robshakir opened 6 years ago
sgtm, my only suggestion would be to consider IgnorePaths since this may be a more common scenario? i.e. validate all refs except these ones I'm excluding.
+1 on what ostromart said, I thought about this again and I think that we will need the option to specify what to ignore. Maybe the API can support both includes and ignores?
SGTM -- it's pretty trivial to implement both.
Currently,
LeafrefOptions
allows missing references to be ignored during aValidate
call. For example, where a leafref references some entity that is missing. However, it does this over the whole tree - essentially turning off all reference validation.Some callers may know the subset of the tree that they expect to be populated - e.g., a method that is populating all of the BGP subtree may expect peer groups to exist, but doesn't know that routing policy has been populated. Given that this is the case, we should extend the
LeafrefOptions
struct to take a set of path expressions that specify a mask for the paths that are validated.The API to this feature is suggested to look something like the following:
Where the
Paths
field is a string slice containing a set of regular expressions which match gNMI path format strings.