So thank you for upgrading the dynamodb integration from step functions.
I'm now starting to use it.
Firstly, when doing this - the recommended way to map values in a step function:
"alarm_id": DynamoAttributeValue.from_number(JsonPath.number_at("$.detail.alarm_id")),
This is synthesized as "alarm_id":{"N":"-1.8881545897087864e+289"}}
Very weird. Especially since that is what is actually deployed...
Surely that should be
"alarm_id":{"N.$":"$.detail.alarm_id"}}
Then what about when I want to map a boolean?
There is no boolean_at in JsonPath...
So what I really want to know is why access to the constructor of DynamoAttributeValue is not provided because this would solve all my problems...
@michaelbrewer - from_number is for the case where you have a number to directly plug in, you'd want to use number_from_string and pass it the parameter you're currently giving it. can you give that a go and let me know how it turns out?
I'll need to dig into the boolean case a bit more, will take a look a bit later today
Yes, thank you @shivlaks - I looked at some of the tests and ascertained that is the way to do it.
"alarm_id": DynamoAttributeValue.number_from_string(JsonPath.string_at("$.detail.alarmId")),
works great...
Please let me know if you have something on booleans as I can't find an example mapping a boolean in the tests.
@michaelwiles are you attempting to set a boolean based on state input (by selecting part of the path?) we might need to add a booleanFromJsonPath method to support that as there's only fromBoolean that's currently available, which will allow you to set a value, but not select it from the state input.
Yes, that's what I am doing - and that's what is needed -> "booleanFromJsonPath"
@shivlaks I've created a pull request for this though it's going to need a bit more attention as I don't think I've followed the process properly.
@michaelwiles took a quick glance and provided some feedback. let me know if you're running into any issues iterating.
I'm happy to help get this PR filled out and past the goal line :)
thank you. will follow up
Most helpful comment
@michaelwiles are you attempting to set a boolean based on state input (by selecting part of the path?) we might need to add a
booleanFromJsonPathmethod to support that as there's onlyfromBooleanthat's currently available, which will allow you to set a value, but not select it from the state input.