belgif / rest-guide

REST Guidelines of Belgian government institutions
https://www.belgif.be/specification/rest/api-guide/
Apache License 2.0
24 stars 4 forks source link

Use additionalProperties instead of separate key-value properties #124

Open pvdbosch opened 1 year ago

pvdbosch commented 1 year ago

From Smals guideline:

key value

Can we adopt it? Similar: http://opensource.zalando.com/restful-api-guidelines/#216

Current guideline: https://www.belgif.be/specification/rest/api-guide/#rule-addi-prop

additionalProperties SHOULD be used exclusively to describe an object representing a map of key-value pairs. The keys of such maps don’t need to respect the naming rules for JSON properties (lowerCamelCase and English).

This describes when additionalProperties may be used; but doesn't explicitly recommend its use instead of separate key/value properties for the above use case.

Possible complications:

pvdbosch commented 1 year ago

Examples:

"alternateIds": [
{
"sourceConfidenceLevel": 90,
"type": "belgianEnterpriseNumber",
"value": 244640631,
"status": "validated"
}
],
"criteria": [
{
  "name": "hasReferenceAddress",
   "dataSource": "cbss",
   "value": true
},
{
  "name": "hasReferenceAddress",
   "dataSource": "requester",
   "value": false
}]