vcmi / vcmi-mods-repository

Mods repository for VCMI
https://vcmi.eu/
10 stars 10 forks source link

Github Action for JSON validation #15

Closed Laserlicht closed 9 months ago

Laserlicht commented 1 year ago

We should introduce a GitHub-Workflow that check the JSON files in this repo if they are valid when changing files.

See problem here: https://github.com/vcmi/vcmi-mods-repository/pull/14

@IvanSavenko @kambala-decapitator Do any of you know how to do this?

IvanSavenko commented 1 year ago

No idea myself, not exactly familiar with workflows. Perhaps @rilian-la-te has any ideas?

BTW - we might also want to do the same for referenced mod.json's on daily basis - I've seen some error messages in Launcher because of format issues in mod.json which gets downloaded on repository checkout.

kambala-decapitator commented 1 year ago

e.g. simply feed JSONs to python / ruby parser and check for error

kambala-decapitator commented 1 year ago

but if the plan is to check JSONs that have comments / allow commas after last element, custom parser would be needed

IvanSavenko commented 1 year ago

to check JSONs that have comments

Perhaps we can strip them with sed or some other similar tool before feeding to validator?

allow commas after last element

We don't exactly allow that - yes, our parser can read such json's, but it will still issue a warning

kambala-decapitator commented 1 year ago

Perhaps we can strip them with sed or some other similar tool before feeding to validator?

yes, that would work

rilian-la-te commented 1 year ago

@kambala-decapitator we can use this python utility for stripping comments: https://pypi.org/project/JSON_minify/

It do it automatically.

kambala-decapitator commented 1 year ago

@rilian-la-te even better :)

nullkiller commented 1 year ago

Btw Android suffers from comments and commas) So this issue is quite important there

gethushan commented 1 year ago

Can i join with you guys ...? We can able to create JSON action validator in GitHub workflow easily like my basic repository If you want please tell me the file that you are going to validate the json file ......

Is that your github.json file .....?