SpyglassMC / Spyglass

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

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

Open misode opened 4 months ago

misode commented 4 months 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 4 months ago

Shouldn't this error, not warn?

misode commented 4 months ago

Duplicate keys show a warning in other places

MulverineX commented 4 months ago

That probably shouldn't be the case

misode commented 4 months ago

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

MulverineX commented 4 months ago

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

NeunEinser commented 4 months 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 4 months 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.