SpyglassMC / Spyglass

Development tools for vanilla Minecraft: Java Edition data pack developers.
https://spyglassmc.com
MIT License
291 stars 30 forks source link

Warn when using both unnamespaced and namespaced key in a map #1409

Open misode opened 1 month ago

misode commented 1 month ago

In the following item modifier, a warning should be reported because attribute_modifiers and minecraft:attribute_modifiers are essentially duplicate keys.

{
  "function": "minecraft:set_components",
  "components": {
    "attribute_modifiers": [],
    "minecraft:attribute_modifiers": []
  }
}
MulverineX commented 1 month ago

Shouldn't this error, not warn?

misode commented 1 month ago

Duplicate keys show a warning in other places

MulverineX commented 1 month ago

That probably shouldn't be the case

misode commented 1 month ago

It is the case with the default json vscode language features, why should we change that?

MulverineX commented 1 month ago

Because it's incredibly silly, and there's probably some JSON deserializers that don't even support it

NeunEinser commented 1 month ago

Hmm, I am also reporting duplicate keys as errors. How does minecraft react to it? I would have assumed it doesn't want to parse it.

misode commented 1 month ago

It depends on the exact case.

But there's no need for us to match the game exactly. We can decide ourselves whether something should be a warning or error.