json-ld-api icon indicating copy to clipboard operation
json-ld-api copied to clipboard

Add JSON literal tests.

Open davidlehn opened this issue 2 years ago • 2 comments

  • Various tests of when @type of @json is used, the JSON may be an array, and the interaction with a @container of @set and @list.
  • Change compaction output for @json and @set with a JSON array.
  • Add test for many other possibilities and processing algorithms.
  • Propose new multiple JSON literals error code when trying to add multiple JSON literals as values for a property not declared a @set.

NOTE: This is a work-in-progress that needs feedback. HTML rebuild has not yet been done.

Please put major discussion in the issue that links here as this PR may need to be replaced.

davidlehn avatar Mar 01 '23 07:03 davidlehn

Some of these assume changes to the algorithms that will need their own PRs:

  • Tests expand/er57 and er58 along with toRdf/er57 and er58 need a check to be sure that the value is an array, or generate the invalid set or list object error. The presumed semantics are that each array value becomes its own JSON value.
  • Test compact/ej01 is expected to raise multiple JSON literals because the term didn't use @set. This is arguably a breaking change as any data that did this before would now fail (of course two JSON values on input would now be one JSON value on output). This will certainly require checks in the compaction algorithm.
  • Test compact/js07 (and others) also change the behavior to preserve the array value.

gkellogg avatar Jul 29 '24 23:07 gkellogg

Addresses #560.

gkellogg avatar Jul 31 '24 18:07 gkellogg