From 51a2a4b3f471eba2f4416865ed19a986a6aca9f3 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Tue, 14 Nov 2023 19:57:05 +0100 Subject: [PATCH] lib: print all errors when validating a config Signed-off-by: Igor Ryzhov --- lib/northbound.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/northbound.c b/lib/northbound.c index 30489d7dfb..15775f4d3a 100644 --- a/lib/northbound.c +++ b/lib/northbound.c @@ -871,9 +871,14 @@ int nb_candidate_update(struct nb_config *candidate) int nb_candidate_validate_yang(struct nb_config *candidate, bool no_state, char *errmsg, size_t errmsg_len) { - if (lyd_validate_all(&candidate->dnode, ly_native_ctx, - no_state ? LYD_VALIDATE_NO_STATE - : LYD_VALIDATE_PRESENT, + uint32_t options = LYD_VALIDATE_MULTI_ERROR; + + if (no_state) + SET_FLAG(options, LYD_VALIDATE_NO_STATE); + else + SET_FLAG(options, LYD_VALIDATE_PRESENT); + + if (lyd_validate_all(&candidate->dnode, ly_native_ctx, options, NULL) != 0) { yang_print_errors(ly_native_ctx, errmsg, errmsg_len); return NB_ERR_VALIDATION; -- 2.39.5