OpenDataServices / standards-lab

Open Standards Lab. A web tool for users and creators of Open Standards.
https://standards-lab.readthedocs.io/
GNU Affero General Public License v3.0
2 stars 0 forks source link

processor.cove: Extend jsonschema validation with our own functions #53

Closed Bjwebb closed 3 years ago

Bjwebb commented 3 years ago

https://github.com/OpenDataServices/standards-lab/issues/26

Example: Schema: Screenshot from 2021-02-25 15-28-45

API process endpoint: Screenshot from 2021-02-25 15-29-12

robredpath commented 3 years ago

That is very cool.

I'm conscious that it's passing an English-language string, though. Is the intention that the string gets caught and identified? (is that what we do for other places where we override validation messages?).

Bjwebb commented 3 years ago

Yes, it's passing an English-language string. The name of the validator ("startswith") is attached to the ValidationError by the jsonschema library. So, when there's only 1 message per validator function, it's possible to know which it is. However, me and @odscjames have discussed previously that even in this case, it's better to pass an explicit error_id ([example]), so I will add this.

Currently there's some code for overwriting these messages in lib-cove-web, but its not currently easy to change. I discussed with @robredpath that eventually we want an admin to be able to put a message overwrite file in the right place, with which they can change any of the messages.