Setting parameter values on nested schemas

Continuing the discussion from Creating a nested array of objects from a sample schema:

It is possible to set values for fields when using the api using set "fieldname", key: "value". This works for me. Now I am trying to set parameter values for nested schemas, but so far I haven’t been able to do it successfully.

Take the following: set "body", min: 1, max: 1. This should limit the body field on my schema to a single paragraph. Using the API script below I attempted to use this where indicated by --> to no effect.

# somepage
# generate a single "page" record from my "page" schema
schema "page"
page = generate 1

# generate from ContentItem
# nest content items inside my "page" schema using my "ContentItem" schema.
schema "ContentItem"

# create an array of three accountAction content items.
         --> attempted here (see results 1)
page["accountActions"] = generate 3
page["accountActions"].each do |action|
         --> attempted here (see result 1)
         --> even attempted: action["body"] = set "body", min: 1, max: 1 (see result 2)
  action["category"] = ["accountActions","home"]
  action["imageUrl"] = "user"
  action["imageType"] = "SvgUse"
end

#return the response, my page record with all its nested items
page

### END API SCRIPT

OUTPUT

My output is what I would expect with all my nested content items, except for the body field, results below:

  • result 1: paragraph length follows schema settings, not “set” parameters.
  • result 2:
    "body": {
        "min": "1",
        "max": "1"
    }
    

What am I doing wrong?

I’m still not able to solve this. Any suggestions?

Anybody know how to solve this? We’d love to figure this one out.