GitXplorerGitXplorer
m

serialization-checker

public
2 stars
1 forks
9 issues

Commits

List of commits on branch master.
Verified
d23eb92c10deb242a8d734cde6b4c07644a1b34f

Merge pull request #17 from scala-steward/update/scalatest-3.2.2

mmonksy committed 4 years ago
Verified
bac5e39518367af1da99afe3ae38c6525690fb4c

Merge branch 'master' into update/scalatest-3.2.2

mmonksy committed 4 years ago
Verified
02722252b83e00c345cc0e3439cfd9362f29c1eb

Merge pull request #16 from scala-steward/update/scalatest-3.2.1

mmonksy committed 4 years ago
Verified
2b9cc8dbb21fad179b26df5bcebade588ca421f5

Update scalatest to 3.2.2

sscala-steward committed 4 years ago
Verified
99db4ad7707f2fda7e1bcffa494d8c00cc8d2da5

Update scalatest to 3.2.1

sscala-steward committed 4 years ago
Unverified
171e7e3f5519b386e0c37ee76433fbf054065007

Updated the version

mmonksy committed 5 years ago

README

The README file for this repository.

Serialization checker

About

This project is intended to run and verify that the examples provided (often times a folder full of JSONs) can deserialize against a particular object.

What this project does not do

This utility is intended to confirm that the object's format will match the examples provided. This is not intended to verify that the parsing parsed out all of the information correctly. It's better to test that out within your unit test on a case by case basis.

Problem statement

The root problem that led to this project's creation is that REST typically uses JSON, and that JSON is Schemaless. This makes it difficult to create data objects to interact with services. In the case of connecting to a third-party REST service, you typically have lots of examples. This project helps you, the developer, iterate through the creation of the data objects.

Dependency Information

To add this into your project use the following library dependencies and repository setups:

resolvers += Resolver.bintrayRepo("monksy","maven")

libraryDependencies += "com.mrmonksy" %% "serialization-checker" % "0.1.3"

Example

This project does not contain any particular specifics of integration. (I.e. ReactiveMongo, JSON4s, etc)

An example of an integration with Json4S can be found under the Json4SSerialization Integration test:

  val source = Sources.fromFolder("serialized_files")
  
  val actual = SerializationChecker.tryParse(source) { src =>
    implicit val formats = DefaultFormats 
    read[SimplePerson](src.content()) != null
  }

The main functionality of this library comes from SerializationChecker.tryParse. It's goal is to run through all of the SourceItems in the input coming in. It will return a list of Either success or failures.

How to go about using this and where should you use it?

There are 2 main usages of this project. The first usage of this is to use it as a test in your tests suite. For this you should confirm that all of the output is purely successful parses.

The second usage of this library would be to construct a single application that would verify the data object's validation against a bunch of examples. (Or if you're confident on the data object definition, the validity of the examples)

How to build

Build with sbt:

sbt clean coverage compile test coverageReport coverageOff clean compile package

TODO

  • Parse, Write, Parse verification (checking for repeatability serialization)
  • SBT Plugin that does automatic verification
  • ReactiveMongo Module
  • Templated CLI Application
  • Scalatest extension
  • Profiling of serialization examples and verification that they will stay under a limit.
  • Provide the ability to test serialization