Skip to content
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

omitExtraData trims out required property groups #1425

Closed
3 tasks done
MatinF opened this issue Aug 22, 2019 · 2 comments
Closed
3 tasks done

omitExtraData trims out required property groups #1425

MatinF opened this issue Aug 22, 2019 · 2 comments

Comments

@MatinF
Copy link

MatinF commented Aug 22, 2019

Prerequisites

Description

I've got a simple Schema example with two properties, each containing one property. The overarching properties are required to be in the formData, whereas the "sub properties" of each overarching property are optional.

The problem is that omitExtraData seems to trim out the overarching properties by default.

Steps to Reproduce

See playground link:
Playground link

When clearing the formData, the default formData is created - which looks as expected. Further, entering something in one of the property fields and then deleting this content leads to the default formData again.

Expected behavior

I would expect that when I hit submit, I get the output equal to the formData - i.e. below:

{
  "general": {
    "device": {},
    "security": {}
  }
}

This output should come regardless of whether I simply load the Schema and immediately hit submit - or whether I enter something in a field and then deletes that again.

Actual behavior

Instead, if I simply load the Schema and hit submit with the default formData (without editing the fields), none of the properties are included in the output (see the console). Instead I get an empty formData output in the console.

If I change one of the property fields in the editor and clear that data again in the editor, the formData looks the same as the default - but now the console "correctly" outputs the property that I edited (but not the other property until I also edit this).

This issue is rather critical for cases where users want to ensure that the formData contains the expected "skeleton" structure (in our case the device and security fields) when these are included in the Schema, at least when they're explicitly required.

I would expect the omitExtraData to primarily be used for eliminating property fields that are not included in the Schema - not the properties actually listed in the Schema.

Version

This was done August 22, using the playground.

@Tonexus
Copy link
Contributor

Tonexus commented Aug 22, 2019

FYI, this is fixed in #1419.

@MatinF
Copy link
Author

MatinF commented Aug 22, 2019

Thanks, looks to be resolved

@MatinF MatinF closed this as completed Aug 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants