koumoul-dev / vuetify-jsonschema-form

Create beautiful and low-effort forms that output valid data. Published on npm as @koumoul/vjsf.
https://koumoul-dev.github.io/vuetify-jsonschema-form/latest/
MIT License
539 stars 154 forks source link

Error in render for subschema when oneOf is nested inside allOf #240

Open lirantiebloom opened 3 years ago

lirantiebloom commented 3 years ago

Hi,

I'm trying to create a dynamic content using sub-schema. This work as expected until I try to nest oneOf inside of allOf. The model output seems to work as expected, the issue seems to be in the view. The following errors occur:

---> <VJsf>... (1 recursive calls)
       <VForm>
         <VApp>
           <Root> iframeConsoleRunner-d8236034cc3508e70b0763f2575a8bb5850f9aea541206ce56704c013047d712.js:1:3935
    N/window.console[N]< https://cpwebassets.codepen.io/assets/editor/iframe/iframeConsoleRunner-d8236034cc3508e70b0763f2575a8bb5850f9aea541206ce56704c013047d712.js:1
    VueJS 11
TypeError: t.properties is undefined
    readonlyItemSchema https://cdn.jsdelivr.net/npm/@koumoul/vjsf@1.25.0-beta.7/dist/main.js:1
    readonlyItemSchema https://cdn.jsdelivr.net/npm/@koumoul/vjsf@1.25.0-beta.7/dist/main.js:1
    VueJS 3
    renderArrayItemRO https://cdn.jsdelivr.net/npm/@koumoul/vjsf@1.25.0-beta.7/dist/main.js:1
    o https://cdn.jsdelivr.net/npm/@koumoul/vjsf@1.25.0-beta.7/dist/main.js:1
    renderEditableArray https://cdn.jsdelivr.net/npm/@koumoul/vjsf@1.25.0-beta.7/dist/main.js:1
    render https://cdn.jsdelivr.net/npm/@koumoul/vjsf@1.25.0-beta.7/dist/main.js:1
    VueJS 7
iframeConsoleRunner-d8236034cc3508e70b0763f2575a8bb5850f9aea541206ce56704c013047d712.js:1:3935

Code Pen example for the error
Code pen example for working rendering when I omit the allOf

Reproduce steps:

  1. Add an item to arr
  2. Select a subschema
  3. Fill the fields

EDIT: fixed link of second example

albanm commented 3 years ago

Sorry for the lack of response, I've been busy. I will try to have look later today or in the next few days.

MOHACGCG commented 3 years ago

i think you need to add a properties:{}, i have nested oneOfs and allOfs and they work.

edit, i tested your example and it does work: change to:

        allOf:[ 
              title: "select",
              properties:{},
              oneOf: [
              ....
lirantiebloom commented 3 years ago

Thanks, @MOHACGCG it does work! But isn't this a workaround?

MOHACGCG commented 3 years ago

@lirantiebloom it is a workaround but it is still a valid json schema!