Latest CMake preset schema file is not up to date?

The CMake presets schema is not the version 8?

bash-5.2$ diff -cw ~/Downloads/schema.json ./Help/manual/presets/schema.json

*** /Users/clausklein/Downloads/schema.json	Tue Aug 15 16:27:45 2023
--- ./Help/manual/presets/schema.json	Tue Feb  6 09:45:52 2024
***************
*** 106,117 ****
--- 106,140 ----
          "include": { "$ref": "#/definitions/include" }
        },
        "additionalProperties": false
+     },
+     {
+       "properties": {
+         "$schema": { "$ref": "#/definitions/$schema" },
+         "version": {
+           "const": 8,
+           "description": "A required integer representing the version of the JSON schema."
+         },
+         "cmakeMinimumRequired": { "$ref": "#/definitions/cmakeMinimumRequired" },
+         "vendor": { "$ref": "#/definitions/vendor" },
+         "configurePresets": { "$ref": "#/definitions/configurePresetsV7" },
+         "buildPresets": { "$ref": "#/definitions/buildPresetsV4" },
+         "testPresets": { "$ref": "#/definitions/testPresetsV6" },
+         "packagePresets": { "$ref": "#/definitions/packagePresetsV6" },
+         "workflowPresets": { "$ref": "#/definitions/workflowPresetsV6" },
+         "include": { "$ref": "#/definitions/include" }
+       },
+       "additionalProperties": false
      }
    ],
    "required": [
      "version"
    ],
    "definitions": {
+     "$schema": {
+       "type": "string",
+       "description": "The schema against which to verify this document.",
+       "format": "uri-reference"
+     },
      "cmakeMinimumRequired": {
        "type": "object",
        "description": "An optional object representing the minimum version of CMake needed to build this project.",

The “This file” link at the bottom of the manual for 3.28 looks correct to me. Note that the actual file’s URL changes every time the documentation is rebuilt for a patch release. Currently for 3.28.3 it is:

$ curl -O https://cmake.org/cmake/help/v3.28/_downloads/3e2d73bff478d88a7de0de736ba5e361/schema.json
$ grep '"const": 8' schema.json
          "const": 8,

Yes, my fault! My download dir contains both, old and current version. sorry gain.

so I guess this is right now:

diff --git a/CMakePresets.json b/CMakePresets.json
index 9e62aa3..837cee3 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -1,8 +1,9 @@
 {
-    "version": 6,
+    "version": 8,
+    "$schema": "https://cmake.org/cmake/help/v3.28/_downloads/3e2d73bff478d88a7de0de736ba5e361/schema.json",
     "cmakeMinimumRequired": {
         "major": 3,
-        "minor": 25,
+        "minor": 28,
         "patch": 0
     },
     "include": [

The _downloads URLs are not stable. Don’t reference them in document $schema fields.

Given that _downloads links aren’t stable, what’s the correct way to reference the schema for a specific CMake version (e.g. 4.4.0)? Is there a stable versioned URL?

Edit: something like this perhaps?

https://gitlab.kitware.com/cmake/cmake/-/raw/v4.4.0-rc3/Help/manual/presets/schema.json

Is that a better candidate in your opinion?

Try the GitHub equivalent preset schema URL, which is served by a CDN.

1 Like

Understood, thank you.