We don't have precedent in the way that common law countries do, and the judgements in actual cases point in slightly different directions-- in one case a court felt that the failure to fire a warning shot made it not self-defence, in another fighting people trying to get into an apartment with a knife was deemed acceptable.
Generally though, if someone is breaking into your apartment while you're there, possibly trying to get at you, there's no limit, as long as you're actually trying to defend yourself (so no executing someone who you've clearly disabled, etc.).
If people are breaking into your apartment and you fire a warning shot, then proceed to shoot the attackers, no one will complain.
This guy for example was convicted of murder because he got his gun out without even trying to contact the police directly or indirectly. So even if he pulled the trigger under reasonable circumstances (a know violent offender was trying to take his rifle) he was found guilty because he should not have gone for the gun without considering alternatives like locking the door or fleeing.
I can’t see him being anywhere near guaranteed to claim self defense even if he had fired a warning shot first.
https://svenskjakt.se/start/nyhet/skot-inkraktare-med-algstu...
They just violently entered his home in an effort to attack him, dressed in a way designed to intimidate. These cops were deliberately cosplaying as some sort of a hit squad, they obviously wanted him to believe that they were going to kill him.
It's not like the cops just accidentally went out dressed like that.
What are you going to do after they enter the house (if they aren't indeed the police and you trust they won't kill or rape your family)?