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

Unable to generate uischema for null type #2207

Closed
buremba opened this issue Nov 9, 2023 · 2 comments · Fixed by #2251
Closed

Unable to generate uischema for null type #2207

buremba opened this issue Nov 9, 2023 · 2 comments · Fixed by #2251
Assignees
Milestone

Comments

@buremba
Copy link

buremba commented Nov 9, 2023

Describe the bug

When the JSON Schema has the following null type, uischema can't get generated and it fails with the following error:

> Generate.uiSchema(schema)
Error: Unknown type: {"type":"null"}
type: object
properties:
  examplefield:
     type: null

Expected behavior

I expect the fields with a null type (and type not defined) to be rendered in the form in a custom renderer or with a fallback component.

Steps to reproduce the issue

Skip defining a schema and uischema and try to render the following data:

<JsonForms data={{examplefield: null}}

Note that Generate.jsonSchema generates the schema above.

Screenshots

No response

In which browser are you experiencing the issue?

Google Chrome

Which Version of JSON Forms are you using?

v.3.1.0

Framework

Core, React

RendererSet

Material

Additional context

No response

@sdirix
Copy link
Member

sdirix commented Nov 14, 2023

Hi @buremba,

Thanks for the report! You are right, we should at least not throw an error. The best guess would probably to generate a JSON Schema which defines examplefield as type: "null".

Do you want to contribute this improvement? The generator can be found here.

@sdirix sdirix added the core label Nov 14, 2023
@sdirix sdirix added this to the next milestone Nov 14, 2023
@sdirix sdirix added the bug label Nov 28, 2023
@sdirix sdirix modified the milestones: next, 3.x Nov 28, 2023
LukasBoll added a commit to LukasBoll/jsonforms that referenced this issue Dec 4, 2023
Previously, the default UI schema generation function threw error when
encountering data containing a null value. With this commit, a control
with type null will be generated, that can be used in custom renderers.

Closes eclipsesource#2207
@gnillev
Copy link

gnillev commented Jan 19, 2024

Any update on this? I can see there was some work done on a fix back in december :)

sdirix added a commit that referenced this issue Jan 22, 2024
Previously, the default UI schema generation function threw an error when
encountering a null type. With this commit, a control will be generated, that
can be used in custom renderers.

Closes #2207
@sdirix sdirix modified the milestones: 3.x, 3.2 Jan 30, 2024
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