All of them are technically correct.
A very short response can seem curt and gruff, so we might extend the answer to avoid that impression.
A very short response might be ambiguous in the context of a given question, and a longer response clearer.
A short response might be preferable if we are answering a series of questions.
Some dialects favour one form or another. Hiberno-English would favour "I did" (especially in informal use) or "Yes, I did", or "I did, yes" as a legacy of the lack of a single-word for yes or no in Irish affecting how English is spoken in Ireland.*
A longer response might also be used for emphasis, particularly if the question seemed to assume a "no", while the answer is "yes":
Did you not read that book?
Yes, I did read it.
Here we're not just answering the question's at the bare level of information conveyed, but also responding to the accusatory nuance that negative questions can have.
Conversely, if the context suggests a perfunctory check where the querent is expecting the answer you are going to give, that might lean us towards a bare yes or no.
By extension, adding much more information than required may seem just as gruff as giving the bare minimum: The form "Yes, I did. I read the book" answers the question three times. If there was no reason to emphasise it that much, it may seem overly adamant to the point of being slightly rude.
Irrelevant to your examples, but relevant to the more general question: If the question is about whether we want something, or want somebody to do something, then "Yes, please" or "No, thank you" is considered much more polite. This can be extended further such as "Yes, I would, please", "Yes, I'd like that very much, thank you", "No, I'd rather not, but thank you for asking", etc.
*Sadly this leads to a new ambiguity, because "I don't, no" sounds close to "I don't know". I have found that if an airport security guard asks if you have any electronics in your luggage, it is inadvisable to answer "I don't, no".