CleverCloud / json2caseclass

Kickstart your scala API client by turning JSON into case classes.
http://json2caseclass.cleverapps.io
124 stars 19 forks source link

Add option for fully typesafe generation #12

Open sherifkandeel opened 6 years ago

sherifkandeel commented 6 years ago

To follow a complete typesafe approach, leaf level values should NOT be converted to primitive types. but instead, to value classes

e.g.

{
  "id": 2,
  "name": "Steve Nash",
  "score": 4.23
}

should be

case class R00tJsonObject(id: Id, name: Name, score: Score)
case class Id (value: Int) extends AnyVal
case class Name(value: String) extends AnyVal
case class Score(value: Double) extends AnyVal
Daenyth commented 3 years ago

I'd like to see this as a button on the analysis panel, next to the Optional checkbox (maybe in addition to the full-auto approach described above).

When modifying the type name of a field in the analysis area for a primitive type, it should generate the value class wrapper for it