-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
identityref REVERT canonical value in JSON format with prefix
Do not use the standard JSON format as caonical value and always print the prefix like before. Refs #2090
- Loading branch information
1 parent
d3b351a
commit 7d603c9
Showing
4 changed files
with
12 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
/** | ||
* @file identityref.c | ||
* @author Radek Krejci <[email protected]> | ||
* @author Michal Vasko <[email protected]> | ||
* @brief Built-in identityref type plugin. | ||
* | ||
* Copyright (c) 2019-2021 CESNET, z.s.p.o. | ||
* Copyright (c) 2019-2023 CESNET, z.s.p.o. | ||
* | ||
* This source code is licensed under BSD 3-Clause License (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
|
@@ -277,9 +278,12 @@ lyplg_type_store_identityref(const struct ly_ctx *ctx, const struct lysc_type *t | |
LY_CHECK_GOTO(ret, cleanup); | ||
} | ||
} else { | ||
/* JSON format is the canonical one */ | ||
ret = identityref_ident2str(ident, LY_VALUE_JSON, ctx_node ? ctx_node->module : NULL, &canon, NULL); | ||
LY_CHECK_GOTO(ret, cleanup); | ||
/* JSON format with prefix is the canonical one */ | ||
if (asprintf(&canon, "%s:%s", ident->module->name, ident->name) == -1) { | ||
LOGMEM(ctx); | ||
ret = LY_EMEM; | ||
goto cleanup; | ||
} | ||
|
||
ret = lydict_insert_zc(ctx, canon, &storage->_canonical); | ||
LY_CHECK_GOTO(ret, cleanup); | ||
|
@@ -315,7 +319,7 @@ lyplg_type_print_identityref(const struct ly_ctx *UNUSED(ctx), const struct lyd_ | |
{ | ||
char *ret; | ||
|
||
if ((format == LY_VALUE_CANON) || (format == LY_VALUE_JSON) || (format == LY_VALUE_LYB)) { | ||
if (format == LY_VALUE_CANON) { | ||
if (dynamic) { | ||
*dynamic = 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters