ygot icon indicating copy to clipboard operation
ygot copied to clipboard

<validatedgostruct>.Validate() shadowing "Validate" yang model field

Open steiler opened this issue 2 years ago • 1 comments

The Nokia SROS yang model e.g. (https://github.com/nokia/7x50_YangModels) defines a validate leafs which causes issues with the chosen ygot naming.

Here is the reference to the leafs.

 find ./7x50_YangModels/latest_sros_22.2/ -name "*.yang" | xargs grep -A 5 -n "leaf validate "
./7x50_YangModels/latest_sros_22.2/nokia-submodule/nokia-conf-groups.yang:190278:                                            leaf validate {
./7x50_YangModels/latest_sros_22.2/nokia-submodule/nokia-conf-groups.yang-190279-                                                type boolean;
./7x50_YangModels/latest_sros_22.2/nokia-submodule/nokia-conf-groups.yang-190280-                                                default "false";
./7x50_YangModels/latest_sros_22.2/nokia-submodule/nokia-conf-groups.yang-190281-                                                description "Allow NETCONF validate operation";
./7x50_YangModels/latest_sros_22.2/nokia-submodule/nokia-conf-groups.yang-190282-                                            }
./7x50_YangModels/latest_sros_22.2/nokia-submodule/nokia-conf-groups.yang-190283-
--
./7x50_YangModels/latest_sros_22.2/nokia-submodule/nokia-conf-system-security-aaa.yang:1044:                            leaf validate {
./7x50_YangModels/latest_sros_22.2/nokia-submodule/nokia-conf-system-security-aaa.yang-1045-                                type boolean;
./7x50_YangModels/latest_sros_22.2/nokia-submodule/nokia-conf-system-security-aaa.yang-1046-                                default "false";
./7x50_YangModels/latest_sros_22.2/nokia-submodule/nokia-conf-system-security-aaa.yang-1047-                                description "Allow NETCONF validate operation";
./7x50_YangModels/latest_sros_22.2/nokia-submodule/nokia-conf-system-security-aaa.yang-1048-                            }
./7x50_YangModels/latest_sros_22.2/nokia-submodule/nokia-conf-system-security-aaa.yang-1049-

It would be good to have a less generic name for the actual Validate() method, which would not that easy interfear with yang definitions.

steiler avatar Apr 13 '22 13:04 steiler

ACK. We foresaw that this could happen - but it seemed better for the "common case" to re-use this word, as well as Unmarshal. Any change that results in this changing should do so behind a flag, -validate_fn_name=foo or something similar, since I think this is the first model that we have seen that has this issue.

r.

robshakir avatar Apr 13 '22 15:04 robshakir