Oddbean new post about | logout
 The UX rule of thumb I've heard is "Don't punish the user before they've performed an action."

So best practice is to make optional fields optionally visible, and not to show the red stars and such oj mandatory fields unless the user tries to submit the form without filling out all the necessary fields.