feat: introduce samples framework for JSON Schema 2020-12

Refs #8577
This commit is contained in:
Vladimir Gorej
2023-05-30 13:40:15 +02:00
committed by Vladimír Gorej
parent 3059a63a0a
commit ac3b69fb3c
6 changed files with 811 additions and 6 deletions

View File

@@ -43,7 +43,15 @@ import KeywordWriteOnly from "./components/keywords/WriteOnly"
import Accordion from "./components/Accordion/Accordion"
import ExpandDeepButton from "./components/ExpandDeepButton/ExpandDeepButton"
import ChevronRightIcon from "./components/icons/ChevronRight"
import { upperFirst, hasKeyword, isExpandable } from "./fn"
import { upperFirst, hasKeyword, isExpandable } from "./fn/index"
import {
inferSchema,
sampleFromSchema,
sampleFromSchemaGeneric,
createXMLExample,
memoizedSampleFromSchema,
memoizedCreateXMLExample,
} from "./fn/samples"
import { JSONSchemaDeepExpansionContext } from "./context"
import { useFn, useConfig, useComponent, useIsExpandedDeeply } from "./hooks"
import { withJSONSchemaContext } from "./hoc"
@@ -97,6 +105,7 @@ const JSONSchema202012Plugin = () => ({
},
fn: {
upperFirst,
memoizedSampleFromSchema: null,
jsonSchema202012: {
isExpandable,
hasKeyword,
@@ -104,6 +113,12 @@ const JSONSchema202012Plugin = () => ({
useConfig,
useComponent,
useIsExpandedDeeply,
inferSchema,
sampleFromSchema,
sampleFromSchemaGeneric,
createXMLExample,
memoizedSampleFromSchema,
memoizedCreateXMLExample,
},
},
})