Skip to contentSkip to conversation

bitbake-setup JSON Schema: Fix linting errors

PATCH Superseded Rob Woolley 2 participants 11 messages Apr 6 – Apr 7

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#8 lore raw

PATCH 8/8 layers.schema.json: Remove trailing period

In reply to Rob Woolley

This resolves the jsonschema linting error:
Descriptions should not end with a period to give user interfaces flexibility in presenting the text (description_trailing_period)

---
 setup-schema/layers.schema.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
setup-schema/layers.schema.json +2 -2
index 25248a4ba..a07bbc41b 100644
@@ -42,7 +42,7 @@
                         "type": "string"
                     },
                     "contains_this_file": {
-                        "description": "Whether the directory with the layer source also contains this json description. Tools may want to skip the checkout of the source then.",
+                        "description": "Whether the directory with the layer source also contains this json description. Tools may want to skip the checkout of the source then",
                         "type": "boolean"
                     },
                     "git-remote": {
@@ -62,7 +62,7 @@
                                 "type": "string"
                             },
                             "describe": {
-                                "description": "The output of 'git describe' (human readable description of the revision using tags in revision history).",
+                                "description": "The output of 'git describe' (human readable description of the revision using tags in revision history)",
                                 "type": "string"
                             },
                             "uri": {
Signature · 1 line
2.49.0
#7 lore raw

PATCH 7/8 layers.schema.json: Add examples property

In reply to Rob Woolley

This resolves the jsonschema linting error:
Set a non-empty examples array at the top level of the schema to illustrate the expected data (top_level_examples)

This example intentionally only references bitbake as a minimal example that focuses on the tool itself.

---
 setup-schema/layers.schema.json | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
setup-schema/layers.schema.json +17 -0
index 8bc74a533..25248a4ba 100644
@@ -1,6 +1,23 @@
 {
     "$schema": "https://json-schema.org/draft/2020-12/schema",
     "description": "OpenEmbedder Layer Setup Manifest",
+    "examples" : {
+        "version": "1.0",
+        "sources": {
+            "bitbake": {
+                "git-remote": {
+                    "remotes": {
+                        "origin": {
+                            "uri": "https://git.openembedded.org/bitbake"
+                        }
+                    },
+                    "branch": "master",
+                    "rev": "master"
+                },
+                "path": "bitbake"
+            }
+        }
+    },
     "title": "bitbake-setup layer subschema",
     "type": "object",
     "additionalProperties": false,
Signature · 1 line
2.49.0
#4 lore raw

PATCH 4/8 bitbake-setup.schema.json: Remove trailing period

In reply to Rob Woolley

This resolves the jsonschema linting error:
Descriptions should not end with a period to give user interfaces flexibility in presenting the text (description_trailing_period)

---
 setup-schema/bitbake-setup.schema.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
setup-schema/bitbake-setup.schema.json +1 -1
index a1d41d228..6db5557ae 100644
@@ -144,7 +144,7 @@
                             },
                             "setup-dir-name": {
                                 "type": "string",
-                                "description": "A suggestion for the setup directory name, $-prefixed keys from oe-fragments-one-of will be substituted with user selections."
+                                "description": "A suggestion for the setup directory name, $-prefixed keys from oe-fragments-one-of will be substituted with user selections"
                             }
                         },
                         "additionalProperties": false
Signature · 1 line
2.49.0
#5 lore raw

PATCH 5/8 layers.schema.json: Add missing schema

In reply to Rob Woolley

This resolves the jsonschema error:
error: The JSON document is not a valid JSON Schema

---
 setup-schema/layers.schema.json | 1 +
 1 file changed, 1 insertion(+)
setup-schema/layers.schema.json +1 -0
index f42606941..2c192c8b0 100644
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://json-schema.org/draft/2020-12/schema",
     "description": "OpenEmbedder Layer Setup Manifest",
     "type": "object",
     "additionalProperties": false,
Signature · 1 line
2.49.0
#6 lore raw

PATCH 6/8 layers.schema.json: Add title for subschema

In reply to Rob Woolley

Resolves the jsonschema linting error:
Set a concise non-empty title at the top level of the schema to explain what the definition is about (top_level_title)

---
 setup-schema/layers.schema.json | 1 +
 1 file changed, 1 insertion(+)
