So I’m starting out with Vue JSONForms and I’m trying to create a bare-bones custom text renderer. I know JSONForms has the vue-vanilla package, but I want to understand what are the basics needed for a custom renderer because later on I will need to do much more customization to each custom renderer I create. Here is what I have so far:
The renderers are an array of { renderer, tester } pairs. As you only hand over the renderer itself instead of an object containing the renderer and tester, JSON Forms can’t find the tester.
Note also that a renderer set which ONLY consists of the RenderersText renderer will likely also fail as JSON Forms by default auto generates a VerticalLayout UI Schema element for a JSON Schema object. So you should also at least add a layout renderer. See this very related question.
So instead of the renderer you should import the entry. If you are using the types of JSON Forms it should already complain when using the wrong one.
import { entry as renderersTextEntry } from '~/components/renderers/text/RenderersText.vue';
import { JsonFormsRendererRegistryEntry } from '@jsonforms/core';
const renderers: JsonFormsRendererRegistryEntry[] = [
renderersTextEntry,
// add your layout renderer entry here
]
I fixed the issue by adding markRaw to the renderers array, since this will make it so the components are not reactive and avoid getting the Proxy wrapped around them
Eventually the issue was solved since I added the following to the component […]
Ah I see the error was a Typescript problem! I thought this is about a runtime problem…
I fixed the issue by adding markRaw to the renderers array, since this will make it so the components are not reactive and avoid getting the Proxy wrapped around them
In our seed apps and package readmes we use Object.freeze.