Macaulay2 » Documentation
Packages » MRDI » validateMRDI
next | previous | forward | backward | up | index | toc

validateMRDI -- validate an MRDI JSON object against the format specification

Description

Validates that a JSON string or hash table conforms to the MRDI file format specification. This checks structural requirements such as:

  • the presence of a _type key
  • that _type is a string or an object with string-valued name
  • that _ns and _refs are objects (if present)
  • that all keys of _refs are valid UUIDs
  • that referenced objects are themselves valid MRDI

The function produces an error if validation fails and returns null on success.

i1 : s = saveMRDI 5

o1 = {"_ns": {"Macaulay2": ["https://macaulay2.com", "1.26.05"]}, "_type":
     "ZZ", "data": "5"}
i2 : validateMRDI s

Ways to use validateMRDI:

  • validateMRDI(HashTable)
  • validateMRDI(String)
  • validateMRDI(Thing)

For the programmer

The object validateMRDI is a method function.


The source of this document is in /build/reproducible-path/macaulay2-1.26.05+ds/M2/Macaulay2/packages/MRDI.m2:860:0.