Skip to content

Commit

Permalink
json parser BUGFIX wrong place for sorting
Browse files Browse the repository at this point in the history
Fixes #608
  • Loading branch information
michalvasko committed Sep 11, 2018
1 parent 18d67cd commit dfcd4f6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/parser_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -1256,12 +1256,6 @@ json_parse_data(struct ly_ctx *ctx, const char *data, const struct lys_node *sch
lyv_multicases(result, NULL, prev ? &first_sibling : NULL, 0, NULL)) {
goto error;
}
/* order the elements by hand as it is not required of the input */
if (lyp_is_rpc_action(result->schema)) {
if (lyd_schema_sort(result, 1)) {
goto error;
}
}

/* validation successful */
if (result->schema->nodetype & (LYS_LIST | LYS_LEAFLIST)) {
Expand Down Expand Up @@ -1453,6 +1447,13 @@ lyd_parse_json(struct ly_ctx *ctx, const char *data, int options, const struct l
goto error;
}

/* order the elements by hand as it is not required of the JSON input */
if (lyp_is_rpc_action(result->schema)) {
if (lyd_schema_sort(result, 1)) {
goto error;
}
}

if ((options & LYD_OPT_RPCREPLY) && (rpc_act->schema->nodetype != LYS_RPC)) {
/* action reply */
act_notif = reply_parent;
Expand Down

0 comments on commit dfcd4f6

Please sign in to comment.