There are many optics books and websites that provide information to answer this question. For example:
The old rule of thumb: "The best definition is obtained 2-stops down from wide open" still holds for modern lenses.
Larger apertures are subject to aberrations (coma, spherical etc.) that can be eliminated by stopping down a couple of stops. The exceptions are lateral chromatic and distortion.
Stopping down beyond this degrades the image by diffraction. This point is called the diffraction limit. Further stopping down causes increased degradation because of diffraction.
The smaller the physical size of the aperture the greater the diffraction caused degradation. The wave length of light is constant so focal length, format etc come into play.
So stop down 2-stops for the best definition. Stop down more if you need the depth-of-field but you will lose some sharpness at the focused subject plane.
Photography is simple, don't make it complicated.