commonMain.schemas.AbstractCollectionSchema.kt Maven / Gradle / Ivy
package io.kform.schemas
import io.kform.*
/**
* Abstract schema representing collections of type [T] with elements of type [TChildren] whose
* schema is of type [TSchema].
*
* @property elementsSchema Schema of the collection's elements.
*/
public abstract class AbstractCollectionSchema>(
public val elementsSchema: TSchema
) : CollectionSchema {
override fun childrenSchemas(
path: AbsolutePath,
queriedPath: AbsolutePath,
fragment: AbsolutePathFragment
): Sequence> = sequence {
yield(
SchemaInfo(
elementsSchema,
path.append(AbsolutePathFragment.Wildcard),
queriedPath.append(fragment),
)
)
}
}