Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mbryzek committed Jul 3, 2024
1 parent e2d6181 commit 5e6ec87
Show file tree
Hide file tree
Showing 35 changed files with 452 additions and 452 deletions.
24 changes: 12 additions & 12 deletions lib/src/test/resources/example-union-types-ning-client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ package io.apibuilder.example.union.types.v0.models {

implicit def jsonWritesApidocExampleUnionTypesBar: play.api.libs.json.Writes[Bar] = {
(obj: io.apibuilder.example.union.types.v0.models.Bar) => {
jsonWritesApidocExampleUnionTypesBar(obj)
io.apibuilder.example.union.types.v0.models.json.jsonWritesApidocExampleUnionTypesBar(obj)
}
}

Expand Down Expand Up @@ -255,7 +255,7 @@ package io.apibuilder.example.union.types.v0.models {

implicit def jsonWritesApidocExampleUnionTypesFoo: play.api.libs.json.Writes[Foo] = {
(obj: io.apibuilder.example.union.types.v0.models.Foo) => {
jsonWritesApidocExampleUnionTypesFoo(obj)
io.apibuilder.example.union.types.v0.models.json.jsonWritesApidocExampleUnionTypesFoo(obj)
}
}

Expand All @@ -275,7 +275,7 @@ package io.apibuilder.example.union.types.v0.models {

implicit def jsonWritesApidocExampleUnionTypesGuestUser: play.api.libs.json.Writes[GuestUser] = {
(obj: io.apibuilder.example.union.types.v0.models.GuestUser) => {
jsObjectGuestUser(obj)
io.apibuilder.example.union.types.v0.models.json.jsObjectGuestUser(obj)
}
}

Expand All @@ -291,13 +291,13 @@ package io.apibuilder.example.union.types.v0.models {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"email" -> play.api.libs.json.JsString(obj.email),
"preference" -> jsObjectFoobar(obj.preference)
"preference" -> io.apibuilder.example.union.types.v0.models.json.jsObjectFoobar(obj.preference)
) ++ play.api.libs.json.Json.obj("discriminator" -> "registered_user")
}

implicit def jsonWritesApidocExampleUnionTypesRegisteredUser: play.api.libs.json.Writes[RegisteredUser] = {
(obj: io.apibuilder.example.union.types.v0.models.RegisteredUser) => {
jsObjectRegisteredUser(obj)
io.apibuilder.example.union.types.v0.models.json.jsObjectRegisteredUser(obj)
}
}

Expand All @@ -324,16 +324,16 @@ package io.apibuilder.example.union.types.v0.models {
}
implicit def jsonWritesApidocExampleUnionTypesFoobar: play.api.libs.json.Writes[Foobar] = {
(obj: io.apibuilder.example.union.types.v0.models.Foobar) => {
jsObjectFoobar(obj)
io.apibuilder.example.union.types.v0.models.json.jsObjectFoobar(obj)
}
}

implicit def jsonReadsApidocExampleUnionTypesUser: play.api.libs.json.Reads[io.apibuilder.example.union.types.v0.models.User] = (js: play.api.libs.json.JsValue) => {
def readDiscriminator(discriminator: String) = {
discriminator match {
case "registered_user" => jsonReadsApidocExampleUnionTypesRegisteredUser.reads(js)
case "guest_user" => jsonReadsApidocExampleUnionTypesGuestUser.reads(js)
case "uuid" => jsonReadsApidocExampleUnionTypesUuid.reads(js)
case "registered_user" => io.apibuilder.example.union.types.v0.models.json.jsonReadsApidocExampleUnionTypesRegisteredUser.reads(js)
case "guest_user" => io.apibuilder.example.union.types.v0.models.json.jsonReadsApidocExampleUnionTypesGuestUser.reads(js)
case "uuid" => io.apibuilder.example.union.types.v0.models.json.jsonReadsApidocExampleUnionTypesUuid.reads(js)
case other => play.api.libs.json.JsSuccess(io.apibuilder.example.union.types.v0.models.UserUndefinedType(other))
}
}
Expand All @@ -345,8 +345,8 @@ package io.apibuilder.example.union.types.v0.models {

def jsObjectUser(obj: io.apibuilder.example.union.types.v0.models.User): play.api.libs.json.JsObject = {
obj match {
case x: io.apibuilder.example.union.types.v0.models.RegisteredUser => jsObjectRegisteredUser(x)
case x: io.apibuilder.example.union.types.v0.models.GuestUser => jsObjectGuestUser(x)
case x: io.apibuilder.example.union.types.v0.models.RegisteredUser => io.apibuilder.example.union.types.v0.models.json.jsObjectRegisteredUser(x)
case x: io.apibuilder.example.union.types.v0.models.GuestUser => io.apibuilder.example.union.types.v0.models.json.jsObjectGuestUser(x)
case x: io.apibuilder.example.union.types.v0.models.UserUuid => play.api.libs.json.Json.obj("discriminator" -> "uuid", "value" -> play.api.libs.json.JsString(x.value.toString))
case other => {
sys.error(s"The type[${other.getClass.getName}] has no JSON writer")
Expand All @@ -355,7 +355,7 @@ package io.apibuilder.example.union.types.v0.models {
}
implicit def jsonWritesApidocExampleUnionTypesUser: play.api.libs.json.Writes[User] = {
(obj: io.apibuilder.example.union.types.v0.models.User) => {
jsObjectUser(obj)
io.apibuilder.example.union.types.v0.models.json.jsObjectUser(obj)
}
}
}
Expand Down
24 changes: 12 additions & 12 deletions lib/src/test/resources/example-union-types-play-23.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ package io.apibuilder.example.union.types.v0.models {

implicit def jsonWritesApidocExampleUnionTypesBar: play.api.libs.json.Writes[Bar] = {
(obj: io.apibuilder.example.union.types.v0.models.Bar) => {
jsonWritesApidocExampleUnionTypesBar(obj)
io.apibuilder.example.union.types.v0.models.json.jsonWritesApidocExampleUnionTypesBar(obj)
}
}

Expand Down Expand Up @@ -255,7 +255,7 @@ package io.apibuilder.example.union.types.v0.models {

implicit def jsonWritesApidocExampleUnionTypesFoo: play.api.libs.json.Writes[Foo] = {
(obj: io.apibuilder.example.union.types.v0.models.Foo) => {
jsonWritesApidocExampleUnionTypesFoo(obj)
io.apibuilder.example.union.types.v0.models.json.jsonWritesApidocExampleUnionTypesFoo(obj)
}
}

Expand All @@ -275,7 +275,7 @@ package io.apibuilder.example.union.types.v0.models {

implicit def jsonWritesApidocExampleUnionTypesGuestUser: play.api.libs.json.Writes[GuestUser] = {
(obj: io.apibuilder.example.union.types.v0.models.GuestUser) => {
jsObjectGuestUser(obj)
io.apibuilder.example.union.types.v0.models.json.jsObjectGuestUser(obj)
}
}

Expand All @@ -291,13 +291,13 @@ package io.apibuilder.example.union.types.v0.models {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"email" -> play.api.libs.json.JsString(obj.email),
"preference" -> jsObjectFoobar(obj.preference)
"preference" -> io.apibuilder.example.union.types.v0.models.json.jsObjectFoobar(obj.preference)
) ++ play.api.libs.json.Json.obj("discriminator" -> "registered_user")
}

implicit def jsonWritesApidocExampleUnionTypesRegisteredUser: play.api.libs.json.Writes[RegisteredUser] = {
(obj: io.apibuilder.example.union.types.v0.models.RegisteredUser) => {
jsObjectRegisteredUser(obj)
io.apibuilder.example.union.types.v0.models.json.jsObjectRegisteredUser(obj)
}
}

Expand All @@ -324,16 +324,16 @@ package io.apibuilder.example.union.types.v0.models {
}
implicit def jsonWritesApidocExampleUnionTypesFoobar: play.api.libs.json.Writes[Foobar] = {
(obj: io.apibuilder.example.union.types.v0.models.Foobar) => {
jsObjectFoobar(obj)
io.apibuilder.example.union.types.v0.models.json.jsObjectFoobar(obj)
}
}

implicit def jsonReadsApidocExampleUnionTypesUser: play.api.libs.json.Reads[io.apibuilder.example.union.types.v0.models.User] = (js: play.api.libs.json.JsValue) => {
def readDiscriminator(discriminator: String) = {
discriminator match {
case "registered_user" => jsonReadsApidocExampleUnionTypesRegisteredUser.reads(js)
case "guest_user" => jsonReadsApidocExampleUnionTypesGuestUser.reads(js)
case "uuid" => jsonReadsApidocExampleUnionTypesUuid.reads(js)
case "registered_user" => io.apibuilder.example.union.types.v0.models.json.jsonReadsApidocExampleUnionTypesRegisteredUser.reads(js)
case "guest_user" => io.apibuilder.example.union.types.v0.models.json.jsonReadsApidocExampleUnionTypesGuestUser.reads(js)
case "uuid" => io.apibuilder.example.union.types.v0.models.json.jsonReadsApidocExampleUnionTypesUuid.reads(js)
case other => play.api.libs.json.JsSuccess(io.apibuilder.example.union.types.v0.models.UserUndefinedType(other))
}
}
Expand All @@ -345,8 +345,8 @@ package io.apibuilder.example.union.types.v0.models {

def jsObjectUser(obj: io.apibuilder.example.union.types.v0.models.User): play.api.libs.json.JsObject = {
obj match {
case x: io.apibuilder.example.union.types.v0.models.RegisteredUser => jsObjectRegisteredUser(x)
case x: io.apibuilder.example.union.types.v0.models.GuestUser => jsObjectGuestUser(x)
case x: io.apibuilder.example.union.types.v0.models.RegisteredUser => io.apibuilder.example.union.types.v0.models.json.jsObjectRegisteredUser(x)
case x: io.apibuilder.example.union.types.v0.models.GuestUser => io.apibuilder.example.union.types.v0.models.json.jsObjectGuestUser(x)
case x: io.apibuilder.example.union.types.v0.models.UserUuid => play.api.libs.json.Json.obj("discriminator" -> "uuid", "value" -> play.api.libs.json.JsString(x.value.toString))
case other => {
sys.error(s"The type[${other.getClass.getName}] has no JSON writer")
Expand All @@ -355,7 +355,7 @@ package io.apibuilder.example.union.types.v0.models {
}
implicit def jsonWritesApidocExampleUnionTypesUser: play.api.libs.json.Writes[User] = {
(obj: io.apibuilder.example.union.types.v0.models.User) => {
jsObjectUser(obj)
io.apibuilder.example.union.types.v0.models.json.jsObjectUser(obj)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ package com.gilt.test.v0.models {

implicit def jsonWritesTestUser: play.api.libs.json.Writes[User] = {
(obj: com.gilt.test.v0.models.User) => {
jsObjectUser(obj)
com.gilt.test.v0.models.json.jsObjectUser(obj)
}
}

Expand All @@ -95,7 +95,7 @@ package com.gilt.test.v0.models {

implicit def jsonWritesTestUserPatch: play.api.libs.json.Writes[UserPatch] = {
(obj: com.gilt.test.v0.models.UserPatch) => {
jsObjectUserPatch(obj)
com.gilt.test.v0.models.json.jsObjectUserPatch(obj)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ package com.gilt.test.v0.models {

implicit def jsonWritesTestUser: play.api.libs.json.Writes[User] = {
(obj: com.gilt.test.v0.models.User) => {
jsObjectUser(obj)
com.gilt.test.v0.models.json.jsObjectUser(obj)
}
}

Expand All @@ -95,7 +95,7 @@ package com.gilt.test.v0.models {

implicit def jsonWritesTestUserPatch: play.api.libs.json.Writes[UserPatch] = {
(obj: com.gilt.test.v0.models.UserPatch) => {
jsObjectUserPatch(obj)
com.gilt.test.v0.models.json.jsObjectUserPatch(obj)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ package com.gilt.test.v0.models {

implicit def jsonWritesTestUser: play.api.libs.json.Writes[User] = {
(obj: com.gilt.test.v0.models.User) => {
jsObjectUser(obj)
com.gilt.test.v0.models.json.jsObjectUser(obj)
}
}

Expand All @@ -95,7 +95,7 @@ package com.gilt.test.v0.models {

implicit def jsonWritesTestUserPatch: play.api.libs.json.Writes[UserPatch] = {
(obj: com.gilt.test.v0.models.UserPatch) => {
jsObjectUserPatch(obj)
com.gilt.test.v0.models.json.jsObjectUserPatch(obj)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ def jsObjectHealthcheck(obj: com.gilt.quality.v0.models.Healthcheck): play.api.l

implicit def jsonWritesQualityHealthcheck: play.api.libs.json.Writes[Healthcheck] = {
(obj: com.gilt.quality.v0.models.Healthcheck) => {
jsObjectHealthcheck(obj)
com.gilt.quality.v0.models.json.jsObjectHealthcheck(obj)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ def jsObjectPlan(obj: com.gilt.quality.v0.models.Plan): play.api.libs.json.JsObj

implicit def jsonWritesQualityPlan: play.api.libs.json.Writes[Plan] = {
(obj: com.gilt.quality.v0.models.Plan) => {
jsObjectPlan(obj)
com.gilt.quality.v0.models.json.jsObjectPlan(obj)
}
}
Loading

0 comments on commit 5e6ec87

Please sign in to comment.