jargon-sh / issues

The jargon.sh issue tracker
1 stars 0 forks source link

[JSON-LD Context]: change default container type from list to set #5

Open kshychko opened 1 month ago

kshychko commented 1 month ago

When a property is defined as an array, in the generated JSON-LD context file it should have @container set to @set instead of @list. Ideally there should be a way to identify the type of @container. An example:

{
    "@context": {
        "dpp": "https://test.uncefact.org/vocabulary/untp/dpp/",
        "xsd": "http://www.w3.org/2001/XMLSchema#",
        "id": "@id",
        "type": "@type",
        "@version": 1.1,
        "ProductPassport": {
            "@id": "dpp:ProductPassport",
            "@type": "@id",
            "@context": {
                "issuedBy": {
                    "@id": "dpp:issuedBy",
                    "@type": "@id",
                    "@context": {
                        "identifier": {
                            "@id": "dpp:identifier",
                            "@type": "@id",
                            "@context": {
                                "scheme": {
                                    "@id": "dpp:scheme",
                                    "@type": "xsd:string"
                                },
                                "identiferValue": {
                                    "@id": "dpp:identiferValue",
                                    "@type": "xsd:string"
                                },
                                "identifierURI": {
                                    "@id": "dpp:identifierURI",
                                    "@type": "xsd:string"
                                }
                            },
                            "@container": "@set"
                        },
                        "name": {
                            "@id": "dpp:name",
                            "@type": "xsd:string"
                        }
                    }
                }
            }
        }
    }
}
kshychko commented 1 month ago

Ref https://github.com/uncefact/spec-untp/issues/8#issuecomment-2079335528

Fak3 commented 1 month ago

Instead of explicitly setting container to @set, it is better to omit it altogether for readability. Set is the default container, no need to be verbose here.