Using the command /give @s minecraft:diamond[minecraft:weapon={"item_damage_per_attack":1},minecraft:max_damage=10,minecraft:max_stack_size=1,minecraft:damage=1] can create an item that consumes durability when attacking. However, using the command /give @s minecraft:diamond[minecraft:weapon={"item_damage_per_attack":1},minecraft:max_damage=10,minecraft:max_stack_size=1] creates an item that never consumes durability, which is an error.I hope that all items with the minecraft:max_damage component can have their durability consumed.
MC-269654, WAI