From 67132cc72681603c305f3d45372a2f7a260d06df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Gorej?= Date: Tue, 16 May 2023 12:45:34 +0200 Subject: [PATCH] fix(json-schema-2020-12): fix rendering of items keywords (#8674) As JSON Schema 2020-12 can be represented as a Boolean Schema, different keyword detection needs to be used. Refs #8513 --- .../json-schema-2020-12/components/keywords/Items.jsx | 5 +++-- src/core/plugins/json-schema-2020-12/fn.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/plugins/json-schema-2020-12/components/keywords/Items.jsx b/src/core/plugins/json-schema-2020-12/components/keywords/Items.jsx index cb2d729373a..e8591da42d7 100644 --- a/src/core/plugins/json-schema-2020-12/components/keywords/Items.jsx +++ b/src/core/plugins/json-schema-2020-12/components/keywords/Items.jsx @@ -4,15 +4,16 @@ import React from "react" import { schema } from "../../prop-types" -import { useComponent } from "../../hooks" +import { useFn, useComponent } from "../../hooks" const Items = ({ schema }) => { + const fn = useFn() const JSONSchema = useComponent("JSONSchema") /** * Rendering. */ - if (!schema?.items) return null + if (!fn.hasKeyword(schema, "items")) return null const name = ( diff --git a/src/core/plugins/json-schema-2020-12/fn.js b/src/core/plugins/json-schema-2020-12/fn.js index d909e0d62fe..b45e2a5f734 100644 --- a/src/core/plugins/json-schema-2020-12/fn.js +++ b/src/core/plugins/json-schema-2020-12/fn.js @@ -151,7 +151,7 @@ export const isExpandable = (schema) => { fn.hasKeyword(schema, "else") || schema?.dependentSchemas || schema?.prefixItems || - schema?.items || + fn.hasKeyword(schema, "items") || fn.hasKeyword(schema, "contains") || schema?.properties || schema?.patternProperties ||