-
Notifications
You must be signed in to change notification settings - Fork 380
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
Invalid output from oneOf element/wrong field bindings #1253
Comments
Thanks for the report! We experienced this issue ourselves in one of our projects and started working on a fix. I hope we'll be able to release a fix in the upcoming days, probably in the beginning of the next week. |
@johnmorrell We've released a new 2.2.1-alpha.0 release which should address this issue. Let me know if it works. |
Thank @edgarmueller, I've take a look at 2.2.1-alpha.0 and the data structure now looks good. The titles are big improvement too, but I did notice a case where the first title would be shown as ONEOF-0 rather than the title value. Simplified examples below: This works as expected
This results in first title being ONEOF-0
|
The problem in this case is that the |
Ah yes, of course. Thank you that works fine. I am also investigating an issue where I can't add an element to an array. It is something that seems to be working in v2.2.0 but not in this alpha. It is nested a couple of levels down but will try and provide a clearer example, assuming it is not an issue with my schema. |
We did a bit of refactoring internally related to ref resolution, so that might be the case. Any feedback/help is appreciated. |
There looks like there is an issue, I am seeing this is two different places that work ok on v2.2.0. In one case when adding an element I get a blank screen with message "An unexpected error has occurred.". The error in the console is:
In the other, clicking the add button does nothing and the console error is:
I appreciate this probably doesn't help much, I will try and provide an example schema to reproduce. |
I think this captures the issue, in v2.2.0 it is ok apart from the data structure issue and in the alpha it errors with 'No applicable field found.':
|
Thanks for the repro! I've had a look and it seems as if this is actually an error in the |
The tester has been fixed with v2.2.1-apha.2. I've tested it with your examples and it seems to do the trick, let me know if you experience any issues. |
I've just tried alpha.2 and I see the same two issues I did originally in my Schema, but the example above does now work. I'll try again for a simplified repro with this version and see what that looks like. |
A slight variation on the previous example, but with a oneOf as an object. This example behaves as one of the issues I see in my schema, where the array shows but pressing add does nothing, erroring to console.
|
Thanks for the example, I'll try to have a look later today. |
@edgarmueller thanks for the latest release. I have tested against alpha.3 and one of the two issues is fixed, unfortunately there seems to be one remaining, where I see the "An unexpected error has occurred." when adding to an array. This actually isn't within a oneOf, but is something that was working in v2.2.0 so probably related. It can be reproduced with:
|
@johnmorrell Thanks again for the example. Unfortunately it seems as our recent refactoring broke a couple of things which we didn't have tests for. We have added those now, so I hope it's fixed with 2.2.1-alpha.4. Let me now if you are still experiencing any issues. |
@edgarmueller alpha.4 looks good!! Thank you for all you help on this. We've been reviewing JSON Schema form libraries over the past 6 months and non have been able to support our schema. Mostly due to the heavy use of oneOf and general size and complexity ~2000 lines! This is the first time I have seen it fully supported. The original and follow up issues all look resolved, so feel free to close the issue. At some point we would love to have #1210 allowing us to use our schemas in their original form rather than combining to a single file, but it is great to be where we are with this. |
Great, glad it works! Thanks for all the examples! |
Describe the bug
Invalid JSON output from oneOf elements, where the output value is nested a level deeper than expected.
To Reproduce
Schema:
UISchema:
Enter string and inspect data as JSON, to get:
Expected behavior
Example output as JSON:
Browser (please complete the following information):
Used Setup (please complete the following information):
Additional context
JSON Forms v2.2.0
The text was updated successfully, but these errors were encountered: