AdaptiveCards Id only in Input type
I notice that CardElement, TypedElement is missing the Id property shown throughout the schema and indeed only the Input type contains it. Is there any reason why it is not removed from Input and added to TypedElement?
Every object in the stack needs a property for a unique ID.
Cheers
Hey Brennon, why do you believe every element needs an ID property?
Thanks! Andrew
Hi Andrew,
It depends on the view of the platform architects to be honest and what their intentions are for extensibility.
Without an ID for each element, the ability to modify the element properties at runtime becomes quite difficult and error prone.
In my example, I want the user to be able to modify JSON in the text editor, and from there update the underlying object model to reflect the user changes.
Without the ID being present in the element, I would overwrite any previous elements from the card object collection and lose important connections between them (as they are referenced by unique ID).
I completely understand (and agree with) the view of keeping the element property surface as clean as possible,
In my experience, not being able to uniquely identify objects causes issues. Eventually the developer will have a need to traverse the adaptivecard object at runtime. This could be for testing, analytics or dynamic changes to the object for exmple.
[Additional Thoughts] Aside from the original note that the schema shows an ID property available on every element, I assume that a concept of binding maybe considered down the road and without an ID, that becomes challenging, performance killing and very messy.
Yes this could be done with a concept of AttachedProperties, but then we are heading into XAML concepts which could be argued against by other platforms that are not XAML based and dont have that concept.
I'm not saying that it needs to be required outside of the elements that already contain required ID's - just that it may reduce some pain down the road.
Just some thoughts.
Cheers
Thanks for the discussion guys, the Id property was added to AdaptiveTypedElement