It depends on what you are comfortable wearing, assuming there is no dress code for your class. Ask the instructor what they think. I guess there is nobody else wearing a leotard or you wouldn't need to ask.
I have just started yoga and I wear a pair of tight leggings, which I find very comfortable, and a close fitting tee-shirt. I'm thinking about wearing a leotard with the leggings but I hadn't worked up the courage to do so yet. Several other guys wear lycra compression shorts and so do some of the women. Other women wear capri or full length leggings or yoga pants. None wear a leotard but there are quite few skimpy tee-tops and camisoles so a short sleeve Leo wouldn't be too revealing.
If you feel comfortable wearing a leotard and the instructor is okay with it go for it. It has got to be the most comfortable thing to wear. Let us hear what happens.
So here is an update. a couple of months ago I asked my yoga instructor if she thought a leotard and lycra shorts would been okay for yoga. She said yes and I have been wearing just that ever since. I feels great and nobody has made any comment about it.