From a purely gameplay design standpoint, "ammo" for a gun and "durability" for a melee weapon are the exact same thing. That mechanic is there to limit how much the player uses their weapons, often done to push the player into trying everything in their arsenal and not just rely on one thing they're comfortable with.
But while "ammo" is perfectly accepted as a mechanic, if gamers see "durability" they freak out and complain.
To me, the difference between the two mechanics is the ability to Recharge a pet weapon.
With ammo, if I find 5 ammo in a trashcan, I can suddenly use my favorite gun 5 more times, unless I'm already capped on ammo. And, if I'm out of ammo, all I have to do is find any amount of ammo to be able to use the gun again.
Whereas, most weapon durability systems (in my experience) make that durability loss permanent - I can't find +3 swings to my magic sword in the trash, and if my sword breaks, more often than not, I have to Go Out and Find or Buy Another - which if it's Rare/Powerful, then durability represents a Finite Number of uses EVER. Imagine a character throwing away a gun just because it ran out of ammo.
To me, a better comparison for ammo would be Monster Hunter's sharpness system - finding ammo and sharpening a weapon are downtime activities that the player engages with to keep up on their damage output during a longer scenario that, if not kept up with, can put the player in a really rough spot.
