Last modified: 2014-09-25 11:35:46 UTC
Property value parsing and validation should to be implemented in the backend, and should be removed from JavaScript. Here's a few reasons: * the web API has to validate input; validation needs parsing. ** we could restrict the API to a very simple format. This forces bot authors to re-implement the parsing functionality in order to created the form we'd required for the API from their input (notably, from Wikipedia) * the backend needs to be able to render/format all values, for (non-JS) display, RDF output, etc. Output formats should be parseable, providing round-trip functionality. This is much easier if rendering and parsing is implemented in the same place. * parsing and formatting should only be implemented once, if at all possible. In the backend, I suggest to allow any number of parsers for each data format. Try each parser, until one accepts the input.
The arguments above also apply to formatting: we need formatting in the backend, including support for localization (and even personalization, in the case of date/time format). As for parsing, it may be ok to only support the parsing of canonical formats in the backend, and let the frontend deal with handling the quirks of human input.
Rough proposal: * create wbsnakvalueparser for parsing snak values based on property ID and/or data type ID. This should have an option to apply validation, too. * create wbsnakvalueformatter for parsing snak values based on property ID and/or data type ID. This needs to support different kinds of desired output, too (plain text, html, etc). Note that the modules parsevalue and formatvalue provides by DataValuesCommon are not sufficient, since they can not handle DataType specific formatting or constraints, nor do they support different output formats like html.
* Geo is using backend parsing; * Quantity is using backend parsing; * Time is still parsed in the frontend;
Sorry, accidentally closed this one..
Current status is that formatters are done, parsers are wip and validation is not even started.