fastn icon indicating copy to clipboard operation
fastn copied to clipboard

Default value of record field is not accepted (`file` in `get-data` processor)

Open Arpita-Jaiswal opened this issue 1 year ago • 0 comments

Given a record person

-- record person:
caption name:
body bio:
boolean is-adult: true

If we try to get the corresponding data of type person from the JSON file:

data.json

{"name": "Ritesh", "bio": "I am Ritesh"}

The following code will throw an error:

-- import: fastn/processors as pr

-- person ritesh:
$processor$: pr.get-data
file: data.json

-- display-person: $ritesh

-- component display-person:
caption person p:

;; definition omitted

-- end: display-person

The error is

{ message: "failed to parse ParseError { message: \"key not found: is-adult\", doc_id: \"fastn-stack.github.io/questionnaires/f/\", line_number: <some line number> }" }

The expected behaviour is that the value of is-adult should be taken from the default value of the is-adult field in record person.

Arpita-Jaiswal avatar Jun 13 '23 08:06 Arpita-Jaiswal