Packages

p

io.github.olib963

avrocheck

package avrocheck

Linear Supertypes
AvroCheck, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. avrocheck
  2. AvroCheck
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. trait AvroCheck extends AnyRef
  2. 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
  3. sealed trait Overrides extends AnyRef

Value Members

  1. 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
  2. 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
  3. 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
  4. 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 for String 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
  5. 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
  6. 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
  7. 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
  8. def overrideFields(overrides: (String, Overrides)): Overrides

    See the overloaded AvroCheck.overrideFields function

    See the overloaded AvroCheck.overrideFields function

    Definition Classes
    AvroCheck
  9. 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
  10. 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
  11. object Configuration extends Serializable
  12. object Implicits

Inherited from AvroCheck

Inherited from AnyRef

Inherited from Any

Ungrouped