From 3ae67a9b686a2b019b30106177f531e7ed11d792 Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Wed, 31 Aug 2022 10:31:24 -0700 Subject: [PATCH] Add `$schema` to `cgmanifest.json` (#13887) This pull request adds the JSON schema for `cgmanifest.json`. ## FAQ ### Why? A JSON schema helps you to ensure that your `cgmanifest.json` file is valid. JSON schema validation is a build-in feature in most modern IDEs like Visual Studio and Visual Studio Code. Most modern IDEs also provide code-completion for JSON schemas. ### How can I validate my `cgmanifest.json` file? Most modern IDEs like Visual Studio and Visual Studio Code have a built-in feature to validate JSON files. You can also use [this small script](https://github.com/JamieMagee/verify-cgmanifest) to validate your `cgmanifest.json` file. ### Why does it suggest camel case for the properties? Component Detection is able to read camel case and pascal case properties. However, the JSON schema doesn't have a case-insensitive mode. We therefore suggest camel case as it's the most common format for JSON. ### Why is the diff so large? To deserialize the `cgmanifest.json` file, we use [`JSON.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse). However, to serialize the JSON again we use [`prettier`](https://prettier.io/). We found that, in general, it gave smaller diffs than the default [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) function. --- dep/CLI11/cgmanifest.json | 20 +++++++++++--------- dep/jsoncpp/cgmanifest.json | 20 +++++++++++--------- oss/boost/cgmanifest.json | 1 + oss/chromium/cgmanifest.json | 24 +++++++++++++----------- oss/dynamic_bitset/cgmanifest.json | 24 +++++++++++++----------- oss/fmt/cgmanifest.json | 22 ++++++++++++---------- oss/interval_tree/cgmanifest.json | 14 ++++++++------ oss/libpopcnt/cgmanifest.json | 24 +++++++++++++----------- oss/pcg/cgmanifest.json | 1 + oss/wyhash/cgmanifest.json | 29 +++++++++++++++-------------- oss/xorg_apps_rgb/cgmanifest.json | 22 ++++++++++++---------- 11 files changed, 110 insertions(+), 91 deletions(-) diff --git a/dep/CLI11/cgmanifest.json b/dep/CLI11/cgmanifest.json index 46efb074b..134a91b4c 100644 --- a/dep/CLI11/cgmanifest.json +++ b/dep/CLI11/cgmanifest.json @@ -1,13 +1,15 @@ -{"Registrations":[ +{ + "$schema": "https://json.schemastore.org/component-detection-manifest.json", + "Registrations": [ { "component": { - "type": "git", - "git": { - "repositoryUrl": "https://github.com/CLIUtils/CLI11", - "commitHash": "dd0d8e4fe729e5b1110232c7a5c9566dad884686" - } - } + "type": "git", + "git": { + "repositoryUrl": "https://github.com/CLIUtils/CLI11", + "commitHash": "dd0d8e4fe729e5b1110232c7a5c9566dad884686" + } + } } - ], - "Version": 1 + ], + "Version": 1 } diff --git a/dep/jsoncpp/cgmanifest.json b/dep/jsoncpp/cgmanifest.json index ac44b6d77..b5d45de44 100644 --- a/dep/jsoncpp/cgmanifest.json +++ b/dep/jsoncpp/cgmanifest.json @@ -1,13 +1,15 @@ -{"Registrations":[ +{ + "$schema": "https://json.schemastore.org/component-detection-manifest.json", + "Registrations": [ { "component": { - "type": "git", - "git": { - "repositoryUrl": "https://github.com/open-source-parsers/jsoncpp", - "commitHash": "6aba23f4a8628d599a9ef7fa4811c4ff6e4070e2" - } - } + "type": "git", + "git": { + "repositoryUrl": "https://github.com/open-source-parsers/jsoncpp", + "commitHash": "6aba23f4a8628d599a9ef7fa4811c4ff6e4070e2" + } + } } - ], - "Version": 1 + ], + "Version": 1 } diff --git a/oss/boost/cgmanifest.json b/oss/boost/cgmanifest.json index 1a07af03f..e62068baa 100644 --- a/oss/boost/cgmanifest.json +++ b/oss/boost/cgmanifest.json @@ -1,4 +1,5 @@ { + "$schema": "https://json.schemastore.org/component-detection-manifest.json", "Registrations": [ { "component": { diff --git a/oss/chromium/cgmanifest.json b/oss/chromium/cgmanifest.json index 80e83425e..f11ab51a5 100644 --- a/oss/chromium/cgmanifest.json +++ b/oss/chromium/cgmanifest.json @@ -1,13 +1,15 @@ -{"Registrations":[ +{ + "$schema": "https://json.schemastore.org/component-detection-manifest.json", + "Registrations": [ { - "component": { - "type": "git", - "git": { - "repositoryUrl": "https://github.com/chromium/chromium", - "commitHash": "d8710dd959da8e3be56f20af8cc94fbf560fbb6b" - } - } + "component": { + "type": "git", + "git": { + "repositoryUrl": "https://github.com/chromium/chromium", + "commitHash": "d8710dd959da8e3be56f20af8cc94fbf560fbb6b" + } + } } - ], - "Version": 1 -} \ No newline at end of file + ], + "Version": 1 +} diff --git a/oss/dynamic_bitset/cgmanifest.json b/oss/dynamic_bitset/cgmanifest.json index 1585faeb5..32a19e363 100644 --- a/oss/dynamic_bitset/cgmanifest.json +++ b/oss/dynamic_bitset/cgmanifest.json @@ -1,13 +1,15 @@ -{"Registrations":[ +{ + "$schema": "https://json.schemastore.org/component-detection-manifest.json", + "Registrations": [ { - "component": { - "type": "git", - "git": { - "repositoryUrl": "https://github.com/pinam45/dynamic_bitset", - "commitHash": "00f2d066ce9deebf28b006636150e5a882beb83f" - } - } + "component": { + "type": "git", + "git": { + "repositoryUrl": "https://github.com/pinam45/dynamic_bitset", + "commitHash": "00f2d066ce9deebf28b006636150e5a882beb83f" + } + } } - ], - "Version": 1 -} \ No newline at end of file + ], + "Version": 1 +} diff --git a/oss/fmt/cgmanifest.json b/oss/fmt/cgmanifest.json index df81a6ad7..dddea1c45 100644 --- a/oss/fmt/cgmanifest.json +++ b/oss/fmt/cgmanifest.json @@ -1,13 +1,15 @@ -{"Registrations":[ +{ + "$schema": "https://json.schemastore.org/component-detection-manifest.json", + "Registrations": [ { - "component": { - "type": "git", - "git": { - "repositoryUrl": "https://github.com/fmtlib/fmt", - "commitHash": "7bdf0628b1276379886c7f6dda2cef2b3b374f0b" - } - } + "component": { + "type": "git", + "git": { + "repositoryUrl": "https://github.com/fmtlib/fmt", + "commitHash": "7bdf0628b1276379886c7f6dda2cef2b3b374f0b" + } + } } - ], - "Version": 1 + ], + "Version": 1 } diff --git a/oss/interval_tree/cgmanifest.json b/oss/interval_tree/cgmanifest.json index b6c5b2199..267f6f11d 100644 --- a/oss/interval_tree/cgmanifest.json +++ b/oss/interval_tree/cgmanifest.json @@ -1,13 +1,15 @@ -{"Registrations":[ +{ + "$schema": "https://json.schemastore.org/component-detection-manifest.json", + "Registrations": [ { - "component": { - "type": "git", + "component": { + "type": "git", "git": { "repositoryUrl": "https://github.com/ekg/intervaltree", "commitHash": "b90527f9e6d51cd36ecbb50429e4524d3a418ea5" } - } + } } - ], - "Version": 1 + ], + "Version": 1 } diff --git a/oss/libpopcnt/cgmanifest.json b/oss/libpopcnt/cgmanifest.json index 90bfc49cc..02ac4729e 100644 --- a/oss/libpopcnt/cgmanifest.json +++ b/oss/libpopcnt/cgmanifest.json @@ -1,13 +1,15 @@ -{"Registrations":[ +{ + "$schema": "https://json.schemastore.org/component-detection-manifest.json", + "Registrations": [ { - "component": { - "type": "git", - "git": { - "repositoryUrl": "https://github.com/kimwalisch/libpopcnt", - "commitHash": "043a99fba31121a70bcb2f589faa17f534ae6085" - } - } + "component": { + "type": "git", + "git": { + "repositoryUrl": "https://github.com/kimwalisch/libpopcnt", + "commitHash": "043a99fba31121a70bcb2f589faa17f534ae6085" + } + } } - ], - "Version": 1 -} \ No newline at end of file + ], + "Version": 1 +} diff --git a/oss/pcg/cgmanifest.json b/oss/pcg/cgmanifest.json index ef64ef4d6..02f755fc5 100644 --- a/oss/pcg/cgmanifest.json +++ b/oss/pcg/cgmanifest.json @@ -1,4 +1,5 @@ { + "$schema": "https://json.schemastore.org/component-detection-manifest.json", "Registrations": [ { "component": { diff --git a/oss/wyhash/cgmanifest.json b/oss/wyhash/cgmanifest.json index 872322ff1..05c450e15 100644 --- a/oss/wyhash/cgmanifest.json +++ b/oss/wyhash/cgmanifest.json @@ -1,14 +1,15 @@ -{ - "Registrations": [ - { - "component": { - "type": "git", - "git": { - "repositoryUrl": "https://github.com/wangyi-fudan/wyhash", - "commitHash": "e77036ac1943369dc03e611cde52a8570f8ceefe" - } - } - } - ], - "Version": 1 -} \ No newline at end of file +{ + "$schema": "https://json.schemastore.org/component-detection-manifest.json", + "Registrations": [ + { + "component": { + "type": "git", + "git": { + "repositoryUrl": "https://github.com/wangyi-fudan/wyhash", + "commitHash": "e77036ac1943369dc03e611cde52a8570f8ceefe" + } + } + } + ], + "Version": 1 +} diff --git a/oss/xorg_apps_rgb/cgmanifest.json b/oss/xorg_apps_rgb/cgmanifest.json index c5d7fb8e9..e2187c770 100644 --- a/oss/xorg_apps_rgb/cgmanifest.json +++ b/oss/xorg_apps_rgb/cgmanifest.json @@ -1,13 +1,15 @@ -{"Registrations":[ +{ + "$schema": "https://json.schemastore.org/component-detection-manifest.json", + "Registrations": [ { - "component": { - "type": "git", - "git": { - "repositoryUrl": "https://gitlab.freedesktop.org/xorg/app/rgb.git", - "commitHash": "97820e748eb496a1f6d3fc3bf89688f0ce1f64f9" - } - } + "component": { + "type": "git", + "git": { + "repositoryUrl": "https://gitlab.freedesktop.org/xorg/app/rgb.git", + "commitHash": "97820e748eb496a1f6d3fc3bf89688f0ce1f64f9" + } + } } - ], - "Version": 1 + ], + "Version": 1 }