opral / inlang-message-sdk

0 stars 0 forks source link

IDs to reference Messages and Variants #92

Open jldec opened 3 weeks ago

jldec commented 3 weeks ago

Context

Lint reports need to reference Messages (in a MessageBundle) and Variants (in a Message).
This means that we need unique identifiers for Messages and Variants in our apis.

Do the ids need to be persisted?

See INLMC-85

Proposal

cc: @samuel.stroschein @martin.lysk1

jldec commented 3 weeks ago

added to persistence project and bumped in priority

samuelstroschein commented 3 weeks ago

i agree that everything needs ids: message bundles (human ids), messages, variants

only unique within a project.

what algorithm to you propose? uuid might be longer but uniqueness in a distributed system should be OK. Plus, good libraries exist.

jldec commented 3 weeks ago

good point - id's not only have to be unique within one instance of the project, but across all project instances that create new ids and then commit them.

one option would be random 8 or 10 character base-36 strings - 36**8 gives you >10**12

samuelstroschein commented 3 weeks ago

is the effort of a custom id solution worth it though? uuid seems straightforward. the cost of marginally more space complexity seems OK. We can introduce a more optimized ID algorithm later if the requirement comes up