|
| 1 | +diff --git a/cffi/cdefs.h b/cffi/cdefs.h |
| 2 | +index 1c1d8f3..89f607b 100644 |
| 3 | +--- a/cffi/cdefs.h |
| 4 | ++++ b/cffi/cdefs.h |
| 5 | +@@ -318,6 +318,7 @@ LY_ERR lyd_print_all(struct ly_out *, const struct lyd_node *, LYD_FORMAT, uint3 |
| 6 | + #define LYD_PARSE_OPTS_MASK ... |
| 7 | + #define LYD_PARSE_ORDERED ... |
| 8 | + #define LYD_PARSE_STRICT ... |
| 9 | ++#define LYD_PARSE_JSON_STRING_DATATYPES ... |
| 10 | + |
| 11 | + #define LYD_VALIDATE_NO_STATE ... |
| 12 | + #define LYD_VALIDATE_PRESENT ... |
| 13 | +diff --git a/libyang/context.py b/libyang/context.py |
| 14 | +index 1b1d4cd..2692eb3 100644 |
| 15 | +--- a/libyang/context.py |
| 16 | ++++ b/libyang/context.py |
| 17 | +@@ -520,6 +520,7 @@ def parse_data( |
| 18 | + validate_present: bool = False, |
| 19 | + validate_multi_error: bool = False, |
| 20 | + store_only: bool = False, |
| 21 | ++ json_string_datatypes: bool = False, |
| 22 | + ) -> Optional[DNode]: |
| 23 | + if self.cdata is None: |
| 24 | + raise RuntimeError("context already destroyed") |
| 25 | +@@ -531,6 +532,7 @@ def parse_data( |
| 26 | + ordered=ordered, |
| 27 | + strict=strict, |
| 28 | + store_only=store_only, |
| 29 | ++ json_string_datatypes=json_string_datatypes, |
| 30 | + ) |
| 31 | + validation_flgs = validation_flags( |
| 32 | + no_state=no_state, |
| 33 | +@@ -589,6 +591,7 @@ def parse_data_mem( |
| 34 | + validate_present: bool = False, |
| 35 | + validate_multi_error: bool = False, |
| 36 | + store_only: bool = False, |
| 37 | ++ json_string_datatypes: bool = False, |
| 38 | + ) -> Optional[DNode]: |
| 39 | + return self.parse_data( |
| 40 | + fmt, |
| 41 | +@@ -604,6 +607,7 @@ def parse_data_mem( |
| 42 | + validate_present=validate_present, |
| 43 | + validate_multi_error=validate_multi_error, |
| 44 | + store_only=store_only, |
| 45 | ++ json_string_datatypes=json_string_datatypes, |
| 46 | + ) |
| 47 | + |
| 48 | + def parse_data_file( |
| 49 | +@@ -620,6 +624,7 @@ def parse_data_file( |
| 50 | + validate_present: bool = False, |
| 51 | + validate_multi_error: bool = False, |
| 52 | + store_only: bool = False, |
| 53 | ++ json_string_datatypes: bool = False, |
| 54 | + ) -> Optional[DNode]: |
| 55 | + return self.parse_data( |
| 56 | + fmt, |
| 57 | +@@ -635,6 +640,7 @@ def parse_data_file( |
| 58 | + validate_present=validate_present, |
| 59 | + validate_multi_error=validate_multi_error, |
| 60 | + store_only=store_only, |
| 61 | ++ json_string_datatypes=json_string_datatypes, |
| 62 | + ) |
| 63 | + |
| 64 | + def __iter__(self) -> Iterator[Module]: |
| 65 | +diff --git a/libyang/data.py b/libyang/data.py |
| 66 | +index 19ef0ca..86c26e1 100644 |
| 67 | +--- a/libyang/data.py |
| 68 | ++++ b/libyang/data.py |
| 69 | +@@ -116,6 +116,7 @@ def parser_flags( |
| 70 | + ordered: bool = False, |
| 71 | + strict: bool = False, |
| 72 | + store_only: bool = False, |
| 73 | ++ json_string_datatypes: bool = False, |
| 74 | + ) -> int: |
| 75 | + flags = 0 |
| 76 | + if lyb_mod_update: |
| 77 | +@@ -132,6 +133,8 @@ def parser_flags( |
| 78 | + flags |= lib.LYD_PARSE_STRICT |
| 79 | + if store_only: |
| 80 | + flags |= lib.LYD_PARSE_STORE_ONLY |
| 81 | ++ if json_string_datatypes: |
| 82 | ++ flags |= lib.LYD_PARSE_JSON_STRING_DATATYPES |
| 83 | + return flags |
| 84 | + |
| 85 | + |
0 commit comments