When using data generated by a schema containing anyof, the result is incorrect after assignment to the editor.
See original GitHub issueExpected behavior
The editor can correctly assign values based on json
Actual behavior
The editor cannot use the correct anyOf subkey when assigning the anyOf field
Steps to reproduce the behavior
{
"title": "anyof badcase",
"type": "object",
"properties": {
"items": {
"title": "title",
"type": "array",
"format": "tabs",
"items": {
"title": "item",
"headerTemplate": "{{self.handler}}",
"options": {
"keep_oneof_values": false
},
"anyOf": [
{
"title": "item a",
"properties": {
"handler": {
"default": "aaa"
},
"___a": {
"title": "___",
"type": "string"
}
}
},
{
"title": "item b",
"properties": {
"handler": {
"default": "bbb"
},
"___b": {
"title": "___",
"type": "string"
}
}
},
{
"title": "item c",
"properties": {
"params": {
"properties": {
"items": {
"title": "sub items",
"type": "array",
"format": "tabs",
"items": {
"options": {
"keep_oneof_values": false
},
"title": "sub item",
"headerTemplate": "{{self.handler}}",
"anyOf": [
{
"title": "item a",
"properties": {
"handler": {
"default": "aaa"
},
"___a": {
"title": "___",
"type": "string"
}
}
},
{
"title": "item b",
"properties": {
"handler": {
"default": "bbb"
},
"___b": {
"title": "___",
"type": "string"
}
}
}
]
}
}
}
},
"handler": {
"default": "ccc"
},
"___c": {
"title": "___",
"type": "string"
}
}
}
]
}
}
}
}
generated data:
{
"items": [
{
"handler": "aaa",
"___a": ""
},
{
"handler": "bbb",
"___b": ""
},
{
"params": {
"items": [
{
"handler": "aaa",
"___a": ""
},
{
"handler": "bbb",
"___b": ""
},
{
"handler": "aaa",
"___a": ""
}
]
},
"handler": "ccc",
"___c": ""
}
]
}
Update the editor with the generated data.
screenshot
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (5 by maintainers)
Top Results From Across the Web
oneOf, anyOf, allOf, not - Swagger
Use the anyOf keyword to validate the data against any amount of the given subschemas. That is, the data may be valid against...
Read more >Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >W3C XML Schema Definition Language (XSD) 1.1 Part 1
Abstract. This document specifies the XML Schema Definition Language, which offers facilities for describing the structure and constraining ...
Read more >Documentation: 15: 5.9. Schemas - PostgreSQL
The first element specifies that a schema with the same name as the current user is to be searched. If no such schema...
Read more >Image Classification Wizard—ArcGIS Pro | Documentation
If you want to assess the accuracy of classified results, you need to provide a reference dataset. Reference data consists of features with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry, I don’t have time for that and the bug is already explained quite well here. I just wanted to point out that this is still a bug, and rather an annoying one which is difficult to track down. Feel free to use/manage this bug report however you think is appropriate.
On Mon, 18 Feb 2019 at 06:17, Peter Klein notifications@github.com wrote:
In my opinion this ticket should not have been closed. As far as I can tell, there is still no foolproof way to ensure that the correct schema is used for children in a
oneOf
oranyOf
when loading data.The comment suggesting this has been fixed uses data that makes it appear to work, but as @wclssdn commented earlier it still doesn’t work if the sub-items are more complex and the data (although unambiguously matching a specific schema) is incomplete.
To test this, load up the schema link posted by @pmk65 in the comment declaring this fixed, but then refresh the form using data from @Richacinas comment and you will see that the third item (ccc) now incorrectly uses the aaa schema.