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
This commit is contained in:
Vladimír Gorej
2023-05-16 12:45:34 +02:00
committed by GitHub
parent 2f0282d063
commit 67132cc726
2 changed files with 4 additions and 3 deletions

View File

@@ -4,15 +4,16 @@
import React from "react" import React from "react"
import { schema } from "../../prop-types" import { schema } from "../../prop-types"
import { useComponent } from "../../hooks" import { useFn, useComponent } from "../../hooks"
const Items = ({ schema }) => { const Items = ({ schema }) => {
const fn = useFn()
const JSONSchema = useComponent("JSONSchema") const JSONSchema = useComponent("JSONSchema")
/** /**
* Rendering. * Rendering.
*/ */
if (!schema?.items) return null if (!fn.hasKeyword(schema, "items")) return null
const name = ( const name = (
<span className="json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary"> <span className="json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary">

View File

@@ -151,7 +151,7 @@ export const isExpandable = (schema) => {
fn.hasKeyword(schema, "else") || fn.hasKeyword(schema, "else") ||
schema?.dependentSchemas || schema?.dependentSchemas ||
schema?.prefixItems || schema?.prefixItems ||
schema?.items || fn.hasKeyword(schema, "items") ||
fn.hasKeyword(schema, "contains") || fn.hasKeyword(schema, "contains") ||
schema?.properties || schema?.properties ||
schema?.patternProperties || schema?.patternProperties ||