This question might be similar to the question "Is it possible for a swallowed caster to cast Fireball outside of a Giant Toad?", but is not a duplicate.
In my situation, a homebrew monster swallowed the entire party. I planned in the story for the monster in question to take the party into its lair. But one of the players made a decision I did not expect: he cast fireball on his own character to try to pry open the creature's mouth at the expense of his own health.
As per the description of the fireball spell:
A bright streak flashes from your pointing finger to a point you choose within range [...]
While the character was restrained and blinded, nothing realistically prevented him from pointing the finger towards himself... So I ruled in his favor, the blast happened, and the monster spat the party out. However, I'm curious whether there is any RAW or RAI that would make this kind of action impossible.
Can the fireball spell be cast on yourself when swallowed by a creature?