IPS-LMU / EMU-webApp

The EMU-webApp is an online and offline web application for labeling, visualizing and correcting speech and derived speech data.
http://ips-lmu.github.io/EMU-webApp/
MIT License
51 stars 14 forks source link

Validation of DBconfig doesn't seem to take place #315

Closed MJochim closed 2 years ago

MJochim commented 2 years ago

Follow-up to #296.

In commits 786ef8ce2dc1fe18b4c6d84cd05bd2a47b3750dd~2 through 786ef8ce2dc1fe18b4c6d84cd05bd2a47b3750dd (recently) and 74af4246d (years ago), additions were made to the DBconfig.json regarding the EMU-webApp config and y-axis limits. However, they were never added to the JSON schema.

I expected the web app to throw a validation error when loading a database with such a config, but it doesn't. Maybe it only validates _annot.json files, but not _DBconfig.json? Is that intentional? Is that a problem?

It may have to do with the fact that this reference is wrong:

https://github.com/IPS-LMU/EMU-webApp/blob/786ef8ce2dc1fe18b4c6d84cd05bd2a47b3750dd/src/schemaFiles/DBconfigFileSchema.json#L183

The URL yields a 404 error, because it contains /app/ instead of /src/.

MJochim commented 2 years ago

@samgregory noted in #296 that the emuwebappConfigScheme allows for additionalProperties in the signalCanvases object:

https://github.com/IPS-LMU/EMU-webApp/blob/4e6bcf284c0f0879af42fb97888b542b91bc2ea4/src/schemaFiles/emuwebappConfigSchema.json#L317

Which is true, although I suppose we had better change that. We hardly ever set additionalProperties: true in any of our schemas and I don’t see a reason why we should have an exception here.

Anyway, one problem exists apart from that: I have found out now that the DBconfig is passed through the validator (tv4), but the EMUwebAppConfig part of it is ignored. Also, changing /app/ to /src/ in the $ref URL, as I mentioned in my previous comment, does not fix the issue. While the validator function tv4.validate() can handle the quoted $ref, it does not download the URL by itself. We have to do that actively, and I have yet to figure out how.