diff mbox series

[v2,3/9] bitbake-setup.schema.json: Use anyOf for non-disjoint subschemas

Message ID 20260407150250.104135-4-rob.woolley@windriver.com
State Accepted, archived
Commit b36206e1f2e4f2a7a22d6efe6ca341d6055c3b36
Headers show
Series bitbake-setup JSON Schema: Fix linting errors | expand

Commit Message

Rob Woolley April 7, 2026, 3:02 p.m. UTC
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)

Signed-off-by: Rob Woolley <rob.woolley@windriver.com>
---
 setup-schema/bitbake-setup.schema.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yoann Congal May 28, 2026, 10:48 a.m. UTC | #1
On Tue Apr 7, 2026 at 5:02 PM CEST, Rob Woolley via lists.openembedded.org wrote:
> 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)
>
> Signed-off-by: Rob Woolley <rob.woolley@windriver.com>

Reviewed-by: Yoann Congal <yoann.congal@smile.fr>
> ---
>  setup-schema/bitbake-setup.schema.json | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/setup-schema/bitbake-setup.schema.json b/setup-schema/bitbake-setup.schema.json
> index 3324546de..f2e466c9b 100644
> --- a/setup-schema/bitbake-setup.schema.json
> +++ b/setup-schema/bitbake-setup.schema.json
> @@ -92,7 +92,7 @@
>                                  "type": "array",
>                                  "description": "List of BitBake configuration fragments to enable",
>                                  "items": {
> -                                    "oneOf": [
> +                                    "anyOf": [
>                                          {
>                                              "type": "string",
>                                              "description": "Configuration fragment name"
diff mbox series

Patch

diff --git a/setup-schema/bitbake-setup.schema.json b/setup-schema/bitbake-setup.schema.json
index 3324546de..f2e466c9b 100644
--- a/setup-schema/bitbake-setup.schema.json
+++ b/setup-schema/bitbake-setup.schema.json
@@ -92,7 +92,7 @@ 
                                 "type": "array",
                                 "description": "List of BitBake configuration fragments to enable",
                                 "items": {
-                                    "oneOf": [
+                                    "anyOf": [
                                         {
                                             "type": "string",
                                             "description": "Configuration fragment name"