Skip to content

Commit

Permalink
fix(json-schema-2020-12): fix rendering of items keywords (#8674)
Browse files Browse the repository at this point in the history
As JSON Schema 2020-12 can be represented as
a Boolean Schema, different keyword detection
needs to be used.

Refs #8513
  • Loading branch information
char0n authored May 16, 2023
1 parent 2f0282d commit 67132cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
<span className="json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary">
Expand Down
2 changes: 1 addition & 1 deletion src/core/plugins/json-schema-2020-12/fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down

0 comments on commit 67132cc

Please sign in to comment.