-
Notifications
You must be signed in to change notification settings - Fork 311
data: option to allow json int/bool as strings #2344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
166a56b
to
a74e422
Compare
libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users. Sent upstream here: CESNET/libyang#2344
libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users. Sent upstream here: CESNET/libyang#2344
libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users. Sent upstream here: CESNET/libyang#2344
libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users. Sent upstream here: CESNET/libyang#2344
libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users. Sent upstream here: CESNET/libyang#2344
libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users. Sent upstream here: CESNET/libyang#2344
libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users. Sent upstream here: CESNET/libyang#2344
libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users. Sent upstream here: CESNET/libyang#2344
Not sure if a project not working correctly justifies supporting such invalid use-cases but I suppose adding a flag does not break anything. It just seems it should be a JSON parsing flag instead of a context flag. |
Yeah, I wasn't around when the initial implementation was done, but since libyang wasn't validating in v1 I guess assumptions were made. Regarding it being a parser option, Ok, sure, it wasn't obvious to me how the code path was setting flags, but I see now that the code is casting between lyd_ctx and lyjson_ctx (which wasn't immediately obvious), so I would be able to pass down the flags there. So would this work? :
If that would be acceptable to you then I'll rework this patch. I'd really like to solidify the plan that will be accepted here since we're working on upstreaming libyang3 in SONiC: |
I do not think you really need |
I don't know if completely ignoring the valhint is good, I was leaving in place validation of if a string value wasn't enclosed in quotes since I haven't seen an instance of that, and truthfully I didn't check if v1 allowed that or not. But I could go either way as I don't know if it would cause issues if we disabled that validation too ... the main issues that I see all over the place is SONiC expects |
887edf1
to
885d013
Compare
Fine, then call it accordingly. Something like |
b05580c
to
4933baf
Compare
please look at the PR now, I reworked it. i can rename the options/flags whatever you want, just want to make sure this looks like I'm on the right track. I added test cases too. |
4933baf
to
209762c
Compare
also I added |
Of course, you only need |
Prior to v1.0.212 the default behavior was to allow numbers and boolean values to be in quotes, which is technically a violation of the spec. This adds a new `LYD_PARSE_JSON_STRING_DATATYPES` parse option which will restore the prior behavior when enabled. SONiC is using v1.0.73 currently and has a large installed base which may be in violation of the new behavior, so adding such a flag is required for this usecase. Signed-off-by: Brad House <brad@brad-house.com>
209762c
to
9ba71bf
Compare
done with all your suggestions... |
Depends on CESNET/libyang#2344 Add support for new option to python bindings. Signed-off-by: Brad House <brad@brad-house.com>
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
CESNET/libyang#2344 libyang1 would treat "true" and true as identical, same with "1234" and 1234. We need to restore this behavior so we don't break users.
Depends on CESNET/libyang#2344 Add support for new option to python bindings. Signed-off-by: Brad House <brad@brad-house.com>
Depends on CESNET/libyang#2344 Add support for new option to python bindings. Signed-off-by: Brad House <brad@brad-house.com>
Depends on CESNET/libyang#2344 Add support for new option to python bindings. Signed-off-by: Brad House <brad@brad-house.com>
Depends on CESNET/libyang#2344 Add support for new option to python bindings. Signed-off-by: Brad House <brad@brad-house.com>
Depends on CESNET/libyang#2344 Add support for new option to python bindings. Signed-off-by: Brad House <brad@brad-house.com>
Depends on CESNET/libyang#2344 Add support for new option to python bindings. Signed-off-by: Brad House <brad@brad-house.com>
Depends on CESNET/libyang#2344 Add support for new option to python bindings. Signed-off-by: Brad House <brad@brad-house.com>
Depends on CESNET/libyang#2344 Add support for new option to python bindings. Signed-off-by: Brad House <brad@brad-house.com>
Prior to v1.0.212 the default behavior was to allow numbers
and boolean values to be in quotes, which is technically a
violation of the spec.
This adds a new
LYD_PARSE_JSON_STRING_DATATYPES
parse optionwhich will restore the prior behavior when enabled.
SONiC is using v1.0.73 currently and has a large installed base which
may be in violation of the new behavior, so adding such a flag is
required for this usecase.
Signed-off-by: Brad House (@bradh352)