snowplow-incubator / scalacheck-schema

ScalaCheck generators for various Iglu-compatible schema formats

Version Matrix

ScalaCheck Schema

ScalaCheck generators for various Iglu-compatible schema formats.


The latest version of ScalaCheck Schema is 0.1.0, which is cross-built against Scala 2.11.x and 2.12.x.

If you're using SBT, add the following lines to your build file:

libraryDependencies += "com.snowplowanalytics" %% "scalacheck-schema" % "0.1.0"


import com.snowplowanalytics.iglu.client.Resolver
import com.snowplowanalytics.iglu.schemaddl.scalacheck.{ IgluSchemas, JsonSchemaGen }

val resolver: Option[Resolver] = ???    // Can be some custom resolver or none for Iglu Central

val for {
  // Get schema from Iglu Central
  schemaJson <- IgluSchemas.lookup(None)("iglu:com.snowplowanalytics.snowplow/geolocation_context/jsonschema/1-1-0")
  // Parse as JSON Schema AST
  schemaObject <- IgluSchemas.parseSchema(schemaJson)
  // Create JSON generateor
  gen =
  // Generate JSON instance compatible with specified schema
  json = gen.sample
} yield json

Copyright and License

Snowplow scalacheck-schema-ddl is copyright 2018 Snowplow Analytics Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.