Using /give @p minecraft:diamond_sword{display:{Name:"Rainbow"}} does not give the sword the specified name. This applies to all names and items.
Linked issues
duplicates 1
Comments 2
They changed how the Name tag is used in 1.13 a bit. Now you need to use it like
/give @p diamond_sword{display:{Name:"\"Rainbow\""}}
(With the \"\" inside the regular quotes.) This also lets you do colored names and stuff like
/give @p diamond_sword{display:{Name:"{\"text\":\"Rainbow\",\"color\":\"blue\"}"}}
Invalid: The display tag's syntax has been changed to
JSON formatTextComponent, which means you can now apply colors, and other text effects to item names.Correct command: