Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering of arrays of union types no longer working from 3.0.0-beta.5 #1996

Closed
JarnoRFB opened this issue Aug 11, 2022 · 1 comment · Fixed by #2000
Closed

Rendering of arrays of union types no longer working from 3.0.0-beta.5 #1996

JarnoRFB opened this issue Aug 11, 2022 · 1 comment · Fixed by #2000
Assignees
Milestone

Comments

@JarnoRFB
Copy link

Describe the bug

I am using react with material-renderers. Up to 3.0.0-beta.4 arrays of union types, e.g.

    "test": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "value": {
                "type": "string"
              }
            },
            "required": ["value"]
          },
          {
            "type": "object",
            "properties": {
              "value": {
                "type": "number"
              }
            },
            "required": ["value"]
          }
        ]
      }
    }

where rendered, from 3.0.0-beta.5 onward, only the message No applicable renderer found. is displayed.

Expected behavior

An array of union types (anyOf, oneOf) should be rendered again as an array form.

Steps to reproduce the issue

import {
    materialRenderers,
    materialCells,
  } from '@jsonforms/material-renderers';
import { JsonForms } from "@jsonforms/react";

const schema = {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "properties": {
      "test": {
        "type": "array",
        "items": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string"
                }
              },
              "required": ["value"]
            },
            {
              "type": "object",
              "properties": {
                "value": {
                  "type": "number"
                }
              },
              "required": ["value"]
            }
          ]
        }
      },
    }
}


const TestComponent = () => 
    <div>
        <JsonForms 
        schema={schema}
        data={{}}
        renderers={materialRenderers}
        cells={materialCells}
        onChange={(data) => {console.log(data)}}
        />
    </div>

export default TestComponent;

Screenshots

beta.4

image

beta.5

image

In which browser are you experiencing the issue?

Google Chrome Version 103.0.5060.134 (Official Build) (64-bit)

Framework

React

RendererSet

Material

Additional context

No response

@sdirix
Copy link
Member

sdirix commented Aug 11, 2022

Thanks for the report, we're gonna take a look!

@sdirix sdirix added this to the 3.0 milestone Aug 11, 2022
@sdirix sdirix assigned lucas-koehler and LukasBoll and unassigned LukasBoll Aug 18, 2022
lucas-koehler added a commit to lucas-koehler/jsonforms that referenced this issue Aug 18, 2022
Adapts the `isObjectArrayWithNesting` tester to return true for an array that has an `anyOf` or `oneOf` as its items definition.
This was already the case earlier. Thus, this is not a new behavior but fixes a regression.

Fix eclipsesource#1996

Signed-off-by: Lucas Koehler <lkoehler@eclipsesource.com>
@sdirix sdirix closed this as completed in c9e289b Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants