m-ld / m-ld-js

m-ld Javascript engine
https://js.m-ld.org
MIT License
37 stars 2 forks source link

Term definitions in context should be able to declare a list #142

Open Peeja opened 1 year ago

Peeja commented 1 year ago

Consider the following JSON-LD document:

{
  "@context": {
    "appliances": {
      "@id": "ex:appliances",
      "@container": "@list"
    }
  },
  "appliances": [
    "toaster",
    "microwave"
  ]
}

According to the JSON-LD playground, this compacts (with an empty context) to:

{
  "ex:appliances": {
    "@list": [
      "toaster",
      "microwave"
    ]
  }
}

However, m-ld doesn't notice that ex:appliances should be a @list:

[
  {
    "@id": ".well-known/genid/clfgzkmo700033b6mrbk33fxz",
    "ex:appliances": [
      "microwave",
      "toaster"
    ]
  }
]