fluree / core

Fluree releases and public bug reports
0 stars 0 forks source link

`sh:datatype` not catching invalid txns (when using `insert` syntax on `server`) #43

Closed aaj3f closed 8 months ago

aaj3f commented 8 months ago

Description

An example of using sh:datatype which previously worked to demonstrate Fluree catching invalid datatype transactions, is now allowing those transactions with no error message.

The following conn default context was provided when creating a ledger

{
  "ex": "http://example.org/",
  "f": "https://ns.flur.ee/ledger#",
  "foaf": "http://xmlns.com/foaf/0.1/",
  "owl": "http://www.w3.org/2002/07/owl#",
  "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
  "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
  "schema": "http://schema.org/",
  "sh": "http://www.w3.org/ns/shacl#",
  "skos": "http://www.w3.org/2008/05/skos#",
  "wiki": "https://www.wikidata.org/wiki/",
  "xsd": "http://www.w3.org/2001/XMLSchema#"
}

Create txn:

{
    "@context": "https://ns.flur.ee/",
    "ledger": "cookbook/data-type",
    "insert": {
        "@id": "ex:UserShape",
        "@type": ["sh:NodeShape"],
        "sh:targetClass": {"@id": "ex:User"},
        "sh:property": [
            {
                "sh:path": {"@id": "schema:name"},
                "sh:datatype": {"@id": "xsd:string"}
            }
        ]
    }
}

What should be an invalid txn, but is being accepted:

{
    "@context": "https://ns.flur.ee/",
    "ledger": "cookbook/data-type",
    "insert": {
        "@id": "ex:dolly",
        "@type": "ex:User",
        "schema:name": [9, 5]
    }
}