Closed johnhungerford closed 2 years ago
Rather than iterate over the types as a flat list (or in addition?), let's make types a selectable feature and just use the same selection mechanism as indices and field names. We'll define a functions to generate the appropriate type selectors:
val newSch1. = sch(tpe[Inner] / "field_name" / tpeN[Nested](1))
tpe
will allow you to select the first component of that type, and tpeN
will allow you to select the Nth component of that type.
In addition, let's replace the retrieveType
method from above with extractSchema
and extractSchemas,
where extractSchema
returns the first schema of a given type encountered in traversing the schema components, and extractSchemas
returns a tuple of all schemas of a given type within the schema.
closed with #78
Retrieve a field or subtype from a schema or a schema component by type
The above syntax should retrieve the first, when traversing the schema. To retrieve subsequent types:
You should be able to modify a component by type as well:
As a bonus, include type level selection:
where
*:* N
says get Nth component of that type