-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
Since we are permissive on object creation, serialization to JSON-LD should work even if the object gives validation failures.
However, under some circumstances, to_jsonld() produces a data structure that cannot be saved as a JSON string.
Example:
dataset = omcore.Dataset(digital_identifier=[omcore.DOI(identifier="abc"), omcore.DOI(identifier="def")])
# this is valid JSON-LD, but violates the openMINDS schema, which only accepts a single digital identifier
failures = dataset.validate(ignore=["required"])
assert len(failures) == 1
assert failures["multiplicity"] == ['digital_identifier does not accept multiple values, but contains 2']
data = dataset.to_jsonld()
json.dumps(data)
Everything works until the last line, which gives TypeError: Object of type DOI is not JSON serializable.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working