setup-schema/layers.schema.json +1 -0
index 2c192c8b0..8bc74a533 100644
@@ -1,6 +1,7 @@
 {
     "$schema": "https://json-schema.org/draft/2020-12/schema",
     "description": "OpenEmbedder Layer Setup Manifest",
+    "title": "bitbake-setup layer subschema",
     "type": "object",
     "additionalProperties": false,
     "required": [
Signature · 1 line
2.49.0
#2 lore raw

PATCH 2/8 bitbake-setup.schema.json: Add examples property

In reply to Rob Woolley

This resolves the jsonschema linting error:
Set a non-empty examples array at the top level of the schema to illustrate the expected data (top_level_examples)

This example intentionally only references bitbake as a minimal example that focuses on the tool itself.

---
 setup-schema/bitbake-setup.schema.json | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
setup-schema/bitbake-setup.schema.json +21 -0
index d340c9785..976e2cdf7 100644
@@ -1,6 +1,27 @@
 {
     "$schema": "https://json-schema.org/draft/2020-12/schema",
     "description": "Schema for bitbake-setup configuration files",
+    "examples" : {
+        "description": "Example bitbake-setup configuration file",
+        "sources": {
+            "bitbake": {
+                "git-remote": {
+                    "remotes": {
+                        "origin": {
+                            "uri": "https://git.openembedded.org/bitbake"
+                        }
+                    },
+                    "branch": "master",
+                    "rev": "master"
+                },
+                "path": "bitbake"
+            }
+        },
+        "bitbake-setup": {
+            "configurations": []
+        },
+        "version": "1.0"
+    },
     "title": "bitbake-setup configuration file",
     "type": "object",
     "required": [
Signature · 1 line
2.49.0
#3 lore raw

PATCH 3/8 bitbake-setup.schema.json: Use anyOf for non-disjoint subschemas

In reply to Rob Woolley

The oneOf keyword is for matching exactly one subschema.

However, the 2 possible BitBake configuration fragments are not disjoint. Since a simple example with type and description would match both. For this reason, we should use anyOf instead.

This resolves the following jsonschema linting error:
A oneOf where all branches have disjoint types can be safely converted to anyOf (oneof_to_anyof_disjoint_types)

---
 setup-schema/bitbake-setup.schema.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
setup-schema/bitbake-setup.schema.json +1 -1
index 976e2cdf7..a1d41d228 100644
@@ -86,7 +86,7 @@
                                 "type": "array",
                                 "description": "List of BitBake configuration fragments to enable",
                                 "items": {
-                                    "oneOf": [
+                                    "anyOf": [
                                         {
                                             "type": "string",
                                             "description": "Configuration fragment name"
Signature · 1 line
2.49.0
#0 lore raw

cover bitbake-setup JSON Schema: Fix linting errors

This series fixes some linting errors in the JSON Schema. Problems were found using the https://github.com/sourcemeta/jsonschema tool.

Here are the steps used to install and use the tool to lint the schemas:

python3 -m venv venv
source venv/bin/activate
pip install sourcemeta-jsonschema
jsonschema lint bitbake-setup.schema.json
jsonschema lint layers.schema.json

This allowed me to use jsonschema to validate the BitBake Configuration File:
jsonschema validate path/to/bitbake-setup.schema.json oe-nodistro-master.conf.json

There are 2 outstanding types of linting errors related to the use of hyphen in the property names and the enum currently having only one value:

Set properties to identifier names that can be easily mapped to programming languages (matching [A-Za-z_][A-Za-z0-9_]*) (simple_properties_identifiers).

An enum of a single value can be expressed as const (enum_to_const)

The former would require a larger discussion and potentially increasing the version number. Updating the enum to include a new version would also resolve the latter error.

I do not believe that the changes in this series merit increasing the version of the schema.

Resolving these outstanding errors is not necessary for validating the Bitbake Configuration files.

#1 lore raw

PATCH 1/8 bitbake-setup.schema.json: Add title for schema

Resolves the jsonschema linting error:
Set a concise non-empty title at the top level of the schema to explain what the definition is about (top_level_title)

---
 setup-schema/bitbake-setup.schema.json | 1 +
 1 file changed, 1 insertion(+)
setup-schema/bitbake-setup.schema.json +1 -0
index be8772db1..d340c9785 100644
@@ -1,6 +1,7 @@
 {
     "$schema": "https://json-schema.org/draft/2020-12/schema",
     "description": "Schema for bitbake-setup configuration files",
+    "title": "bitbake-setup configuration file",
     "type": "object",
     "required": [
         "description",
Signature · 1 line
2.49.0
#9 lore raw
In reply to Rob Woolley
Quoted 26 lines · Rob Woolley via lists.openembedded.org

This series fixes some linting errors in the JSON Schema. Problems were found using the https://github.com/sourcemeta/jsonschema tool.

Here are the steps used to install and use the tool to lint the schemas:

python3 -m venv venv
source venv/bin/activate
pip install sourcemeta-jsonschema
jsonschema lint bitbake-setup.schema.json
jsonschema lint layers.schema.json

This allowed me to use jsonschema to validate the BitBake Configuration File:
jsonschema validate path/to/bitbake-setup.schema.json oe-nodistro-master.conf.json

There are 2 outstanding types of linting errors related to the use of hyphen in the property names and the enum currently having only one value:

Set properties to identifier names that can be easily mapped to programming languages (matching [A-Za-z_][A-Za-z0-9_]*) (simple_properties_identifiers).

An enum of a single value can be expressed as const (enum_to_const)

The former would require a larger discussion and potentially increasing the version number. Updating the enum to include a new version would also resolve the latter error.

Quoted 5 lines

I do not believe that the changes in this series merit increasing the version of the schema.

Resolving these outstanding errors is not necessary for validating the Bitbake Configuration files.

Hi Rob,

Thanks for you series.

It looks like some selftests are now failing:

2026-04-07 08:44:43,890 - oe-selftest - INFO - bblayers.BitbakeLayers.test_bitbakelayers_setup (subunit.RemotedTestCase)
2026-04-07 08:44:43,891 - oe-selftest - INFO -  ... FAIL

...
/srv/pokybuild/yocto-worker/oe-selftest-debian/build/build-st-1874443/tmp/work/x86_64-linux/python3-jsonschema-native/4.26.0/recipe-sysroot-native/usr/bin/jsonschema:5: DeprecationWarning: The jsonschema CLI is deprecated and will be removed in a future version. Please use check-jsonschema instead, which can be installed from https://pypi.org/project/check-jsonschema/
from jsonschema.cli import main
{'version': '1.0', 'sources': {'bitbake': {'git-remote': {'remotes': {'origin': {'uri': 'https://git.openembedded.org/bitbake'}}, 'branch': 'master', 'rev': 'master'}, 'path': 'bitbake'}}}: {'version': '1.0', 'sources': {'bitbake': {'git-remote': {'remotes': {'origin': {'uri': 'https://git.openembedded.org/bitbake'}}, 'branch': 'master', 'rev': 'master'}, 'path': 'bitbake'}}} is not of type 'array'
...

2026-04-07 08:45:39,329 - oe-selftest - INFO - bblayers.BitbakeLayers.test_bitbakelayers_updatelayer (subunit.RemotedTestCase)
2026-04-07 08:45:39,331 - oe-selftest - INFO -  ... FAIL
...
2026-04-07 08:45:39,594 - oe-selftest - INFO - bblayers.BitbakeLayers.test_validate_bitbake_setup_default_registry (subunit.RemotedTestCase)
2026-04-07 08:45:39,594 - oe-selftest - INFO -  ... FAIL

...

2026-04-07 08:45:39,819 - oe-selftest - INFO - bblayers.BitbakeLayers.test_validate_examplelayersjson (subunit.RemotedTestCase)
2026-04-07 08:45:39,820 - oe-selftest - INFO -  ... FAIL

https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/3617
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3499

Can you have a look at the issue?

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#10 lore raw
Quoted 27 lines · Mathieu Dubois-Briand

Hi Rob,

Thanks for you series.

It looks like some selftests are now failing:

2026-04-07 08:44:43,890 - oe-selftest - INFO - bblayers.BitbakeLayers.test\_bitbakelayers\_setup (subunit.RemotedTestCase)  
2026-04-07 08:44:43,891 - oe-selftest - INFO - ... FAIL  

...
/srv/pokybuild/yocto-worker/oe-selftest-debian/build/build-st-1874443/tmp/work/x86\_64-linux/python3-jsonschema-native/4.26.0/recipe-sysroot-native/usr/bin/jsonschema:5: DeprecationWarning: The jsonschema CLI is deprecated and will be removed in a future version. Please use check-jsonschema instead, which can be installed from <https://pypi.org/project/check-jsonschema/>
from jsonschema.cli import main
{'version': '1.0', 'sources': {'bitbake': {'git-remote': {'remotes': {'origin': {'uri': '<https://git.openembedded.org/bitbake'}}>, 'branch': 'master', 'rev': 'master'}, 'path': 'bitbake'}}}: {'version': '1.0', 'sources': {'bitbake': {'git-remote': {'remotes': {'origin': {'uri': '<https://git.openembedded.org/bitbake'}}>, 'branch': 'master', 'rev': 'master'}, 'path': 'bitbake'}}} is not of type 'array'
...

2026-04-07 08:45:39,329 - oe-selftest - INFO - bblayers.BitbakeLayers.test\_bitbakelayers\_updatelayer (subunit.RemotedTestCase)  
2026-04-07 08:45:39,331 - oe-selftest - INFO - ... FAIL  
...  
2026-04-07 08:45:39,594 - oe-selftest - INFO - bblayers.BitbakeLayers.test\_validate\_bitbake\_setup\_default\_registry (subunit.RemotedTestCase)  
2026-04-07 08:45:39,594 - oe-selftest - INFO - ... FAIL  
...  
2026-04-07 08:45:39,819 - oe-selftest - INFO - bblayers.BitbakeLayers.test\_validate\_examplelayersjson (subunit.RemotedTestCase)  
2026-04-07 08:45:39,820 - oe-selftest - INFO - ... FAIL

<https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/3617>
<https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3499>

Can you have a look at the issue?

Quoted 7 lines

Thanks,
Mathieu

\--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
<https://bootlin.com>

Hi Mathieu,

Thanks for pointing this out. The fix is simply to use brackets to enclose the object in the examples property inside an array.

I expanded my testing to include oe-selftest. I just sent out a v2 of the patch series.

Cheers,
Rob