import { CreateTypes } from "@theme/JSONSchemaViewer/components"
import {
SchemaComposition,
SchemaConditional,
} from "@theme/JSONSchemaViewer/JSONSchemaElements"
import { CreateValidOrInvalid } from "@theme/JSONSchemaViewer/components"
import {
isSchemaComposition,
isSchemaConditional,
} from "@theme/JSONSchemaViewer/utils"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"
import type { JSX } from "react"
type Props = {
[x: string]: any
schema: JSONSchema
}
// Entry point
export default function CreateNodes(props: Props): JSX.Element {
const { schema } = props
if (typeof schema === "boolean") {
return
}
// Type Checks
const isComposition = isSchemaComposition(schema)
const isConditional = isSchemaConditional(schema)
return (
<>
{/* Handle standard types */}
{/* handle anyOf / allOf / oneOf / not */}
{isComposition && }
{/* Conditional part of the schema */}
{isConditional && }
>
)
}