validation-delimited


License

License

GroupId

GroupId

io.github.jto
ArtifactId

ArtifactId

validation-delimited_sjs0.6_2.11
Last Version

Last Version

2.1.3
Release Date

Release Date

Type

Type

jar
Description

Description

validation-delimited
validation-delimited
Project URL

Project URL

https://github.com/jto/validation
Project Organization

Project Organization

io.github.jto
Source Code Management

Source Code Management

https://github.com/jto/validation

Download validation-delimited_sjs0.6_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.jto/validation-delimited_sjs0.6_2.11/ -->
<dependency>
    <groupId>io.github.jto</groupId>
    <artifactId>validation-delimited_sjs0.6_2.11</artifactId>
    <version>2.1.3</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.jto/validation-delimited_sjs0.6_2.11/
implementation 'io.github.jto:validation-delimited_sjs0.6_2.11:2.1.3'
// https://jarcasting.com/artifacts/io.github.jto/validation-delimited_sjs0.6_2.11/
implementation ("io.github.jto:validation-delimited_sjs0.6_2.11:2.1.3")
'io.github.jto:validation-delimited_sjs0.6_2.11:jar:2.1.3'
<dependency org="io.github.jto" name="validation-delimited_sjs0.6_2.11" rev="2.1.3">
  <artifact name="validation-delimited_sjs0.6_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.jto', module='validation-delimited_sjs0.6_2.11', version='2.1.3')
)
libraryDependencies += "io.github.jto" % "validation-delimited_sjs0.6_2.11" % "2.1.3"
[io.github.jto/validation-delimited_sjs0.6_2.11 "2.1.3"]

Dependencies

compile (6)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.12
io.github.jto : validation-core_sjs0.6_2.11 jar 2.1.3
org.scala-js : scalajs-library_2.11 jar 0.6.25
org.typelevel : cats-core_sjs0.6_2.11 jar 1.4.0
joda-time : joda-time jar 2.10.1
org.joda : joda-convert jar 2.1.2

test (3)

Group / Artifact Type Version
org.scala-js : scalajs-test-interface_2.11 jar 0.6.25
org.scalacheck : scalacheck_2.11 jar 1.14.0
org.scalatest : scalatest_sjs0.6_2.11 jar 3.2.0-SNAP10

Project Modules

There are no modules declared in this project.

The unified data validation library

Travis Coverage Status Maven Scala.js Gitter

Overview

The unified validation API aims to provide a comprehensive toolkit to validate data from any format against user defined rules, and transform them to other types.

Basically, assuming you have this:

import play.api.libs.json._
import jto.validation._

case class Person(name: String, age: Int, lovesChocolate: Boolean)

val json = Json.parse("""{
  "name": "Julien",
  "age": 28,
  "lovesChocolate": true
}""")

implicit val personRule = {
  import jto.validation.playjson.Rules._
  Rule.gen[JsValue, Person]
}

It can do this:

scala> personRule.validate(json)
res0: jto.validation.VA[Person] = Valid(Person(Julien,28,true))

BUT IT'S NOT LIMITED TO JSON

It's also a unification of play's Form Validation API, and its Json validation API.

Being based on the same concepts as play's Json validation API, it should feel very similar to any developer already working with it. The unified validation API is, rather than a totally new design, a simple generalization of those concepts.

Design

The unified validation API is designed around a core defined in package jto.validation, and "extensions". Each extension provides primitives to validate and serialize data from / to a particular format (Json, form encoded request body, etc.). See the extensions documentation for more information.

To learn more about data validation, please consult Validation and transformation with Rule, for data serialization read Serialization with Write. If you just want to figure all this out by yourself, please see the Cookbook.

Using the validation api in your project

Add the following dependencies your build.sbt as needed:

resolvers += Resolver.sonatypeRepo("releases")

val validationVersion = "2.1.0"

libraryDependencies ++= Seq(
  "io.github.jto" %% "validation-core"      % validationVersion,
  "io.github.jto" %% "validation-playjson"  % validationVersion,
  "io.github.jto" %% "validation-jsonast"   % validationVersion,
  "io.github.jto" %% "validation-form"      % validationVersion,
  "io.github.jto" %% "validation-delimited" % validationVersion,
  "io.github.jto" %% "validation-xml"       % validationVersion
  // "io.github.jto" %%% "validation-jsjson"    % validationVersion
)

Play dependencies

Validation Play
2.1.x 2.6.x
2.0.x 2.5.x
1.1.x 2.4.x
1.0.2 2.3.x

Documentation

Documentation is here

Contributors

Versions

Version
2.1.3
2.1.1
2.1.0
2.0.1
2.0
v2-play2.3