Skip to content

Commit

Permalink
lib.yang.path/path_data: handle rpc schema
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Nov 11, 2022
1 parent 3cd57c2 commit c764412
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/lib/yang/path.lua
Expand Up @@ -84,6 +84,10 @@ local function extract_grammar_node(grammar, name)
function handlers.array ()
error("Invalid path: trying to access '"..name.."' in leaf-list.")
end
-- rpc
function handlers.sequence (node)
if node.members[name] then return node.members[name] end
end
local node = assert(handlers[grammar.type], grammar.type)(grammar)
return node or error("Invalid path: '"..name.."' is not in schema.")
end
Expand Down
4 changes: 2 additions & 2 deletions src/lib/yang/path_data.lua
Expand Up @@ -51,11 +51,11 @@ local function compute_list_getter(key, getter)
end

local function compute_getter(grammar, part, getter)
if grammar.type == 'struct' then
if grammar.type == 'struct' or grammar.type == 'sequence' then
getter = compute_struct_getter(part.name, getter)
grammar = part.grammar
else
error("Invalid path: '"..name.."' is not a container")
error("Invalid path: '"..part.name.."' is not a container")
end
if part.key then
if grammar.type == 'array' then
Expand Down

0 comments on commit c764412

Please sign in to comment.