description of light rays

light rays are affected by gravitational fields due to the condition \(\mathrm{d}s^2=0\): when is it sufficient to use this condition and when would you need to use the geodesic equation?