ariatemplates / editor-backend

Server side processing for AT editors
0 stars 3 forks source link

Change the type of the actual id of a document from number to string #37

Closed ymeine closed 11 years ago

ymeine commented 11 years ago

Currently, the id of a document, or call it the handle/anchor/whatever, is an object. This way everything we think that might be useful for document identification can be put inside.

For now in practice there is only one property inside, an actual id, called GUID. For simplicity this id is generated from an incrementing counter, so it ends to be a number.

This is probably not the best solution, since we could imagine changing it in the future to a hash, formatted as an hexadecimal string for instance. In this case it would be a string.

For consistency and anticipation this should be changed to a string starting from now.

Moreover, this might lead to some issues with some clients of the backend, since with the serialization process and the diversity of the libraries used for it, the number could be parsed as a float number, giving unwanted results when converting to a string.

Indeed, the backend already converts the id to a string (implicitly) to access the document from an index.


Imagine the following scenario:

We've passed from the stringified integer "10" to a stringified float number "10.0".