eclipsesource / eclipsesource/jsonforms

Duplicate validation warnings within oneOf

Open
#2,360 1 comment 0 reactions 0 assignees View on GitHub
core enhancement
Dominant language
TypeScript
Stars
2.7k
Forks
424
Avg merge
17d 8h
Merged PRs (30d)
1

Description

### Describe the bug

A similar issue was previously reported by bug #1265 which has been closed. I have encountered this problem using jsonforms 3.3.0.
Duplicate validation warnings when using oneOf block where items have required properties with the same name.
Only one of the items can be selected at a time but warnings are displayed for all of the items available for selection.

### Expected behavior

No duplication of validation errors.

### Steps to reproduce the issue

Use the following schema, select an application type and add an application.

export const schema = {
"definitions": {
"serviceType": {
"type": "string",
"description": "Type of service executed at runtime",
"enum": ["Run Task", "Export Data", "Import Data"],
"default": "Run Task"
},
"subjectIds": {
"type": "string",
"description": "Use , item delimitor for multiple subject ids"
},
"taskId": {
"type": "string",
"description": "Id of the automated task"
},
"aiaApplication": {
"type": "object",
"properties": {
"serviceType": {
$ref: "#/definitions/serviceType"
},
"subjectIds": {
$ref: "#/definitions/subjectIds"
},
"subjectType": {
"type": "string",
"enum": ["Contract Id", "Contract Id File"]
},
"taskId": {
$ref: "#/definitions/taskId"
}
},
"required": ["serviceType", "subjectIds", "subjectType", "taskId"]
},
"webApplication": {
"type": "object",
"properties": {
"serviceType": {
$ref: "#/definitions/serviceType"
},
"subjectIds": {
$ref: "#/definitions/serviceType"
},
"subjectType": {
"type": "string",
"enum": ["CPR"]
},
"taskId": {
$ref: "#/definitions/taskId"
}
},
"required": ["serviceType", "subjectIds", "subjectType", "taskId"]
}
},
"type": "object",
"properties": {
"applicationType": {
"type": "string",
"description": "Type of application run",
"enum": ["AIA", "Web"]
},
"application": {
"oneOf": [
{
$ref: "#/definitions/aiaApplication"
},
{
$ref: "#/definitions/webApplication"
}
]
}
},
"required": ["applicationType", "application"]
};

export const uischema = {
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"scope": "#/properties/applicationType"
},
{
type: "VerticalLayout",
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#/properties/applicationType",
"schema": {
"const": "AIA"
}
}
},
elements: [
{
type: 'VerticalLayout',
"elements": [
{
"type": "Control",
"scope": "#/properties/application/oneOf/0/properties/serviceType",
"options": {
"format": "string",
"default": "Run Task"
}
},
{
"type": "Control",
"scope": "#/properties/application/oneOf/0/properties/subjectIds",
"options": {
"multi": true
}
},
{
"type": "Control",
"label": "Subject type",
"scope": "#/properties/application/oneOf/0/properties/subjectType"
},
{
"type": "Control",
"scope": "#/properties/application/oneOf/0/properties/taskId",
"options": {
"format": "string",
}
}
]
}
]
},
{
type: "VerticalLayout",
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#/properties/applicationType",
"schema": {
"const": "Web"
}
}
},
elements: [
{
type: 'VerticalLayout',
"elements": [
{
"type": "Control",
"scope": "#/properties/application/oneOf/1/properties/serviceType",
"options": {
"format": "string",
"default": "Run Task"
}
},
{
"type": "Control",
"scope": "#/properties/application/oneOf/1/properties/subjectIds",
"options": {
"multi": true
}
},
{
"type": "Control",
"label": "Subject type",
"scope": "#/properties/application/oneOf/1/properties/subjectType"
},
{
"type": "Control",
"scope": "#/properties/application/oneOf/1/properties/taskId",
"options": {
"format": "string",
}
}
]
}
]
}
]
}

### Screenshots

![Duplicate validation warnings](https://github.com/user-attachments/assets/219eccf6-442b-4c76-bf20-d3d794f9692c)

### Which Version of JSON Forms are you using?

v3.3.0

### Framework

React

### RendererSet

Material

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.