Skip to content

Commit

Permalink
fix(json-schema-2020-12): handle boolean schemas properly
Browse files Browse the repository at this point in the history
Refs #8513
  • Loading branch information
char0n committed Apr 26, 2023
1 parent a9dc6b0 commit 66d5503
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { schema } from "../../prop-types"
import { useComponent } from "../../hooks"

const Contains = ({ schema }) => {
if (!schema?.contains) return null
if (!Object.hasOwn(schema, "contains")) return null

const JSONSchema = useComponent("JSONSchema")
const name = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { schema } from "../../prop-types"
import { useComponent } from "../../hooks"

const Else = ({ schema }) => {
if (!schema?.else) return null
if (!Object.hasOwn(schema, "contains")) return null

const JSONSchema = useComponent("JSONSchema")
const name = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { schema } from "../../prop-types"
import { useComponent } from "../../hooks"

const If = ({ schema }) => {
if (!schema?.if) return null
if (!Object.hasOwn(schema, "if")) return null

const JSONSchema = useComponent("JSONSchema")
const name = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { schema } from "../../prop-types"
import { useComponent } from "../../hooks"

const Not = ({ schema }) => {
if (!schema?.not) return null
if (!Object.hasOwn(schema, "contains")) return null

const JSONSchema = useComponent("JSONSchema")
const name = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { schema } from "../../prop-types"
import { useComponent } from "../../hooks"

const Then = ({ schema }) => {
if (!schema?.then) return null
if (!Object.hasOwn(schema, "then")) return null

const JSONSchema = useComponent("JSONSchema")
const name = (
Expand Down
10 changes: 5 additions & 5 deletions src/core/plugins/json-schema-2020-12/fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ export const isExpandable = (schema) => {
schema?.allOf ||
schema?.anyOf ||
schema?.oneOf ||
schema?.not ||
schema?.if ||
schema?.then ||
schema?.else ||
Object.hasOwn(schema, "not") ||
Object.hasOwn(schema, "if") ||
Object.hasOwn(schema, "then") ||
Object.hasOwn(schema, "else") ||
schema?.dependentSchemas ||
schema?.prefixItems ||
schema?.items ||
schema?.contains ||
Object.hasOwn(schema, "contains") ||
schema?.properties ||
schema?.patternProperties ||
schema?.description
Expand Down

0 comments on commit 66d5503

Please sign in to comment.