Skip to content

Property with reference is not rendered #2187

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

Closed
KIC opened this issue Oct 6, 2023 · 1 comment · Fixed by #2202
Closed

Property with reference is not rendered #2187

KIC opened this issue Oct 6, 2023 · 1 comment · Fixed by #2202
Assignees
Milestone

Comments

@KIC
Copy link

KIC commented Oct 6, 2023

Describe the bug

While the address renders fine, given the json schema below, the parent does not render at all.

type: "object",
definitions: {
  Client: {
      "address": {
          "type": "array",
          "items": {
              "$ref": "#/definitions/Address"
          }
      },
      "parent": {
          // https://jsonforms.io/docs/tutorial/multiple-forms#interlinked-inputs
          "$ref": "#/definitions/SearchableObject/properties/a_very_special_field"
          //"$ref": "#/definitions/SearchableObject"
          //"type": "object"
          //items: {"$ref": "#/definitions/SearchableObject"}
          //item: {"$ref": "#/definitions/SearchableObject"}
      }
  },
  SearchableObject: {
      "type": "object",
      "properties": {
          "a_very_special_field": {
              "type": "integer"
          }
      },
      "required": []
  },
 properties: {
    "Client": {
        "$ref": "#/definitions/Client"
    }
}

As soon as I turn the parent into an array field just like the address it renders fine again (but of course is an array which is not what I need).

Expected behavior

Render the Sub-Form for the parent object like for array fields

Steps to reproduce the issue

Render form using the jsonschema above und leave the uischema undiefined.

Screenshots

No response

In which browser are you experiencing the issue?

Google Chrome

Which Version of JSON Forms are you using?

3.1.0

Framework

React

RendererSet

Material

Additional context

No response

@sdirix
Copy link
Member

sdirix commented Oct 18, 2023

Hi @KIC,

The posted schema is invalid and/or incomplete. For example the Client is not a valid JSON Schema. address also seems to point to a non-existing Address.

I adjusted it to the following

{
  "type": "object",
  "definitions": {
    "Client": {
      "type": "object",
      "properties": {
        "address": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Address"
          }
        },
        "parent": {
          "$ref": "#/definitions/SearchableObject/properties/a_very_special_field"
        }
      }
    },
    "Address": {
      "type": "string"
    },
    "SearchableObject": {
      "type": "object",
      "properties": {
        "a_very_special_field": {
          "type": "integer"
        }
      },
      "required": []
    }
  },
  "properties": {
    "Client": {
      "$ref": "#/definitions/Client"
    }
  }
}

Then I was able to reproduce the problem: The "parent" is not rendered. The error seems to be the same as reported here. As noted in the link, the problem is that the MaterialObjectRenderer does not hand over enough context to the UI Schema generator to successfully resolve the reference to the a_very_special_field.

This needs to be fixed. Contributions welcome!

@sdirix sdirix added this to the 3.2 milestone Oct 18, 2023
@sdirix sdirix changed the title Multiple Forms Interlinked inputs works for arrays but not for object relation Property with reference is not rendered Oct 18, 2023
LukasBoll added a commit to LukasBoll/jsonforms that referenced this issue Oct 27, 2023
Previously, UI schemas generated in the Material object renderer
were incomplete because not all refs could be resolved.

Closes eclipsesource#2187
LukasBoll added a commit to LukasBoll/jsonforms that referenced this issue Nov 6, 2023
Previously, UI schemas generated by JsonForms were incomplete in many instances
because not all references were resolved. This commit addresses the issue by
providing the root schema to all usages of the Generate.uischema function,
ensuring the resolution of all references.

Closes eclipsesource#2187
sdirix pushed a commit that referenced this issue Nov 13, 2023
Previously, UI schemas generated by JsonForms were incomplete in many instances
because not all references were resolved. This commit addresses the issue by
providing the root schema to all usages of the Generate.uischema function,
ensuring the resolution of all references.

Closes #2187
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.

3 participants