Page MenuHomePhabricator

design and spec API modules for value validation and formatting
Closed, ResolvedPublic


Decide on the necessity, and if so, how exactly the API module for value validation (or properly rather value parsing) would be specified, how it interacts with the existing parsing API module, and with a potential formatting API.

Version: unspecified
Severity: normal
See Also:



Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:08 AM
bzimport set Reference to bz51111.
bzimport added a subscriber: Unknown Object (MLST).

Some thoughts:

  • as a context, we can either provide a data type ID, or, for convenience, a property ID.
  • we need validation, parsing, and formatting. since we often need combinations of these, they could be combined in a module, so these operations can be performed in a single call. Perhaps like this:
  • input is either given as JSON, or as a string. In the latter case, it is parsed to get the JSON structure.
  • a DataValue is constructed from the JSON structure, based on info from the data type.
  • validation is always performed on the DataValue
  • the result is the DataValue serialized as JSON (could be omitted if that was the input)
  • in addition, a formatted version of the DataValue can be requested as output.
  • Note that formatting can depend on a lot of factors: data type, desired output format (html?), current language and variant, user settings (e.g. babel, perhaps even preferred unit system), etc.

Gerard.meijssen wrote:

Being able to easily the #Babel information with an API allows "Reasonator" to apply language fall back.