Is altitude and heading at your discretion when cleared for a visual approach?

A visual approach is an IFR procedure. It authorizes you to proceed visually clear of clouds to the airport when cleared to do so. You may make whatever normal maneuvers necessary to safely conduct the approach and landing including descents and turns after being cleared. Under most conditions, you are responsible for your own terrain clearance and separation.

Note that a visual approach is different from a “Charted Visual Approach Procedure,” which KSAN happens to have for Runway 27. If cleared for the charted visual, then you must fly it as depicted. If the pilot fails to report the airport in sight, further vectors may be required to ensure they continue to follow the prescribed tracks until they have confirmed that they are visual with the airport.