Soluto / tweek

Tweek - an open source feature manager
https://tweek.soluto.io
MIT License
349 stars 50 forks source link

Define tweek resource identifiers format #751

Open michaelkruglos opened 6 years ago

michaelkruglos commented 6 years ago

We'd like to define resource identifiers format for Tweek resources, such that they can be easily addressed.

One of the suggestions for context properties is context_type.context_id:propname, and for calculation of values context_type.context_id:path/to/key.

We could try to think about it in terms of URN https://en.wikipedia.org/wiki/Uniform_Resource_Name

michaelkruglos commented 6 years ago

Tweek resource format (work in progress)

Rationale

We'd like to be able to represent tweek resources in a form similar to URI or URN. Useful application of this format could be permalinks, granting permissions to resources etc.

Format deffinition

RESOURCE = CONTEXT_DEFFINITIONS ":" PROP_OR_KEY_DEFFINITION
CONTEXT_DEFFINITIONS = CONTEXT_DEFFINITION | CONTEXT_DEFFINITIONS "+" CONTEXT_DEFFINITION
CONTEXT_DEFFINITION = CONTEXT_TYPE "=" CONTEXT_ID
PROP_OR_KEY_DEFFINITION = PROP_NAME |  "/" KEY_PATH
PROP_NAME = [a-zA-Z]
KEY_PATH = [a-z0-9_/]
CONTEXT_TYPE = [a-z]
CONTEXT_ID = [a-zA-Z0-9%]

Exmaples

Values resource with 'device' context

An example where values are requested for key named /path/to/key and device context identified as a2df519d-4515-4732-b995-17172aaad7c1

device=a2df519d-4515-4732-b995-17172aaad7c1:/path/to/key

Values resource with 'user' context

An example where values are requested for key named /user/specific/key and user identified as user@example.com

user=user@example.com:/user/specific/key

Specific context key

An example where specific context key is device.OsType

device=a2df519d-4515-4732-b995-17172aaad7c1:device.OsType

Yshayy commented 6 years ago

@asafkotzer feel free to add your remarks :)

michaelkruglos commented 6 years ago

Adding content of this document to the repo