Question about required config values from <struct...
# general
p
Question about required config values from structured config: Suppose I have an interface:
Copy code
interface PeopleArgs {
  name: string
  age?: number
}
And a config file that looks something like:
Copy code
config:
  things:people:
  - name: Peter Parker
    age: 40
  - name: Mary Jane
  - age: 38
And in my Pulumi program I load the config:
Copy code
let config = new pulumi.Config("things");
let people = config.requireObject<PeoplegArgs[]>("people");
The first two should be fine. But I’d expect the third element to raise an error because it doesn’t satisfy the
PeopleArgs
interface (it’s missing
name
). Instead, it seems that Pulumi puts
undefined
there. Is this expected behaviour or a bug? And has anyone who’s encountered this found a workaround?
b
I would expect that behavior from javascript/ts deserialization
👍 1