diff --git a/.gitignore b/.gitignore index 0f1e28b..9b5daf9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ out/ target/ .vscode .ammonite -.bsp \ No newline at end of file +.bsp +*.iml \ No newline at end of file diff --git a/AUTOCONFIG.md b/AUTOCONFIG.md index 76bd383..96347e3 100644 --- a/AUTOCONFIG.md +++ b/AUTOCONFIG.md @@ -3,9 +3,9 @@ Rather than implementing `ToJson` and `FromJson` by hand, you can generate them automatically using @@ -15,9 +15,9 @@ If you like you can even skip the declaration by mixing in `AutoToJson` or `AutoFromJson`, or importing `nrktkt.ninny.Auto._`. @@ -26,9 +26,9 @@ If you like you can even skip the declaration by mixing in `AutoToJson` or You can change the name of a field being read to/from JSON using the `@JsonName` annotation. @@ -37,8 +37,8 @@ You can change the name of a field being read to/from JSON using the `@JsonName` If your case class has optional parameters then you can use their default values when a field is absent by importing the feature flag `FromJsonAuto.useDefaults` in the scope of the derivation for your `FromJson`. diff --git a/HOWTORUNME.md b/HOWTORUNME.md index d74951f..46674e0 100644 --- a/HOWTORUNME.md +++ b/HOWTORUNME.md @@ -5,5 +5,5 @@ # Run Example ```shell script -./mill ninny.test.run +./mill __.test ``` \ No newline at end of file diff --git a/README.md b/README.md index 9cb44b7..3cf2a7c 100644 --- a/README.md +++ b/README.md @@ -258,7 +258,7 @@ trait ToSomeJson[A] extends ToJson[A] { override def to(a: A) = Some(toSome(a)) } ``` -### [Example](ninny/test/src/io/github/kag0/ninny/example/Example.scala) +### [Example](ninny/test/src-2/nrktkt/ninny/example/Example.scala) An example of updating a user profile which clears one field, sets the value of another, and leaves a third unchanged without overwriting it diff --git a/USERGUIDE.md b/USERGUIDE.md index 3589414..9226b52 100644 --- a/USERGUIDE.md +++ b/USERGUIDE.md @@ -1,8 +1,8 @@ [![Maven Central](https://img.shields.io/maven-central/v/tk.nrktkt/ninny_2.13?style=for-the-badge&logo=apache-maven)](https://mvnrepository.com/artifact/tk.nrktkt/ninny) -[![coverage](https://img.shields.io/badge/test%20coverage-%3E%2090%25-brightgreen?style=for-the-badge)](https://kag0.github.io/ninny-json/coverage) -[![Gitter](https://img.shields.io/gitter/room/kag0/ninny-json?style=for-the-badge&logo=gitter)](https://gitter.im/kag0/ninny-json?utm_source=share-link&utm_medium=link&utm_campaign=share-link) -[![Matrix](https://img.shields.io/badge/chat-on%20matrix-%230dbd8b?style=for-the-badge&logo=matrix)](https://matrix.to/#/#kag0_ninny-json:gitter.im?via=gitter.im&via=matrix.org) +[![coverage](https://img.shields.io/badge/test%20coverage-%3E%2090%25-brightgreen?style=for-the-badge)](https://nrktkt.github.io/ninny-json/coverage) +[![Gitter](https://img.shields.io/gitter/room/nrktkt/ninny-json?style=for-the-badge&logo=gitter)](https://gitter.im/kag0/ninny-json?utm_source=share-link&utm_medium=link&utm_campaign=share-link) +[![Matrix](https://img.shields.io/badge/chat-on%20matrix-%230dbd8b?style=for-the-badge&logo=matrix)](https://matrix.to/#/#nrktkt_ninny-json:gitter.im?via=gitter.im&via=matrix.org) # Integrations @@ -12,33 +12,33 @@ * [mercury JSON-RPC](https://github.com/lightform-oss/mercury/tree/master/ninny) * [Play JSON](play-compat) (if you find something with Play support, it will work with ninny too!) - # Reading values from JSON # Writing values to JSON `obj` and `arr` build JSON structures @@ -46,9 +46,9 @@ > See below for an example @@ -58,27 +58,27 @@ With immutable ASTs it can be a pain to update values deep inside the tree. You can use ninny's dynamic update syntax easly to replace values way down in there. # Converting domain objects to JSON # Converting JSON to domain objects @@ -88,9 +88,9 @@ Rather than implementing `ToJson` and `FromJson` by hand, you can generate them automatically using @@ -101,8 +101,8 @@ See more on configuring automatic derivation [here](AUTOCONFIG.md). Often you want to have different names in a case class than what's in the JSON, but you don't need to change the types at all. `forProductN` methods are perfect for this, just specify what the JSON field name should be and provide the case class `apply`/`unapply` method to generate a `ToJson`, `FromJson`, or both together. diff --git a/ninny/test/src-2/io/github/kag0/ninny/JsonSpec.scala b/ninny/test/src-2/nrktkt/ninny/JsonSpec.scala similarity index 98% rename from ninny/test/src-2/io/github/kag0/ninny/JsonSpec.scala rename to ninny/test/src-2/nrktkt/ninny/JsonSpec.scala index 7865ab0..80cecac 100644 --- a/ninny/test/src-2/io/github/kag0/ninny/JsonSpec.scala +++ b/ninny/test/src-2/nrktkt/ninny/JsonSpec.scala @@ -1,10 +1,10 @@ -package io.github.kag0.ninny +package nrktkt.ninny import java.time.temporal.ChronoUnit import java.time.{Instant, OffsetDateTime, ZonedDateTime} import java.util.NoSuchElementException -import io.github.kag0.ninny.ast._ +import nrktkt.ninny.ast._ import org.scalatest._ import org.scalatest.flatspec._ import org.scalatest.matchers._ @@ -14,9 +14,9 @@ import java.util.UUID import scala.util.Random import scala.collection.compat.immutable.ArraySeq import java.util.Base64 -import io.github.kag0.ninny.magnetic.JsonMagnet -import io.github.kag0.ninny.magnetic.SomeJsonMagnet -import io.github.kag0.ninny.ToAndFromJson +import nrktkt.ninny.magnetic.JsonMagnet +import nrktkt.ninny.magnetic.SomeJsonMagnet +import nrktkt.ninny.ToAndFromJson import scala.util.Failure class JsonSpec diff --git a/ninny/test/src-2/io/github/kag0/ninny/example/Example.scala b/ninny/test/src-2/nrktkt/ninny/example/Example.scala similarity index 95% rename from ninny/test/src-2/io/github/kag0/ninny/example/Example.scala rename to ninny/test/src-2/nrktkt/ninny/example/Example.scala index c96b67a..f83e938 100644 --- a/ninny/test/src-2/io/github/kag0/ninny/example/Example.scala +++ b/ninny/test/src-2/nrktkt/ninny/example/Example.scala @@ -1,7 +1,7 @@ -package io.github.kag0.ninny.example +package nrktkt.ninny.example -import io.github.kag0.ninny.ast._ -import io.github.kag0.ninny._ +import nrktkt.ninny.ast._ +import nrktkt.ninny._ import scala.util.Success diff --git a/ninny/test/src-2/io/github/kag0/ninny/example/Userguide.scala b/ninny/test/src-2/nrktkt/ninny/example/Userguide.scala similarity index 95% rename from ninny/test/src-2/io/github/kag0/ninny/example/Userguide.scala rename to ninny/test/src-2/nrktkt/ninny/example/Userguide.scala index cdcf352..99ef8b6 100644 --- a/ninny/test/src-2/io/github/kag0/ninny/example/Userguide.scala +++ b/ninny/test/src-2/nrktkt/ninny/example/Userguide.scala @@ -1,12 +1,12 @@ -package io.github.kag0.ninny.example +package nrktkt.ninny.example -import io.github.kag0.ninny.ast.JsonValue +import nrktkt.ninny.ast.JsonValue import scala.util.{Failure, Try} import scala.collection.immutable._ // format: off object Userguide extends App { -import io.github.kag0.ninny._ +import nrktkt.ninny._ val hopefullyJson: Try[JsonValue] = Json.parse(""" { @@ -51,7 +51,7 @@ hopefullyJson.*.firstName.to[String] // Success(John) // type conversion failures work as you'd expect json.firstName.to[Boolean] -// Failure(io.github.kag0.ninny.JsonException: Expected boolean, got "John") +// Failure(nrktkt.ninny.JsonException: Expected boolean, got "John") // dynamic array syntax works predictably json.kids(1).to[String] // Success(Jane) @@ -70,7 +70,7 @@ json.age.to[Option[String]] // Success(None) 42.toSomeJson // JsonNumber(42) // .toSomeJson doesn't work unless the type definitely produces a JSON value -//None.toSomeJson // could not find implicit value for parameter toJson: io.github.kag0.ninny.ToSomeJson[None.type] +//None.toSomeJson // could not find implicit value for parameter toJson: nrktkt.ninny.ToSomeJson[None.type] //////////////////////// diff --git a/ninny/test/src-2/io/github/kag0/ninny/userguide/Annotations.scala b/ninny/test/src-2/nrktkt/ninny/userguide/Annotations.scala similarity index 71% rename from ninny/test/src-2/io/github/kag0/ninny/userguide/Annotations.scala rename to ninny/test/src-2/nrktkt/ninny/userguide/Annotations.scala index 3b32168..12e5138 100644 --- a/ninny/test/src-2/io/github/kag0/ninny/userguide/Annotations.scala +++ b/ninny/test/src-2/nrktkt/ninny/userguide/Annotations.scala @@ -1,8 +1,8 @@ -package io.github.kag0.ninny.userguide +package nrktkt.ninny.userguide -import io.github.kag0.ninny.ToAndFromJson +import nrktkt.ninny.ToAndFromJson -import io.github.kag0.ninny._ +import nrktkt.ninny._ object Annotations extends App { // format: Off diff --git a/ninny/test/src-2/io/github/kag0/ninny/userguide/DefaultValues.scala b/ninny/test/src-2/nrktkt/ninny/userguide/DefaultValues.scala similarity index 72% rename from ninny/test/src-2/io/github/kag0/ninny/userguide/DefaultValues.scala rename to ninny/test/src-2/nrktkt/ninny/userguide/DefaultValues.scala index 778c745..591d678 100644 --- a/ninny/test/src-2/io/github/kag0/ninny/userguide/DefaultValues.scala +++ b/ninny/test/src-2/nrktkt/ninny/userguide/DefaultValues.scala @@ -1,7 +1,7 @@ -package io.github.kag0.ninny.userguide +package nrktkt.ninny.userguide -import io.github.kag0.ninny.FromJson -import io.github.kag0.ninny._ +import nrktkt.ninny.FromJson +import nrktkt.ninny._ object DefaultValues extends App { // format: Off diff --git a/ninny/test/src-2/io/github/kag0/ninny/userguide/DomainFrom.scala b/ninny/test/src-2/nrktkt/ninny/userguide/DomainFrom.scala similarity index 96% rename from ninny/test/src-2/io/github/kag0/ninny/userguide/DomainFrom.scala rename to ninny/test/src-2/nrktkt/ninny/userguide/DomainFrom.scala index a4ba468..26dccdd 100644 --- a/ninny/test/src-2/io/github/kag0/ninny/userguide/DomainFrom.scala +++ b/ninny/test/src-2/nrktkt/ninny/userguide/DomainFrom.scala @@ -1,4 +1,4 @@ -package io.github.kag0.ninny.userguide +package nrktkt.ninny.userguide import scala.util.Failure import scala.util.Try diff --git a/ninny/test/src-2/io/github/kag0/ninny/userguide/DomainTo.scala b/ninny/test/src-2/nrktkt/ninny/userguide/DomainTo.scala similarity index 91% rename from ninny/test/src-2/io/github/kag0/ninny/userguide/DomainTo.scala rename to ninny/test/src-2/nrktkt/ninny/userguide/DomainTo.scala index 2837daa..b90bc0c 100644 --- a/ninny/test/src-2/io/github/kag0/ninny/userguide/DomainTo.scala +++ b/ninny/test/src-2/nrktkt/ninny/userguide/DomainTo.scala @@ -1,6 +1,6 @@ -package io.github.kag0.ninny.userguide +package nrktkt.ninny.userguide -import io.github.kag0.ninny.ast.JsonValue +import nrktkt.ninny.ast.JsonValue object DomainTo extends App { // format: off diff --git a/ninny/test/src-2/io/github/kag0/ninny/userguide/ForProductN.scala b/ninny/test/src-2/nrktkt/ninny/userguide/ForProductN.scala similarity index 89% rename from ninny/test/src-2/io/github/kag0/ninny/userguide/ForProductN.scala rename to ninny/test/src-2/nrktkt/ninny/userguide/ForProductN.scala index 3aa012e..4912ef9 100644 --- a/ninny/test/src-2/io/github/kag0/ninny/userguide/ForProductN.scala +++ b/ninny/test/src-2/nrktkt/ninny/userguide/ForProductN.scala @@ -1,6 +1,6 @@ -package io.github.kag0.ninny.userguide +package nrktkt.ninny.userguide -import io.github.kag0.ninny._ +import nrktkt.ninny._ object ForProductN extends App { // format: Off diff --git a/ninny/test/src-2/io/github/kag0/ninny/userguide/FullAuto.scala b/ninny/test/src-2/nrktkt/ninny/userguide/FullAuto.scala similarity index 55% rename from ninny/test/src-2/io/github/kag0/ninny/userguide/FullAuto.scala rename to ninny/test/src-2/nrktkt/ninny/userguide/FullAuto.scala index 0756b29..dc94d39 100644 --- a/ninny/test/src-2/io/github/kag0/ninny/userguide/FullAuto.scala +++ b/ninny/test/src-2/nrktkt/ninny/userguide/FullAuto.scala @@ -1,7 +1,7 @@ -package io.github.kag0.ninny.userguide +package nrktkt.ninny.userguide -import io.github.kag0.ninny.userguide.DomainFrom.Person -import io.github.kag0.ninny.userguide.DomainFrom.Address +import nrktkt.ninny.userguide.DomainFrom.Person +import nrktkt.ninny.userguide.DomainFrom.Address object FullAuto { // format: off diff --git a/ninny/test/src-2/io/github/kag0/ninny/userguide/Reading.scala b/ninny/test/src-2/nrktkt/ninny/userguide/Reading.scala similarity index 90% rename from ninny/test/src-2/io/github/kag0/ninny/userguide/Reading.scala rename to ninny/test/src-2/nrktkt/ninny/userguide/Reading.scala index ebf72bc..256b95a 100644 --- a/ninny/test/src-2/io/github/kag0/ninny/userguide/Reading.scala +++ b/ninny/test/src-2/nrktkt/ninny/userguide/Reading.scala @@ -1,7 +1,7 @@ -package io.github.kag0.ninny.userguide +package nrktkt.ninny.userguide import scala.util.Try -import io.github.kag0.ninny.ast.JsonValue +import nrktkt.ninny.ast.JsonValue object Reading { // format: off @@ -51,7 +51,7 @@ hopefullyJson.*.firstName.to[String] // Success(John) // type conversion failures work as you'd expect json.firstName.to[Boolean] -// Failure(io.github.kag0.ninny.JsonException: Expected boolean, got "John") +// Failure(nrktkt.ninny.JsonException: Expected boolean, got "John") // dynamic array syntax works predictably json.kids(1).to[String] // Success(Jane) diff --git a/ninny/test/src-2/io/github/kag0/ninny/userguide/SemiAuto.scala b/ninny/test/src-2/nrktkt/ninny/userguide/SemiAuto.scala similarity index 66% rename from ninny/test/src-2/io/github/kag0/ninny/userguide/SemiAuto.scala rename to ninny/test/src-2/nrktkt/ninny/userguide/SemiAuto.scala index 2d57b73..cc2182f 100644 --- a/ninny/test/src-2/io/github/kag0/ninny/userguide/SemiAuto.scala +++ b/ninny/test/src-2/nrktkt/ninny/userguide/SemiAuto.scala @@ -1,7 +1,7 @@ -package io.github.kag0.ninny.userguide +package nrktkt.ninny.userguide -import io.github.kag0.ninny.userguide.DomainFrom.Address -import io.github.kag0.ninny.userguide.DomainFrom.Person +import nrktkt.ninny.userguide.DomainFrom.Address +import nrktkt.ninny.userguide.DomainFrom.Person object SemiAuto { // format: off diff --git a/ninny/test/src-2/io/github/kag0/ninny/userguide/Updating.scala b/ninny/test/src-2/nrktkt/ninny/userguide/Updating.scala similarity index 86% rename from ninny/test/src-2/io/github/kag0/ninny/userguide/Updating.scala rename to ninny/test/src-2/nrktkt/ninny/userguide/Updating.scala index 1cf7c05..4414965 100644 --- a/ninny/test/src-2/io/github/kag0/ninny/userguide/Updating.scala +++ b/ninny/test/src-2/nrktkt/ninny/userguide/Updating.scala @@ -1,4 +1,4 @@ -package io.github.kag0.ninny.userguide +package nrktkt.ninny.userguide object Updating { // format: off diff --git a/ninny/test/src-2/io/github/kag0/ninny/userguide/Writing.scala b/ninny/test/src-2/nrktkt/ninny/userguide/Writing.scala similarity index 67% rename from ninny/test/src-2/io/github/kag0/ninny/userguide/Writing.scala rename to ninny/test/src-2/nrktkt/ninny/userguide/Writing.scala index b1f2d0c..a6f40c3 100644 --- a/ninny/test/src-2/io/github/kag0/ninny/userguide/Writing.scala +++ b/ninny/test/src-2/nrktkt/ninny/userguide/Writing.scala @@ -1,6 +1,6 @@ -package io.github.kag0.ninny.userguide +package nrktkt.ninny.userguide -import io.github.kag0.ninny.ToSomeJson +import nrktkt.ninny.ToSomeJson object Writing { // format: off @@ -19,7 +19,7 @@ import nrktkt.ninny._ // definitely produces a JSON value None.toSomeJson // ^ -// could not find implicit value for parameter toJson: io.github.kag0.ninny.ToSomeJson[None.type] +// could not find implicit value for parameter toJson: nrktkt.ninny.ToSomeJson[None.type] //--- @@ -56,8 +56,8 @@ implicit val gjToJson2: ToJson[GomJabbar] = ??? obj("gom_jabbar" -> gomJabbar) /* type mismatch; - found : io.github.kag0.ninny.userguide.Writing.GomJabbar - required: io.github.kag0.ninny.magnetic.JsonMagnet + found : nrktkt.ninny.userguide.Writing.GomJabbar + required: nrktkt.ninny.magnetic.JsonMagnet obj("gom_jabbar" -> gomJabbar) ^ */ @@ -65,9 +65,9 @@ obj("gom_jabbar" -> gomJabbar) obj("gom_jabbar" ~> gomJabbar) /* ambiguous implicit values: - both value gjToJson1 in object Writing of type => io.github.kag0.ninny.ToJson[GomJabbar] - and value gjToJson2 in object Writing of type => io.github.kag0.ninny.ToJson[GomJabbar] - match expected type io.github.kag0.ninny.package.ToJson[GomJabbar] + both value gjToJson1 in object Writing of type => nrktkt.ninny.ToJson[GomJabbar] + and value gjToJson2 in object Writing of type => nrktkt.ninny.ToJson[GomJabbar] + match expected type nrktkt.ninny.package.ToJson[GomJabbar] obj("gom_jabbar" ~> gomJabbar) ^ */ diff --git a/ninny/test/src/io/github/kag0/ninny/NumberSpec.scala b/ninny/test/src/nrktkt/ninny/NumberSpec.scala similarity index 98% rename from ninny/test/src/io/github/kag0/ninny/NumberSpec.scala rename to ninny/test/src/nrktkt/ninny/NumberSpec.scala index 5dca00c..ea25501 100644 --- a/ninny/test/src/io/github/kag0/ninny/NumberSpec.scala +++ b/ninny/test/src/nrktkt/ninny/NumberSpec.scala @@ -1,9 +1,9 @@ -package io.github.kag0.ninny +package nrktkt.ninny import org.scalatest._ import org.scalatest.flatspec._ import org.scalatest.matchers._ -import io.github.kag0.ninny.ast._ +import nrktkt.ninny.ast._ class NumberSpec extends AnyFlatSpec with should.Matchers diff --git a/ninny/test/src/nrktkt/ninny/ToJsonInstancesSpec.scala b/ninny/test/src/nrktkt/ninny/ToJsonInstancesSpec.scala index 2fd5365..bfb7f5f 100644 --- a/ninny/test/src/nrktkt/ninny/ToJsonInstancesSpec.scala +++ b/ninny/test/src/nrktkt/ninny/ToJsonInstancesSpec.scala @@ -3,7 +3,7 @@ package nrktkt.ninny import org.scalatest._ import org.scalatest.flatspec._ import org.scalatest.matchers._ -import io.github.kag0.ninny.ast._ +import nrktkt.ninny.ast._ class ToJsonInstancesSpec extends AnyFlatSpec with should.Matchers { "Either values" should diff --git a/ninny/test/src/io/github/kag0/ninny/UpdateSpec.scala b/ninny/test/src/nrktkt/ninny/UpdateSpec.scala similarity index 100% rename from ninny/test/src/io/github/kag0/ninny/UpdateSpec.scala rename to ninny/test/src/nrktkt/ninny/UpdateSpec.scala