Avoiding get_case call after get_next_object

I have implemented the get_next_object callback but my list contains a choice statement (something like the example below):

list adjacency {
  key "index";
  leaf index {
    type uint8;
  }
  choice adj-type {
    mandatory "true";
    case simple {
      leaf interface {
        type string;
      }
      leaf gateway {
        type string;
      }
      leaf uptime {
        type string;
      }
    }
    case special {
      leaf special-type {
        type enumeration {
          enum blackhole {}
          enum unreachable {}
        }
      }
    }
  }
}

After the call to get_next_object, there is a call to get_case to resolve the case of the list entry. The problem is that this operation can be quite expensive since the mapping is between a keyed list (shown above) and a keyless list which is slowing down our performance.

Is there a way to avoid the additional call to get_case and return the case in the get_next_object return?

I have tried returning the case value in the Object return but I get the following error:

get_next_object_cb(T, KP, Prev) ->
    ...
    {ok,
       [{exml,
            [{'index', Index},
             {'adj-type', AdjCase},
             {'interface', Interface},
             {'gateway', Gateway},
             {'uptime', Uptime},
             {'special-type', SpecialType}]}, ...
         ]}.
<ERR> ... : devel-c bad get_next_object() return value: .../adjacency{1}: adj-type is not a child element

Which makes sense since it is not part of the schema technically. But, either way, we are retrieving 200 of these objects at a time which should increase efficiency but since we have to call get_case for each one we are losing a lot of potential performance increases.

Is there a way to avoid that call (using econfd)?

Sorry, get_case() is required for handling the YANG choice statement.

i am not sure if it helps/works that way, but you could try setting the specific case leaf/leaves into get-next-object response, that might allow confd to skip get-case invocation theoretically?
(so no setting of “adj-type” that is case statement node, but only its wanted case’s children)

@josephm, ConfD will not skip invoking the get_case() callback.