so, if it is too high because of having the board inside a cover, that probably means you aren't going to have much airflow for cooling. if you are running current through that diode that would require it to be up off the board, then restricted airflow is a bad idea. so the question is: how much current is going through the diode? if it's more than half the rated current of the diode, it should be kept off the board. if it's a zener diode, it should definitely be up off the board.