package avrocheck
- Alphabetic
- By Inheritance
- avrocheck
- AvroCheck
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- trait AvroCheck extends AnyRef
- case class Configuration(longGen: Gen[Long], intGen: Gen[Int], stringGen: Gen[String], booleanGen: Gen[Boolean], doubleGen: Gen[Double], floatGen: Gen[Float], byteGen: Gen[Byte], uuidGen: Gen[UUID], localDateGen: Gen[LocalDate], localTimeGen: Gen[LocalTime], instantGen: Gen[Instant], bigDecimalGen: Gen[BigDecimal], preserialiseLogicalTypes: Boolean) extends Product with Serializable
- sealed trait Overrides extends AnyRef
Value Members
- def arrayGenerationOverride(sizeGenerator: Gen[Int] = Gen.posNum[Int], elementOverrides: Overrides = NoOverrides): Overrides
Customise the generation of an array value for a schema of type "array".
Customise the generation of an array value for a schema of type "array".
- sizeGenerator
generates the size of the array. This must be positive (currently not enforced so will cause errors)
- elementOverrides
overrides to use for each element in the generated array.
- Definition Classes
- AvroCheck
- def arrayOverride(elements: Seq[Overrides]): Overrides
Overrides array generation to create an array that: - Has the exact size of elements - Uses the overrides in elements in order to generate each element of the array.
Overrides array generation to create an array that: - Has the exact size of elements - Uses the overrides in elements in order to generate each element of the array.
- Definition Classes
- AvroCheck
- def constantOverride[A](value: A): Overrides
Ensure the same value is returned for every generation e.g.
Ensure the same value is returned for every generation e.g. for a schema of type "int" you could pass constantOverride(10). The type of the value passed must mach the type generated for the schema.
- Definition Classes
- AvroCheck
- def genFromSchema(schema: Schema, configuration: Configuration = Configuration.Default, overrides: Overrides = NoOverrides): Gen[GenericRecord]
- schema
The avro schema to use to generate random values.
- configuration
Allows configuration of default generation parameters e.g. the default
Gen
forString
values.- overrides
Overrides can be used to customise the generation of arbitrarily nested values without affecting the generation of other values for example see
AvroCheck.overrideFields
- returns
A generator that will create a
GenericRecord
from the schema as long as the schema is a RECORD or UNION of RECORDs.
- Definition Classes
- AvroCheck
- def generatorOverride[A](gen: Gen[A])(implicit arg0: ClassTag[A]): Overrides
Customise the generator used to create a value for the schema.
Customise the generator used to create a value for the schema. The type of the generator must match the type of the schema, for example for a schema of type "string" you might pass generatorOverride(Gen.alphaNumStr).
- Definition Classes
- AvroCheck
- val noOverrides: Overrides
The default override type - doesn't override any value generation and uses the defaults for the schema.
The default override type - doesn't override any value generation and uses the defaults for the schema.
- Definition Classes
- AvroCheck
- def overrideFields(overrides: (String, Overrides), secondOverride: (String, Overrides), moreOverrides: (String, Overrides)*): Overrides
For a schema of type "record" you can set an override for any field, any other fields will use default generation.
For a schema of type "record" you can set an override for any field, any other fields will use default generation. For example if your schema is:
{ "namespace": "example.avro", "type": "record", "name": "User", "fields": [ { "name": "name", "type": "string" }, { "name": "age", "type": "int" }, { "name": "favourite_number", "type": [ "int", "null" ] }, { "name": "favourite_colour", "type": [ "string", "null" ], "default": "null" } ] }
you would be able to pass.
overrideFields("name" -> constantOverride("foo"), "age" -> generatorOverride(Gen.posNum[Int]))
- Definition Classes
- AvroCheck
- def overrideFields(overrides: (String, Overrides)): Overrides
See the overloaded
AvroCheck.overrideFields
functionSee the overloaded
AvroCheck.overrideFields
function- Definition Classes
- AvroCheck
- def schemaFromResource(schemaResource: String): Schema
Utility function to parse a schema from a resource file.
Utility function to parse a schema from a resource file.
- Definition Classes
- AvroCheck
- def selectNamedUnion(branchName: String, overrides: Overrides = NoOverrides): Overrides
Allows to select which schema in a union of schemas to generate values for.
Allows to select which schema in a union of schemas to generate values for.
- branchName
The name of the schema in the union to select, if the schema is a record then the name (with no namespace) of the record, if a primitive then the name of the primitive (e.g. "string")
- overrides
The override values to use for the schema branch selected.
- Definition Classes
- AvroCheck
- object Configuration extends Serializable
- object Implicits