suggestion: fields alias
I propose a new syntax for the fields
attribute, It allows to use an alias for the fields via the operator as
.
Example:
<sib-display
data-src='https://api.test-paris.happy-dev.fr/projects/'
fields="creationDate as date, customer.logo as image, @id as id, (name, description as details) as info"
></sib-display>
As you can see in this example we can:
-
creationDate as date
: alias a simple field -
customer.logo as image
: we can alias a dotted path, this avoid long attribute likewidget-customer.logo
-
@id as id
: alias field with unauthorized char in attribute name, this fix #242 (closed) -
(name, description as details) as info
: and name a set. (improve #142 (closed))
I also propose an alternative syntax that uses the operator :
(or =
?), the alias is then placed before the field:
<sib-display
data-src='https://api.test-paris.happy-dev.fr/projects/'
fields="date: creationDate, image: customer.logo, id: @id, info: (name, details: description)"
></sib-display>