Skip to content
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

RFC 6901 op:replace & arrays #1882

Closed
ArkadiuszRaj opened this issue Dec 26, 2019 · 3 comments
Closed

RFC 6901 op:replace & arrays #1882

ArkadiuszRaj opened this issue Dec 26, 2019 · 3 comments
Labels
kind: bug solution: invalid the issue is not related to the library

Comments

@ArkadiuszRaj
Copy link

In json file I have an array with 4 strings.

"OBJECTS":{
                    "IMAGE":{
                        "ENABLED":true
                        ,"FILE": [
                            "JPEG"
                            ,"PNG"
                            ,"TIFF"
                            ,"FITS"
                        ]
                    }

I am applying patch (op:replace) which shall replace array with new content, this time 3 strings.

{"op":"replace","path":"...","value":["PNG","TIFF","FITS"]}

As result array has still 4 elements, last one "survived" patch operation

"OBJECTS":{
                    "IMAGE":{
                        "ENABLED":true
                        ,"FILE": [
                            "PNG"
                            ,"TIFF"
                            ,"FITS"
                            ,"FITS"
                        ]
                    }

I think whole array shall be replaced.

Compiled on ARM SBC with gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)

I am using code tagged as v3.7.3

@nlohmann
Copy link
Owner

Can you provide a complete example for both the value and the patch?

@ArkadiuszRaj
Copy link
Author

ArkadiuszRaj commented Jan 1, 2020

Hi Niels,
First of all Happy New Year!
Since I was misled, i.e. the patch path parameter is generated and uses the array expansion, there is no error in the code. Sorry for the confusion!

[{"op":"replace","path":"/PREVIEW/IMAGE/AVERAGING","value":15},
{"op":"replace","path":"/PREVIEW/IMAGE/RESCALE","value":1},
{"op":"replace","path":"/PREVIEW/INTERVAL","value":30},
{"op":"replace","path":"/REPORTER/CONFIGURATION/PREVIEW/OBJECTS/IMAGE/FILE/0","value":"PNG"},
{"op":"replace","path":"/REPORTER/CONFIGURATION/PREVIEW/OBJECTS/IMAGE/FILE/1","value":"TIFF"},
{"op":"replace","path":"/REPORTER/CONFIGURATION/PREVIEW/OBJECTS/IMAGE/FILE/2","value":"FITS"}]

@nlohmann nlohmann added the solution: invalid the issue is not related to the library label Jan 4, 2020
@nlohmann
Copy link
Owner

nlohmann commented Jan 4, 2020

Happy new year to you, too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug solution: invalid the issue is not related to the library
Projects
None yet
Development

No branches or pull requests

2 participants