Skip to content
This repository was archived by the owner on Apr 5, 2020. It is now read-only.

(abandoned) we have a much better one to generate JSON, protobuf, SQLite database schema. but we have no time to open source it

Notifications You must be signed in to change notification settings

molikto/JsonParserGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

inspired by ig-json-parser. it basically do the same thing as ig-json-parser. but...

the differences are:

  • do not use annotations to generate the parsers. but use Scala raw value like:

    lazy val Tag = ObjectType("Tag", Seq(
      Field("value", "value", StringType),
      Field("category", "category", StringType)))
    • one small drawback is if you data is recursive, you need to link the recursive data outside a constructor
  • more powerful

    • you can write converter code to convert between types, so basically you can have all your stuff, so basically you can inject any code you want when parsing:
    lazy val ApiTimeStringToDate = ConvertedType(StringType, JavaObjectType("java.util.Date"), "ApiTimeStringToDate", "DateToApiTimeString")
    • can also generate enum type and map types, if you are too lazy to write the converter code
  • including a class JsonToSpec which can generate the spec from a folder of json samples. so you not even need to write the spec if you have a working backend. but most of time you will want to customize the result by editing the result spec

  • it is dead simple

    • you should be able to use it from command line, or in any build tool you use
    • you can easily customize this thing. as the code is very short

About

(abandoned) we have a much better one to generate JSON, protobuf, SQLite database schema. but we have no time to open source it

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages