schema compile CHANGE order keys at the beginning of the children list
diff --git a/src/printer_yang.c b/src/printer_yang.c
index c6851db..8736639 100755
--- a/src/printer_yang.c
+++ b/src/printer_yang.c
@@ -1725,11 +1725,11 @@
LY_ARRAY_FOR(list->musts, u) {
yprc_must(ctx, &list->musts[u], NULL);
}
- if (list->keys) {
+ if (!(list->flags & LYS_KEYLESS)) {
ypr_open(ctx->out, &flag);
ly_print(ctx->out, "%*skey \"", INDENT);
- LY_ARRAY_FOR(list->keys, u) {
- ly_print(ctx->out, "%s%s", u > 0 ? ", " : "", list->keys[u]->name);
+ for (struct lysc_node *key = list->child; key && key->nodetype == LYS_LEAF && (key->flags & LYS_KEY); key = key->next) {
+ ly_print(ctx->out, "%s%s", u > 0 ? ", " : "", key->name);
}
ly_print(ctx->out, "\";\n");
}