onde icon indicating copy to clipboard operation
onde copied to clipboard

Default values don't appear in exported data

Open pnico opened this issue 13 years ago • 3 comments

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?

pnico avatar Jan 05 '12 23:01 pnico

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.

exavolt avatar Jan 06 '12 05:01 exavolt

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?

pnico avatar Jan 18 '12 17:01 pnico

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

exavolt avatar Jan 19 '12 11:01 exavolt