Allow designation of root TURF types for serialization.

Description

Currently the TURF serializer places things in the root as necessary in an arbitrary order. Let's say that we have both Foo and Bar objects, and Foo can have a foobar property with a Bar value. The TURF serializer currently might generate something like this:

While this is semantically correct, it isn't the most helpful for humans to understand, especially with a large number of objects.

The TURF parse needs an option such as setRootTypes() taking a list of things like "Foo", "Bar" handles/tags. The update to the generation logic shouldn't be too difficult:

  1. For each of the indicated root types, iterate through the objects and serialize them.

  2. If during serialization of a root graph a new object is encountered, if it is one of the requested root types, merely serialize a tag reference to it.

  3. Once this has been done for each of the requested root types, in order, then serialize the remaining unserialized objects normally.

Environment

None

Assignee

Garret Wilson

Reporter

Garret Wilson

Labels

None

Components

Priority

Major