You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support JSON Marshalling augments to compressed schemas (#572)
* Correctly marshal JSON for augments in compressed containers.
* Extend `findSchemaPath` and `findMapPaths` to return a path of module names that correspond with the paths.
e.g. "(shadow-)path:config/name|name" -> "(shadow-)module:modA/modB|modA"
* Removed a small existing hack whereby error from `InstantiatingModule` was being ignored.
* Change `structJSON` to use the corresponding modules when determining whether to prefix node names with corresponding module names.
* Added helper `structTagToLibModules` sister to existing `structTagToLibPaths` to extract modules tag.
Testing:
* Added compressed augment unit test for `findMapPaths` and JSON marshalling.
* Added integration test for generating a compressed augment.
* Other integration tests updated to test `module` and `shadow-module` generation.
Other Testing Changes:
* Changed tests for `findSchemaPath` and `findMapPaths` to create `yang.Entry` objects using `Modules.Process` instead of manually creating them.
* Populated `.Modules` field for other tests in order to avoid errors due to above-mentioned hack being removed.
* Move function to util and refactor structJSON.
* Update goyang to v0.2.9
returnnil, fmt.Errorf("FindSchemaPath(shadowSchemaPaths:%v): field name %q does not exist in Directory %s", shadowSchemaPaths, fieldName, parent.Path)
160
+
returnnil, nil, fmt.Errorf("FindSchemaPath(shadowSchemaPaths:%v): field name %q does not exist in Directory %s", shadowSchemaPaths, fieldName, parent.Path)
// Return the elements that are not common between the two paths.
164
176
// Since the field is necessarily a child of the parent, then to
165
177
// determine those elements of the field's path that are not contained
166
178
// in the parent's, we walk from index X of the field's path (where X
167
179
// is the number of elements in the path of the parent).
168
180
iflen(fieldSlicePath) <len(parent.Path) {
169
-
returnnil, fmt.Errorf("FindSchemaPath(shadowSchemaPaths:%v): field %v is not a valid child of %v", shadowSchemaPaths, fieldSlicePath, parent.Path)
181
+
returnnil, nil, fmt.Errorf("FindSchemaPath(shadowSchemaPaths:%v): field %v is not a valid child of %v", shadowSchemaPaths, fieldSlicePath, parent.Path)
0 commit comments