Skip to content

Duplicate validation warnings within oneOf #2360

Open
@chadmcivor

Description

@chadmcivor

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

Which Version of JSON Forms are you using?

v3.3.0

Framework

React

RendererSet

Material

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions