For my part I think casting while within melee reach of an enemy should be flat-out impossible*, and taking damage from any other source should - with a very few specific exceptions - interrupt the spell. And no "combat casting" or equivalent to get around this.I was pretty shocked there was no opportunity attack against casters in 5e, just disadvantage on the caster's attack roll if the caster uses a ranged attack roll spell while threatened. No impact for attack spells that use saves.
I was a fan of what I remember of the 4e mechanics where touch spells did not provoke opportunity attacks but ranged attacks/spells/powers did.
* - unless the caster's specific intent is to have the spell interrupted and possibly go wild, if wild surges are a thing in that campaign. I've seen this done in play, where a caster with no other option in effect tries to cast a wild surge and hopes for the best.