Page MenuHomePhabricator

validateRegistrationFile.php: Check for duplicate key in json
Closed, ResolvedPublic

Description

Some extension.json (or skin.json) have duplicate keys inside, which makes it hard to read with external json readers and may is an error in the file, because it is not save, which key "wins"

There should be a validation check to avoid duplicate keys in registration files.

examples:
https://gerrit.wikimedia.org/r/#/c/327869/
https://gerrit.wikimedia.org/r/#/c/327870/
https://gerrit.wikimedia.org/r/#/c/327871/
https://gerrit.wikimedia.org/r/#/c/327874/
https://gerrit.wikimedia.org/r/#/c/327875/
https://gerrit.wikimedia.org/r/#/c/327876/

Event Timeline

It would be nice, if it is not entry point related, because there are also i18n json files with duplicate keys

Or decline as the mention task (or set duplicate), if this is not taken as a problem - In my opinion this can indicate errors inside the files and should be detected

Example output:

florian@florian-VirtualBox:/var/www/html/mediawiki/w$ phph maintenance/validateRegistrationFile.php extensions/GoogleLogin/extension.json (without duplicate key)
extensions/GoogleLogin/extension.json validates against the schema!
florian@florian-VirtualBox:/var/www/html/mediawiki/w$ phph maintenance/validateRegistrationFile.php extensions/GoogleLogin/extension.json (with duplicate key)
Parse error on line 155:
...er_autoloader": true,	"manifest_version
----------------------^
Duplicate key: load_composer_autoloader

Change 333502 had a related patch set uploaded (by Florianschmidtwelzow):
Add key conflict check to extension.json validation

https://gerrit.wikimedia.org/r/333502

Change 333502 merged by jenkins-bot:
[mediawiki/core@master] registration: Validate no duplicate keys exist in extension.json

https://gerrit.wikimedia.org/r/333502

Change 446573 had a related patch set uploaded (by Florianschmidtwelzow; owner: Florianschmidtwelzow):
[mediawiki/core@REL1_30] registration: Validate no duplicate keys exist in extension.json

https://gerrit.wikimedia.org/r/446573

Change 446574 had a related patch set uploaded (by Florianschmidtwelzow; owner: Florianschmidtwelzow):
[mediawiki/core@REL1_29] registration: Validate no duplicate keys exist in extension.json

https://gerrit.wikimedia.org/r/446574

Change 446573 merged by jenkins-bot:
[mediawiki/core@REL1_30] registration: Validate no duplicate keys exist in extension.json

https://gerrit.wikimedia.org/r/446573

Change 446574 merged by jenkins-bot:
[mediawiki/core@REL1_29] registration: Validate no duplicate keys exist in extension.json

https://gerrit.wikimedia.org/r/446574