@@ -620,41 +620,39 @@ ly_value_validate(const struct ly_ctx *ctx, const struct lysc_node *node, const
620620}
621621
622622LIBYANG_API_DEF LY_ERR
623- lyd_value_validate (const struct ly_ctx * ctx , const struct lysc_node * schema , const char * value , uint32_t value_len ,
623+ lyd_value_validate (const struct lysc_node * schema , const char * value , uint32_t value_len ,
624624 const struct lyd_node * ctx_node , const struct lysc_type * * realtype , const char * * canonical )
625625{
626- LY_CHECK_ARG_RET (ctx , schema , !value_len || value , LY_EINVAL );
626+ LY_CHECK_ARG_RET (NULL , schema , !value_len || value , LY_EINVAL );
627627
628- return lyd_value_validate3 (ctx , schema , value , value_len , LY_VALUE_JSON , NULL , LYD_HINT_DATA , ctx_node , NULL ,
629- realtype , canonical );
628+ return lyd_value_validate3 (schema , value , value_len , LY_VALUE_JSON , NULL , LYD_HINT_DATA , ctx_node , NULL ,
629+ 1 , realtype , canonical );
630630}
631631
632632LIBYANG_API_DEF LY_ERR
633- lyd_value_validate2 (const struct ly_ctx * ctx , const struct lysc_node * schema , const char * value , uint32_t value_len ,
634- uint32_t hints , const struct lyd_node * ctx_node , const struct lysc_type * * realtype , const char * * canonical )
633+ lyd_value_validate_dflt (const struct lysc_node * schema , const char * value , struct lysc_prefix * prefixes ,
634+ const struct lyd_node * ctx_node , const struct lysc_type * * realtype , const char * * canonical )
635635{
636- LY_CHECK_ARG_RET (ctx , schema , ! value_len || value , LY_EINVAL );
636+ LY_CHECK_ARG_RET (NULL , schema , LY_EINVAL );
637637
638- return lyd_value_validate3 (ctx , schema , value , value_len , LY_VALUE_JSON , NULL , hints , ctx_node , NULL ,
639- realtype , canonical );
638+ return lyd_value_validate3 (schema , value , value ? strlen ( value ) : 0 , LY_VALUE_SCHEMA_RESOLVED , prefixes ,
639+ LYD_HINT_SCHEMA , ctx_node , NULL , 1 , realtype , canonical );
640640}
641641
642642LY_ERR
643- lyd_value_validate3 (const struct ly_ctx * ctx , const struct lysc_node * schema , const char * value , size_t value_len ,
644- LY_VALUE_FORMAT format , void * prefix_data , uint32_t hints , const struct lyd_node * ctx_node ,
645- const struct lysc_ext_instance * top_ext , const struct lysc_type * * realtype , const char * * canonical )
643+ lyd_value_validate3 (const struct lysc_node * schema , const char * value , size_t value_len , LY_VALUE_FORMAT format ,
644+ void * prefix_data , uint32_t hints , const struct lyd_node * ctx_node , const struct lysc_ext_instance * top_ext ,
645+ int log , const struct lysc_type * * realtype , const char * * canonical )
646646{
647647 LY_ERR rc ;
648+ const struct ly_ctx * ctx ;
648649 struct ly_err_item * err = NULL ;
649650 struct lysc_type * type ;
650651 struct lyd_value val = {0 };
651- ly_bool stored = 0 , log = 1 ;
652+ ly_bool stored = 0 ;
652653 struct lyplg_type * type_plg ;
653654
654- if (!ctx ) {
655- ctx = schema -> module -> ctx ;
656- log = 0 ;
657- }
655+ ctx = schema -> module -> ctx ;
658656 if (!value_len ) {
659657 value = "" ;
660658 }
0 commit comments