automatically generate 'id' (if possible) and add 'type' attribute if it's missing. updated documentation.