opengeospatial / ogcapi-records

An open standard for the discovery of geospatial resources on the Web.
https://ogcapi.ogc.org/records
Other
58 stars 27 forks source link

Use roles instead of key for "type" of phone number / email / ... #243

Closed m-mohr closed 1 year ago

m-mohr commented 1 year ago

_Originally posted by @m-mohr in https://github.com/opengeospatial/ogcapi-records/pull/230#discussion_r1176582181_

I don't think it's a good idea to encode the "role" of a phone number / email / ... type in the key. For example, you can't translate this.

If you use an array with a role (or so) you can change the values depending on the language, but if you change the key, you may break implementations as they may directly access entries through the key.

For example, if you have a multi-language catalog, in english you have: "phone": { "office": "+49123456789" }, In German it gets ugly: "phone": { "Büro": "+49123456789" },

So as long as they keys are not pre-defined and users can put whatever they like, I think this should not be in the keys.

Better could be something like: "phone": [{ "value": "+49123456789", "roles": ["Büro"] }], It would also allow assigning multiple roles per "value" (e.g. a phone number that is for home and work).

pvretano commented 1 year ago

@m-mohr @tomkralidis I think I actually prefer @m-mohr's suggestion than what we currently have. If there are no objections, I'll create a PR to change the change generally ... since I think there are a couple of other places in the contacts structure were we use a dictionary (i.e. keys to denote role).

tomkralidis commented 1 year ago

+1 given a similar pattern in vCard.

m-mohr commented 1 year ago

roles should be optional, right?

tomkralidis commented 1 year ago

Yes.