rero / ng-core

Angular library for Invenio
4 stars 12 forks source link

Form option does not work in definition. #547

Closed jma closed 9 months ago

jma commented 1 year ago

Describe the issue From option such as type does not work in definition.

To Reproduce Steps to reproduce the behavior:

Form

  1. Run the demo
  2. replace the jsonschema by:
    {
    "definitions": {
      "name": {
        "title": "Name",
        "type": "string",
        "form": {
            "type": "textarea"
        }
      }
    },
    "type": "object",
    "properties": {
      "name": {
        "title": "Name",
        "$ref": "#/definitions/name"
      }
    }
    }

    Thus the name is not using the textarea.

If the form option is declared outside of the definition it works.

Widget

  1. Run the demo
  2. replace the jsonschema by:
    {
    "definitions": {
    "name": {
      "title": "Name",
      "type": "string",
      "widget": {
        "formlyConfig": {
          "type": "textarea"
        }
      }
    }
    },
    "type": "object",
    "required": ["name"],
    "properties": {
    "name": {
      "title": "Name",
      "$ref": "#/definitions/name"
    }
    }
    }

Thus the name is not using the textarea. If the form option is declared outside of the definition or the remove the field from the required it works.

Seem related to: https://github.com/rero/ng-core/blob/fbff536e2b2690534a9960009e4c34eed884c3c4/projects/rero/ng-core/src/lib/record/editor/utils.ts#L42

Software version Tell us which version you're using: ng-core: 14.2.1