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

ValidPathInfo field does not adhere to the JSON guidlines #10311

Open
Ericson2314 opened this issue Mar 24, 2024 · 2 comments
Open

ValidPathInfo field does not adhere to the JSON guidlines #10311

Ericson2314 opened this issue Mar 24, 2024 · 2 comments

Comments

@Ericson2314
Copy link
Member

Ericson2314 commented Mar 24, 2024

ca field

Strings like fixed:r:sha256:adsfjlawefjliajsdl need to be parsed, and that is no good. We should use an object instead, something like

{
    "method": "nar",
    "hash": "sha256-adsfjlawefjliajsdl"
}

This should be implemented as a canonical nlohmann JSON "instance" for ContentAddress (and friends), with unit test characterization tests checking round trips. The ValidPathInfo JSON methods can then just use that nlohmann JSON instance.

Noticed while working on #10310 -- comparing the ca field in the tests was way more hackish than it should be.

signatures field

The <name>:<pub-key> format should be replaced with a two-field JSON object.

Other info

See also #9866 for something similar

CC @roberth

@roberth
Copy link
Member

roberth commented Mar 24, 2024

I don't think structured strings (oxymoron?) technically violate the JSON guidelines, but otherwise it seems that what you're proposing is an improvement.

Should the hash be parsed into a record object, or should we use SRI hash strings, or both?

@Ericson2314
Copy link
Member Author

Should the hash be parsed into a record object, or should we use SRI hash strings, or both?

Good question. I am fine either way. At least the SRI string is not our own homegrown convention.

@Ericson2314 Ericson2314 added this to the nix-command stabilisation milestone Mar 24, 2024
@Ericson2314 Ericson2314 changed the title ValidPathInfo CA field does not adhere to the JSON guidlines ValidPathInfo field does not adhere to the JSON guidlines Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants