Skip to content

Optional field save behavior can break validations #241

@mshick

Description

@mshick

I see this listed as a feature under Better data output, but the save behavior for fields flagged as required: false can lead to data corruption and failed validations. In general it's pretty odd to populate values for data explicitly marked as optional / non-required.

An example would be a string field that on save is written as myfield: ''. If that field had a min length validation in a generator it would now fail to build. Likewise, empty string != undefined, and checks or logic built around presence or non-presence of a field would fail to behave as expected.

Ideally default values would only be set on fields that explicitly have a default value set in the configuration.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions