Skip to content

[Question] parseData gives unexpected notification element #14

Closed
@safesintesi

Description

@safesintesi

We installed some modules on sysrepo containing the following snippet:

module my-types {
  identity APP-TYPES {
  	description "Application types.";
  }

  identity CLIENT {
    base APP-TYPES;
  }

  identity INTERNAL {
    base APP-TYPES;
  }
  
  typedef app-types {
    type identityref {
      base APP-TYPES;
    }
  }
}

module my-module{
  ...
  import my-types { prefix "my-types"; }

  notification application_new {
    container application {
      leaf app_type {
        type my-types:app-types;
      }
    }
  }
}

during some tests we tried to create a notification from a json file

std::string json(R"({
  "my-module:application_new": {
    "application": {
      "app_type": "my-types:CLIENT"
    }
  }
}
)");
    auto node = session.getContext().parseData(json, libyang::DataFormat::JSON);

This leads to a crash with the following error:

libyang[0]: Unexpected notification element "application_new". (path: Schema location "/my-module:application_new", line number 2.)
FAIL!  : TestAgentQt::TestBuildNotifString() Caught unhandled exception

Using newPath()/newPath2() to create the notification node by node works, but receiving the data as json objects would be easier to parse them.

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions