onde
onde copied to clipboard
Default values don't appear in exported data
If you set default values in the schema, they appear in the form in gray, but if you don't change them, they don't show up in the exported data. Is this intentional?
It's intentional.
I expect that the applications which validate and/or read the data know the what the default values are (whether from the schema or hardcoded).
But we could have a discussion here whether we could have an option for this and what the default behavior should be: export or not.
That makes sense for compactness, but in practice I don't know of any JSON parsers that fill in default values for you from a schema (which is what I would want in this case). Let me know if you know of any.
I think there should at least be an option to export them. Maybe if they are required?
I see. In any case, this issue should be implemented as:
- Required field with default value will use its default value if the user didn't provide any value regardless the option below
- Option on export of how fields with default value should be processed if the user didn't provide data
I've implemented the first point: https://github.com/exavolt/onde/commit/f5db378b96d57b3933fd1ffcc2184c8ae189f338