From 6280905638aac9d15c09fc4d38aa469ee63d17be Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 28 Oct 2025 13:24:05 -0400 Subject: [PATCH] Convert store path info JSON docs to formal JSON Schema, and test This continues the work for formalizing our current JSON docs. Note that in the process, a few bugs were caught: - `closureSize` was repeated twice, forgot `closureDownloadSize` - `file*` fields should be `download*`. They are in fact called that in the line-oriented `.narinfo` file, but were renamed in the JSON format. --- doc/manual/package.nix | 2 + .../source/protocols/json/derivation.md | 2 +- doc/manual/source/protocols/json/hash.md | 2 +- doc/manual/source/protocols/json/meson.build | 1 + .../source/protocols/json/schema/nar-info-v1 | 1 + .../json/schema/store-object-info-v1 | 1 + .../json/schema/store-object-info-v1.yaml | 235 ++++++++++++++++++ .../protocols/json/store-object-info.md | 117 +++------ .../source/protocols/json/store-path.md | 2 +- src/json-schema-checks/meson.build | 50 ++++ src/json-schema-checks/nar-info | 1 + src/json-schema-checks/package.nix | 2 + src/json-schema-checks/store-object-info | 1 + 13 files changed, 327 insertions(+), 90 deletions(-) create mode 120000 doc/manual/source/protocols/json/schema/nar-info-v1 create mode 120000 doc/manual/source/protocols/json/schema/store-object-info-v1 create mode 100644 doc/manual/source/protocols/json/schema/store-object-info-v1.yaml create mode 120000 src/json-schema-checks/nar-info create mode 120000 src/json-schema-checks/store-object-info diff --git a/doc/manual/package.nix b/doc/manual/package.nix index b7c9503ef..7d29df3c3 100644 --- a/doc/manual/package.nix +++ b/doc/manual/package.nix @@ -38,6 +38,8 @@ mkMesonDerivation (finalAttrs: { ../../src/libstore-tests/data/content-address ../../src/libstore-tests/data/store-path ../../src/libstore-tests/data/derived-path + ../../src/libstore-tests/data/path-info + ../../src/libstore-tests/data/nar-info # Too many different types of files to filter for now ../../doc/manual ./. diff --git a/doc/manual/source/protocols/json/derivation.md b/doc/manual/source/protocols/json/derivation.md index 602ab67e4..a4a4ea79d 100644 --- a/doc/manual/source/protocols/json/derivation.md +++ b/doc/manual/source/protocols/json/derivation.md @@ -1,6 +1,6 @@ {{#include derivation-v3-fixed.md}} - diff --git a/doc/manual/source/protocols/json/store-path.md b/doc/manual/source/protocols/json/store-path.md index 02ecc8068..cd18f6595 100644 --- a/doc/manual/source/protocols/json/store-path.md +++ b/doc/manual/source/protocols/json/store-path.md @@ -8,7 +8,7 @@ {{#include schema/store-path-v1/simple.json}} ``` -