diff --git a/lib/src/test/resources/example-union-types-ning-client.txt b/lib/src/test/resources/example-union-types-ning-client.txt index 9242d41e..4e1202a8 100644 --- a/lib/src/test/resources/example-union-types-ning-client.txt +++ b/lib/src/test/resources/example-union-types-ning-client.txt @@ -302,7 +302,7 @@ package io.apibuilder.example.union.types.v0.models { } implicit def jsonReadsApidocExampleUnionTypesUserUuid: play.api.libs.json.Reads[UserUuid] = { - (__ \ "value").read[_root_.java.util.UUID].map { x => new UserUuid(value = x) } + (__ \ "value").read[_root_.java.util.UUID].map { x => UserUuid(value = x) } } implicit def jsonReadsApidocExampleUnionTypesFoobar: play.api.libs.json.Reads[Foobar] = { @@ -322,7 +322,6 @@ package io.apibuilder.example.union.types.v0.models { case x: io.apibuilder.example.union.types.v0.models.FoobarUndefinedType => sys.error(s"The type[io.apibuilder.example.union.types.v0.models.FoobarUndefinedType] should never be serialized") } } - implicit def jsonWritesApidocExampleUnionTypesFoobar: play.api.libs.json.Writes[Foobar] = { (obj: io.apibuilder.example.union.types.v0.models.Foobar) => { jsObjectFoobar(obj) @@ -332,9 +331,9 @@ package io.apibuilder.example.union.types.v0.models { implicit def jsonReadsApidocExampleUnionTypesUser: play.api.libs.json.Reads[User] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "registered_user" => js.validate[io.apibuilder.example.union.types.v0.models.RegisteredUser] - case "guest_user" => js.validate[io.apibuilder.example.union.types.v0.models.GuestUser] - case "uuid" => js.validate[io.apibuilder.example.union.types.v0.models.UserUuid] + case "registered_user" => jsonReadsApidocExampleUnionTypesRegisteredUser.reads(js) + case "guest_user" => jsonReadsApidocExampleUnionTypesGuestUser.reads(js) + case "uuid" => jsonReadsApidocExampleUnionTypesUuid.reads(js) case other => play.api.libs.json.JsSuccess(io.apibuilder.example.union.types.v0.models.UserUndefinedType(other)) } } @@ -354,7 +353,6 @@ 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) diff --git a/lib/src/test/resources/example-union-types-play-23.txt b/lib/src/test/resources/example-union-types-play-23.txt index fcd19023..03f013b0 100644 --- a/lib/src/test/resources/example-union-types-play-23.txt +++ b/lib/src/test/resources/example-union-types-play-23.txt @@ -302,7 +302,7 @@ package io.apibuilder.example.union.types.v0.models { } implicit def jsonReadsApidocExampleUnionTypesUserUuid: play.api.libs.json.Reads[UserUuid] = { - (__ \ "value").read[_root_.java.util.UUID].map { x => new UserUuid(value = x) } + (__ \ "value").read[_root_.java.util.UUID].map { x => UserUuid(value = x) } } implicit def jsonReadsApidocExampleUnionTypesFoobar: play.api.libs.json.Reads[Foobar] = { @@ -322,7 +322,6 @@ package io.apibuilder.example.union.types.v0.models { case x: io.apibuilder.example.union.types.v0.models.FoobarUndefinedType => sys.error(s"The type[io.apibuilder.example.union.types.v0.models.FoobarUndefinedType] should never be serialized") } } - implicit def jsonWritesApidocExampleUnionTypesFoobar: play.api.libs.json.Writes[Foobar] = { (obj: io.apibuilder.example.union.types.v0.models.Foobar) => { jsObjectFoobar(obj) @@ -332,9 +331,9 @@ package io.apibuilder.example.union.types.v0.models { implicit def jsonReadsApidocExampleUnionTypesUser: play.api.libs.json.Reads[User] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "registered_user" => js.validate[io.apibuilder.example.union.types.v0.models.RegisteredUser] - case "guest_user" => js.validate[io.apibuilder.example.union.types.v0.models.GuestUser] - case "uuid" => js.validate[io.apibuilder.example.union.types.v0.models.UserUuid] + case "registered_user" => jsonReadsApidocExampleUnionTypesRegisteredUser.reads(js) + case "guest_user" => jsonReadsApidocExampleUnionTypesGuestUser.reads(js) + case "uuid" => jsonReadsApidocExampleUnionTypesUuid.reads(js) case other => play.api.libs.json.JsSuccess(io.apibuilder.example.union.types.v0.models.UserUndefinedType(other)) } } @@ -354,7 +353,6 @@ 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) diff --git a/lib/src/test/resources/generators/play-2-json-spec-quality-healthcheck-readers.txt b/lib/src/test/resources/generators/play-2-json-spec-quality-healthcheck-readers.txt index 5daee860..d4651f23 100644 --- a/lib/src/test/resources/generators/play-2-json-spec-quality-healthcheck-readers.txt +++ b/lib/src/test/resources/generators/play-2-json-spec-quality-healthcheck-readers.txt @@ -1,3 +1,3 @@ implicit def jsonReadsQualityHealthcheck: play.api.libs.json.Reads[Healthcheck] = { - (__ \ "status").read[String].map { x => new Healthcheck(status = x) } -} + (__ \ "status").read[String].map { x => Healthcheck(status = x) } +} \ No newline at end of file diff --git a/lib/src/test/resources/generators/play-2-standalone-json-spec-quality.txt b/lib/src/test/resources/generators/play-2-standalone-json-spec-quality.txt index 13368a51..68ba03fb 100644 --- a/lib/src/test/resources/generators/play-2-standalone-json-spec-quality.txt +++ b/lib/src/test/resources/generators/play-2-standalone-json-spec-quality.txt @@ -776,7 +776,7 @@ package com.gilt.quality.v0.models { } implicit def jsonReadsQualityAdjournForm: play.api.libs.json.Reads[AdjournForm] = { - (__ \ "adjourned_at").readNullable[_root_.org.joda.time.DateTime].map { x => new AdjournForm(adjournedAt = x) } + (__ \ "adjourned_at").readNullable[_root_.org.joda.time.DateTime].map { x => AdjournForm(adjournedAt = x) } } def jsObjectAdjournForm(obj: com.gilt.quality.v0.models.AdjournForm): play.api.libs.json.JsObject = { @@ -839,7 +839,7 @@ package com.gilt.quality.v0.models { } implicit def jsonReadsQualityAuthenticationForm: play.api.libs.json.Reads[AuthenticationForm] = { - (__ \ "email").read[String].map { x => new AuthenticationForm(email = x) } + (__ \ "email").read[String].map { x => AuthenticationForm(email = x) } } def jsObjectAuthenticationForm(obj: com.gilt.quality.v0.models.AuthenticationForm): play.api.libs.json.JsObject = { @@ -991,7 +991,7 @@ package com.gilt.quality.v0.models { } implicit def jsonReadsQualityHealthcheck: play.api.libs.json.Reads[Healthcheck] = { - (__ \ "status").read[String].map { x => new Healthcheck(status = x) } + (__ \ "status").read[String].map { x => Healthcheck(status = x) } } def jsObjectHealthcheck(obj: com.gilt.quality.v0.models.Healthcheck): play.api.libs.json.JsObject = { @@ -1174,7 +1174,7 @@ package com.gilt.quality.v0.models { } implicit def jsonReadsQualityMeetingForm: play.api.libs.json.Reads[MeetingForm] = { - (__ \ "scheduled_at").read[_root_.org.joda.time.DateTime].map { x => new MeetingForm(scheduledAt = x) } + (__ \ "scheduled_at").read[_root_.org.joda.time.DateTime].map { x => MeetingForm(scheduledAt = x) } } def jsObjectMeetingForm(obj: com.gilt.quality.v0.models.MeetingForm): play.api.libs.json.JsObject = { @@ -1535,7 +1535,7 @@ package com.gilt.quality.v0.models { } implicit def jsonReadsQualityUserForm: play.api.libs.json.Reads[UserForm] = { - (__ \ "email").read[String].map { x => new UserForm(email = x) } + (__ \ "email").read[String].map { x => UserForm(email = x) } } def jsObjectUserForm(obj: com.gilt.quality.v0.models.UserForm): play.api.libs.json.JsObject = { diff --git a/lib/src/test/resources/generators/play-26-apidoc-api.txt b/lib/src/test/resources/generators/play-26-apidoc-api.txt index 2f07f7a0..7920b252 100644 --- a/lib/src/test/resources/generators/play-26-apidoc-api.txt +++ b/lib/src/test/resources/generators/play-26-apidoc-api.txt @@ -1096,7 +1096,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiAttributeValueForm: play.api.libs.json.Reads[AttributeValueForm] = { - (__ \ "value").read[String].map { x => new AttributeValueForm(value = x) } + (__ \ "value").read[String].map { x => AttributeValueForm(value = x) } } def jsObjectAttributeValueForm(obj: io.apibuilder.api.v0.models.AttributeValueForm): play.api.libs.json.JsObject = { @@ -1166,7 +1166,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiCleartextToken: play.api.libs.json.Reads[CleartextToken] = { - (__ \ "token").read[String].map { x => new CleartextToken(token = x) } + (__ \ "token").read[String].map { x => CleartextToken(token = x) } } def jsObjectCleartextToken(obj: io.apibuilder.api.v0.models.CleartextToken): play.api.libs.json.JsObject = { @@ -1204,7 +1204,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiDiffBreaking: play.api.libs.json.Reads[DiffBreaking] = { - (__ \ "description").read[String].map { x => new DiffBreaking(description = x) } + (__ \ "description").read[String].map { x => DiffBreaking(description = x) } } def jsObjectDiffBreaking(obj: io.apibuilder.api.v0.models.DiffBreaking): play.api.libs.json.JsObject = { @@ -1220,7 +1220,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiDiffNonBreaking: play.api.libs.json.Reads[DiffNonBreaking] = { - (__ \ "description").read[String].map { x => new DiffNonBreaking(description = x) } + (__ \ "description").read[String].map { x => DiffNonBreaking(description = x) } } def jsObjectDiffNonBreaking(obj: io.apibuilder.api.v0.models.DiffNonBreaking): play.api.libs.json.JsObject = { @@ -1236,7 +1236,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiDomain: play.api.libs.json.Reads[Domain] = { - (__ \ "name").read[String].map { x => new Domain(name = x) } + (__ \ "name").read[String].map { x => Domain(name = x) } } def jsObjectDomain(obj: io.apibuilder.api.v0.models.Domain): play.api.libs.json.JsObject = { @@ -1252,7 +1252,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiEmailVerificationConfirmationForm: play.api.libs.json.Reads[EmailVerificationConfirmationForm] = { - (__ \ "token").read[String].map { x => new EmailVerificationConfirmationForm(token = x) } + (__ \ "token").read[String].map { x => EmailVerificationConfirmationForm(token = x) } } def jsObjectEmailVerificationConfirmationForm(obj: io.apibuilder.api.v0.models.EmailVerificationConfirmationForm): play.api.libs.json.JsObject = { @@ -1330,7 +1330,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiGeneratorServiceForm: play.api.libs.json.Reads[GeneratorServiceForm] = { - (__ \ "uri").read[String].map { x => new GeneratorServiceForm(uri = x) } + (__ \ "uri").read[String].map { x => GeneratorServiceForm(uri = x) } } def jsObjectGeneratorServiceForm(obj: io.apibuilder.api.v0.models.GeneratorServiceForm): play.api.libs.json.JsObject = { @@ -1444,7 +1444,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiMoveForm: play.api.libs.json.Reads[MoveForm] = { - (__ \ "org_key").read[String].map { x => new MoveForm(orgKey = x) } + (__ \ "org_key").read[String].map { x => MoveForm(orgKey = x) } } def jsObjectMoveForm(obj: io.apibuilder.api.v0.models.MoveForm): play.api.libs.json.JsObject = { @@ -1583,7 +1583,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiPasswordResetRequest: play.api.libs.json.Reads[PasswordResetRequest] = { - (__ \ "email").read[String].map { x => new PasswordResetRequest(email = x) } + (__ \ "email").read[String].map { x => PasswordResetRequest(email = x) } } def jsObjectPasswordResetRequest(obj: io.apibuilder.api.v0.models.PasswordResetRequest): play.api.libs.json.JsObject = { @@ -1599,7 +1599,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiPasswordResetSuccess: play.api.libs.json.Reads[PasswordResetSuccess] = { - (__ \ "user_guid").read[_root_.java.util.UUID].map { x => new PasswordResetSuccess(userGuid = x) } + (__ \ "user_guid").read[_root_.java.util.UUID].map { x => PasswordResetSuccess(userGuid = x) } } def jsObjectPasswordResetSuccess(obj: io.apibuilder.api.v0.models.PasswordResetSuccess): play.api.libs.json.JsObject = { @@ -1938,8 +1938,8 @@ package io.apibuilder.api.v0.models { implicit def jsonReadsApidocApiDiff: play.api.libs.json.Reads[Diff] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "diff_breaking" => js.validate[io.apibuilder.api.v0.models.DiffBreaking] - case "diff_non_breaking" => js.validate[io.apibuilder.api.v0.models.DiffNonBreaking] + case "diff_breaking" => jsonReadsApidocApiDiffBreaking.reads(js) + case "diff_non_breaking" => jsonReadsApidocApiDiffNonBreaking.reads(js) case other => play.api.libs.json.JsSuccess(io.apibuilder.api.v0.models.DiffUndefinedType(other)) } } @@ -1958,7 +1958,6 @@ package io.apibuilder.api.v0.models { } } } - implicit def jsonWritesApidocApiDiff: play.api.libs.json.Writes[Diff] = { (obj: io.apibuilder.api.v0.models.Diff) => { jsObjectDiff(obj) @@ -1968,7 +1967,7 @@ package io.apibuilder.api.v0.models { implicit def jsonReadsApidocApiItemDetail: play.api.libs.json.Reads[ItemDetail] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "application_summary" => js.validate[io.apibuilder.api.v0.models.ApplicationSummary] + case "application_summary" => jsonReadsApidocApiApplicationSummary.reads(js) case other => play.api.libs.json.JsSuccess(io.apibuilder.api.v0.models.ItemDetailUndefinedType(other)) } } @@ -1986,7 +1985,6 @@ package io.apibuilder.api.v0.models { } } } - implicit def jsonWritesApidocApiItemDetail: play.api.libs.json.Writes[ItemDetail] = { (obj: io.apibuilder.api.v0.models.ItemDetail) => { jsObjectItemDetail(obj) diff --git a/lib/src/test/resources/generators/play-26-envelope.txt b/lib/src/test/resources/generators/play-26-envelope.txt index 2d7a0733..0376d880 100644 --- a/lib/src/test/resources/generators/play-26-envelope.txt +++ b/lib/src/test/resources/generators/play-26-envelope.txt @@ -121,18 +121,18 @@ package io.gregor.time.types.v0.models { } implicit def jsonReadsTimeTypesDateTimeUnionDateTime: play.api.libs.json.Reads[DateTimeUnionDateTime] = { - (__ \ "value").read[_root_.org.joda.time.DateTime].map { x => new DateTimeUnionDateTime(value = x) } + (__ \ "value").read[_root_.org.joda.time.DateTime].map { x => DateTimeUnionDateTime(value = x) } } implicit def jsonReadsTimeTypesDateTimeUnionLocalDate: play.api.libs.json.Reads[DateTimeUnionLocalDate] = { - (__ \ "value").read[_root_.org.joda.time.LocalDate].map { x => new DateTimeUnionLocalDate(value = x) } + (__ \ "value").read[_root_.org.joda.time.LocalDate].map { x => DateTimeUnionLocalDate(value = x) } } implicit def jsonReadsTimeTypesDateTimeUnion: play.api.libs.json.Reads[DateTimeUnion] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "date-time-iso8601" => js.validate[io.gregor.time.types.v0.models.DateTimeUnionDateTime] - case "date-iso8601" => js.validate[io.gregor.time.types.v0.models.DateTimeUnionLocalDate] + case "date-time-iso8601" => jsonReadsTimeTypesDateTimeIso8601.reads(js) + case "date-iso8601" => jsonReadsTimeTypesDateIso8601.reads(js) case other => play.api.libs.json.JsSuccess(io.gregor.time.types.v0.models.DateTimeUnionUndefinedType(other)) } } @@ -151,7 +151,6 @@ package io.gregor.time.types.v0.models { } } } - implicit def jsonWritesTimeTypesDateTimeUnion: play.api.libs.json.Writes[DateTimeUnion] = { (obj: io.gregor.time.types.v0.models.DateTimeUnion) => { jsObjectDateTimeUnion(obj) diff --git a/lib/src/test/resources/generators/play-27-apidoc-api.txt b/lib/src/test/resources/generators/play-27-apidoc-api.txt index 2f07f7a0..7920b252 100644 --- a/lib/src/test/resources/generators/play-27-apidoc-api.txt +++ b/lib/src/test/resources/generators/play-27-apidoc-api.txt @@ -1096,7 +1096,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiAttributeValueForm: play.api.libs.json.Reads[AttributeValueForm] = { - (__ \ "value").read[String].map { x => new AttributeValueForm(value = x) } + (__ \ "value").read[String].map { x => AttributeValueForm(value = x) } } def jsObjectAttributeValueForm(obj: io.apibuilder.api.v0.models.AttributeValueForm): play.api.libs.json.JsObject = { @@ -1166,7 +1166,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiCleartextToken: play.api.libs.json.Reads[CleartextToken] = { - (__ \ "token").read[String].map { x => new CleartextToken(token = x) } + (__ \ "token").read[String].map { x => CleartextToken(token = x) } } def jsObjectCleartextToken(obj: io.apibuilder.api.v0.models.CleartextToken): play.api.libs.json.JsObject = { @@ -1204,7 +1204,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiDiffBreaking: play.api.libs.json.Reads[DiffBreaking] = { - (__ \ "description").read[String].map { x => new DiffBreaking(description = x) } + (__ \ "description").read[String].map { x => DiffBreaking(description = x) } } def jsObjectDiffBreaking(obj: io.apibuilder.api.v0.models.DiffBreaking): play.api.libs.json.JsObject = { @@ -1220,7 +1220,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiDiffNonBreaking: play.api.libs.json.Reads[DiffNonBreaking] = { - (__ \ "description").read[String].map { x => new DiffNonBreaking(description = x) } + (__ \ "description").read[String].map { x => DiffNonBreaking(description = x) } } def jsObjectDiffNonBreaking(obj: io.apibuilder.api.v0.models.DiffNonBreaking): play.api.libs.json.JsObject = { @@ -1236,7 +1236,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiDomain: play.api.libs.json.Reads[Domain] = { - (__ \ "name").read[String].map { x => new Domain(name = x) } + (__ \ "name").read[String].map { x => Domain(name = x) } } def jsObjectDomain(obj: io.apibuilder.api.v0.models.Domain): play.api.libs.json.JsObject = { @@ -1252,7 +1252,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiEmailVerificationConfirmationForm: play.api.libs.json.Reads[EmailVerificationConfirmationForm] = { - (__ \ "token").read[String].map { x => new EmailVerificationConfirmationForm(token = x) } + (__ \ "token").read[String].map { x => EmailVerificationConfirmationForm(token = x) } } def jsObjectEmailVerificationConfirmationForm(obj: io.apibuilder.api.v0.models.EmailVerificationConfirmationForm): play.api.libs.json.JsObject = { @@ -1330,7 +1330,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiGeneratorServiceForm: play.api.libs.json.Reads[GeneratorServiceForm] = { - (__ \ "uri").read[String].map { x => new GeneratorServiceForm(uri = x) } + (__ \ "uri").read[String].map { x => GeneratorServiceForm(uri = x) } } def jsObjectGeneratorServiceForm(obj: io.apibuilder.api.v0.models.GeneratorServiceForm): play.api.libs.json.JsObject = { @@ -1444,7 +1444,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiMoveForm: play.api.libs.json.Reads[MoveForm] = { - (__ \ "org_key").read[String].map { x => new MoveForm(orgKey = x) } + (__ \ "org_key").read[String].map { x => MoveForm(orgKey = x) } } def jsObjectMoveForm(obj: io.apibuilder.api.v0.models.MoveForm): play.api.libs.json.JsObject = { @@ -1583,7 +1583,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiPasswordResetRequest: play.api.libs.json.Reads[PasswordResetRequest] = { - (__ \ "email").read[String].map { x => new PasswordResetRequest(email = x) } + (__ \ "email").read[String].map { x => PasswordResetRequest(email = x) } } def jsObjectPasswordResetRequest(obj: io.apibuilder.api.v0.models.PasswordResetRequest): play.api.libs.json.JsObject = { @@ -1599,7 +1599,7 @@ package io.apibuilder.api.v0.models { } implicit def jsonReadsApidocApiPasswordResetSuccess: play.api.libs.json.Reads[PasswordResetSuccess] = { - (__ \ "user_guid").read[_root_.java.util.UUID].map { x => new PasswordResetSuccess(userGuid = x) } + (__ \ "user_guid").read[_root_.java.util.UUID].map { x => PasswordResetSuccess(userGuid = x) } } def jsObjectPasswordResetSuccess(obj: io.apibuilder.api.v0.models.PasswordResetSuccess): play.api.libs.json.JsObject = { @@ -1938,8 +1938,8 @@ package io.apibuilder.api.v0.models { implicit def jsonReadsApidocApiDiff: play.api.libs.json.Reads[Diff] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "diff_breaking" => js.validate[io.apibuilder.api.v0.models.DiffBreaking] - case "diff_non_breaking" => js.validate[io.apibuilder.api.v0.models.DiffNonBreaking] + case "diff_breaking" => jsonReadsApidocApiDiffBreaking.reads(js) + case "diff_non_breaking" => jsonReadsApidocApiDiffNonBreaking.reads(js) case other => play.api.libs.json.JsSuccess(io.apibuilder.api.v0.models.DiffUndefinedType(other)) } } @@ -1958,7 +1958,6 @@ package io.apibuilder.api.v0.models { } } } - implicit def jsonWritesApidocApiDiff: play.api.libs.json.Writes[Diff] = { (obj: io.apibuilder.api.v0.models.Diff) => { jsObjectDiff(obj) @@ -1968,7 +1967,7 @@ package io.apibuilder.api.v0.models { implicit def jsonReadsApidocApiItemDetail: play.api.libs.json.Reads[ItemDetail] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "application_summary" => js.validate[io.apibuilder.api.v0.models.ApplicationSummary] + case "application_summary" => jsonReadsApidocApiApplicationSummary.reads(js) case other => play.api.libs.json.JsSuccess(io.apibuilder.api.v0.models.ItemDetailUndefinedType(other)) } } @@ -1986,7 +1985,6 @@ package io.apibuilder.api.v0.models { } } } - implicit def jsonWritesApidocApiItemDetail: play.api.libs.json.Writes[ItemDetail] = { (obj: io.apibuilder.api.v0.models.ItemDetail) => { jsObjectItemDetail(obj) diff --git a/lib/src/test/resources/generators/play-27-java-instant.txt b/lib/src/test/resources/generators/play-27-java-instant.txt index 1984d161..75ecefa6 100644 --- a/lib/src/test/resources/generators/play-27-java-instant.txt +++ b/lib/src/test/resources/generators/play-27-java-instant.txt @@ -101,18 +101,18 @@ package io.gregor.time.types.v0.models { } implicit def jsonReadsTimeTypesDateTimeUnionInstant: play.api.libs.json.Reads[DateTimeUnionInstant] = { - (__ \ "value").read[_root_.java.time.Instant].map { x => new DateTimeUnionInstant(value = x) } + (__ \ "value").read[_root_.java.time.Instant].map { x => DateTimeUnionInstant(value = x) } } implicit def jsonReadsTimeTypesDateTimeUnionLocalDate: play.api.libs.json.Reads[DateTimeUnionLocalDate] = { - (__ \ "value").read[_root_.java.time.LocalDate].map { x => new DateTimeUnionLocalDate(value = x) } + (__ \ "value").read[_root_.java.time.LocalDate].map { x => DateTimeUnionLocalDate(value = x) } } implicit def jsonReadsTimeTypesDateTimeUnion: play.api.libs.json.Reads[DateTimeUnion] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "date-time-iso8601" => js.validate[io.gregor.time.types.v0.models.DateTimeUnionInstant] - case "date-iso8601" => js.validate[io.gregor.time.types.v0.models.DateTimeUnionLocalDate] + case "date-time-iso8601" => jsonReadsTimeTypesDateTimeIso8601.reads(js) + case "date-iso8601" => jsonReadsTimeTypesDateIso8601.reads(js) case other => play.api.libs.json.JsSuccess(io.gregor.time.types.v0.models.DateTimeUnionUndefinedType(other)) } } @@ -131,7 +131,6 @@ package io.gregor.time.types.v0.models { } } } - implicit def jsonWritesTimeTypesDateTimeUnion: play.api.libs.json.Writes[DateTimeUnion] = { (obj: io.gregor.time.types.v0.models.DateTimeUnion) => { jsObjectDateTimeUnion(obj) diff --git a/lib/src/test/resources/generators/play-27-java-offsetdatetime.txt b/lib/src/test/resources/generators/play-27-java-offsetdatetime.txt index c3ceafb4..4748ab91 100644 --- a/lib/src/test/resources/generators/play-27-java-offsetdatetime.txt +++ b/lib/src/test/resources/generators/play-27-java-offsetdatetime.txt @@ -101,18 +101,18 @@ package io.gregor.time.types.v0.models { } implicit def jsonReadsTimeTypesDateTimeUnionOffsetDateTime: play.api.libs.json.Reads[DateTimeUnionOffsetDateTime] = { - (__ \ "value").read[_root_.java.time.OffsetDateTime].map { x => new DateTimeUnionOffsetDateTime(value = x) } + (__ \ "value").read[_root_.java.time.OffsetDateTime].map { x => DateTimeUnionOffsetDateTime(value = x) } } implicit def jsonReadsTimeTypesDateTimeUnionLocalDate: play.api.libs.json.Reads[DateTimeUnionLocalDate] = { - (__ \ "value").read[_root_.java.time.LocalDate].map { x => new DateTimeUnionLocalDate(value = x) } + (__ \ "value").read[_root_.java.time.LocalDate].map { x => DateTimeUnionLocalDate(value = x) } } implicit def jsonReadsTimeTypesDateTimeUnion: play.api.libs.json.Reads[DateTimeUnion] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "date-time-iso8601" => js.validate[io.gregor.time.types.v0.models.DateTimeUnionOffsetDateTime] - case "date-iso8601" => js.validate[io.gregor.time.types.v0.models.DateTimeUnionLocalDate] + case "date-time-iso8601" => jsonReadsTimeTypesDateTimeIso8601.reads(js) + case "date-iso8601" => jsonReadsTimeTypesDateIso8601.reads(js) case other => play.api.libs.json.JsSuccess(io.gregor.time.types.v0.models.DateTimeUnionUndefinedType(other)) } } @@ -131,7 +131,6 @@ package io.gregor.time.types.v0.models { } } } - implicit def jsonWritesTimeTypesDateTimeUnion: play.api.libs.json.Writes[DateTimeUnion] = { (obj: io.gregor.time.types.v0.models.DateTimeUnion) => { jsObjectDateTimeUnion(obj) diff --git a/lib/src/test/resources/generators/play-27-joda-date-time.txt b/lib/src/test/resources/generators/play-27-joda-date-time.txt index ba818e4e..8a169b47 100644 --- a/lib/src/test/resources/generators/play-27-joda-date-time.txt +++ b/lib/src/test/resources/generators/play-27-joda-date-time.txt @@ -121,18 +121,18 @@ package io.gregor.time.types.v0.models { } implicit def jsonReadsTimeTypesDateTimeUnionDateTime: play.api.libs.json.Reads[DateTimeUnionDateTime] = { - (__ \ "value").read[_root_.org.joda.time.DateTime].map { x => new DateTimeUnionDateTime(value = x) } + (__ \ "value").read[_root_.org.joda.time.DateTime].map { x => DateTimeUnionDateTime(value = x) } } implicit def jsonReadsTimeTypesDateTimeUnionLocalDate: play.api.libs.json.Reads[DateTimeUnionLocalDate] = { - (__ \ "value").read[_root_.org.joda.time.LocalDate].map { x => new DateTimeUnionLocalDate(value = x) } + (__ \ "value").read[_root_.org.joda.time.LocalDate].map { x => DateTimeUnionLocalDate(value = x) } } implicit def jsonReadsTimeTypesDateTimeUnion: play.api.libs.json.Reads[DateTimeUnion] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "date-time-iso8601" => js.validate[io.gregor.time.types.v0.models.DateTimeUnionDateTime] - case "date-iso8601" => js.validate[io.gregor.time.types.v0.models.DateTimeUnionLocalDate] + case "date-time-iso8601" => jsonReadsTimeTypesDateTimeIso8601.reads(js) + case "date-iso8601" => jsonReadsTimeTypesDateIso8601.reads(js) case other => play.api.libs.json.JsSuccess(io.gregor.time.types.v0.models.DateTimeUnionUndefinedType(other)) } } @@ -151,7 +151,6 @@ package io.gregor.time.types.v0.models { } } } - implicit def jsonWritesTimeTypesDateTimeUnion: play.api.libs.json.Writes[DateTimeUnion] = { (obj: io.gregor.time.types.v0.models.DateTimeUnion) => { jsObjectDateTimeUnion(obj) diff --git a/lib/src/test/resources/generators/play-28-java-instant.txt b/lib/src/test/resources/generators/play-28-java-instant.txt index 1984d161..75ecefa6 100644 --- a/lib/src/test/resources/generators/play-28-java-instant.txt +++ b/lib/src/test/resources/generators/play-28-java-instant.txt @@ -101,18 +101,18 @@ package io.gregor.time.types.v0.models { } implicit def jsonReadsTimeTypesDateTimeUnionInstant: play.api.libs.json.Reads[DateTimeUnionInstant] = { - (__ \ "value").read[_root_.java.time.Instant].map { x => new DateTimeUnionInstant(value = x) } + (__ \ "value").read[_root_.java.time.Instant].map { x => DateTimeUnionInstant(value = x) } } implicit def jsonReadsTimeTypesDateTimeUnionLocalDate: play.api.libs.json.Reads[DateTimeUnionLocalDate] = { - (__ \ "value").read[_root_.java.time.LocalDate].map { x => new DateTimeUnionLocalDate(value = x) } + (__ \ "value").read[_root_.java.time.LocalDate].map { x => DateTimeUnionLocalDate(value = x) } } implicit def jsonReadsTimeTypesDateTimeUnion: play.api.libs.json.Reads[DateTimeUnion] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "date-time-iso8601" => js.validate[io.gregor.time.types.v0.models.DateTimeUnionInstant] - case "date-iso8601" => js.validate[io.gregor.time.types.v0.models.DateTimeUnionLocalDate] + case "date-time-iso8601" => jsonReadsTimeTypesDateTimeIso8601.reads(js) + case "date-iso8601" => jsonReadsTimeTypesDateIso8601.reads(js) case other => play.api.libs.json.JsSuccess(io.gregor.time.types.v0.models.DateTimeUnionUndefinedType(other)) } } @@ -131,7 +131,6 @@ package io.gregor.time.types.v0.models { } } } - implicit def jsonWritesTimeTypesDateTimeUnion: play.api.libs.json.Writes[DateTimeUnion] = { (obj: io.gregor.time.types.v0.models.DateTimeUnion) => { jsObjectDateTimeUnion(obj) diff --git a/lib/src/test/resources/generators/play-28-java-offsetdatetime.txt b/lib/src/test/resources/generators/play-28-java-offsetdatetime.txt index c3ceafb4..4748ab91 100644 --- a/lib/src/test/resources/generators/play-28-java-offsetdatetime.txt +++ b/lib/src/test/resources/generators/play-28-java-offsetdatetime.txt @@ -101,18 +101,18 @@ package io.gregor.time.types.v0.models { } implicit def jsonReadsTimeTypesDateTimeUnionOffsetDateTime: play.api.libs.json.Reads[DateTimeUnionOffsetDateTime] = { - (__ \ "value").read[_root_.java.time.OffsetDateTime].map { x => new DateTimeUnionOffsetDateTime(value = x) } + (__ \ "value").read[_root_.java.time.OffsetDateTime].map { x => DateTimeUnionOffsetDateTime(value = x) } } implicit def jsonReadsTimeTypesDateTimeUnionLocalDate: play.api.libs.json.Reads[DateTimeUnionLocalDate] = { - (__ \ "value").read[_root_.java.time.LocalDate].map { x => new DateTimeUnionLocalDate(value = x) } + (__ \ "value").read[_root_.java.time.LocalDate].map { x => DateTimeUnionLocalDate(value = x) } } implicit def jsonReadsTimeTypesDateTimeUnion: play.api.libs.json.Reads[DateTimeUnion] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "date-time-iso8601" => js.validate[io.gregor.time.types.v0.models.DateTimeUnionOffsetDateTime] - case "date-iso8601" => js.validate[io.gregor.time.types.v0.models.DateTimeUnionLocalDate] + case "date-time-iso8601" => jsonReadsTimeTypesDateTimeIso8601.reads(js) + case "date-iso8601" => jsonReadsTimeTypesDateIso8601.reads(js) case other => play.api.libs.json.JsSuccess(io.gregor.time.types.v0.models.DateTimeUnionUndefinedType(other)) } } @@ -131,7 +131,6 @@ package io.gregor.time.types.v0.models { } } } - implicit def jsonWritesTimeTypesDateTimeUnion: play.api.libs.json.Writes[DateTimeUnion] = { (obj: io.gregor.time.types.v0.models.DateTimeUnion) => { jsObjectDateTimeUnion(obj) diff --git a/lib/src/test/resources/generators/play-28-joda-date-time.txt b/lib/src/test/resources/generators/play-28-joda-date-time.txt index ba818e4e..8a169b47 100644 --- a/lib/src/test/resources/generators/play-28-joda-date-time.txt +++ b/lib/src/test/resources/generators/play-28-joda-date-time.txt @@ -121,18 +121,18 @@ package io.gregor.time.types.v0.models { } implicit def jsonReadsTimeTypesDateTimeUnionDateTime: play.api.libs.json.Reads[DateTimeUnionDateTime] = { - (__ \ "value").read[_root_.org.joda.time.DateTime].map { x => new DateTimeUnionDateTime(value = x) } + (__ \ "value").read[_root_.org.joda.time.DateTime].map { x => DateTimeUnionDateTime(value = x) } } implicit def jsonReadsTimeTypesDateTimeUnionLocalDate: play.api.libs.json.Reads[DateTimeUnionLocalDate] = { - (__ \ "value").read[_root_.org.joda.time.LocalDate].map { x => new DateTimeUnionLocalDate(value = x) } + (__ \ "value").read[_root_.org.joda.time.LocalDate].map { x => DateTimeUnionLocalDate(value = x) } } implicit def jsonReadsTimeTypesDateTimeUnion: play.api.libs.json.Reads[DateTimeUnion] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "date-time-iso8601" => js.validate[io.gregor.time.types.v0.models.DateTimeUnionDateTime] - case "date-iso8601" => js.validate[io.gregor.time.types.v0.models.DateTimeUnionLocalDate] + case "date-time-iso8601" => jsonReadsTimeTypesDateTimeIso8601.reads(js) + case "date-iso8601" => jsonReadsTimeTypesDateIso8601.reads(js) case other => play.api.libs.json.JsSuccess(io.gregor.time.types.v0.models.DateTimeUnionUndefinedType(other)) } } @@ -151,7 +151,6 @@ package io.gregor.time.types.v0.models { } } } - implicit def jsonWritesTimeTypesDateTimeUnion: play.api.libs.json.Writes[DateTimeUnion] = { (obj: io.gregor.time.types.v0.models.DateTimeUnion) => { jsObjectDateTimeUnion(obj) diff --git a/lib/src/test/resources/generators/reference-spec-ning-client.txt b/lib/src/test/resources/generators/reference-spec-ning-client.txt index b2f6183b..487003b7 100644 --- a/lib/src/test/resources/generators/reference-spec-ning-client.txt +++ b/lib/src/test/resources/generators/reference-spec-ning-client.txt @@ -251,7 +251,7 @@ package io.apibuilder.reference.api.v0.models { } implicit def jsonReadsApidocReferenceApiEcho: play.api.libs.json.Reads[Echo] = { - (__ \ "value").read[String].map { x => new Echo(value = x) } + (__ \ "value").read[String].map { x => Echo(value = x) } } def jsObjectEcho(obj: io.apibuilder.reference.api.v0.models.Echo): play.api.libs.json.JsObject = { @@ -287,7 +287,7 @@ package io.apibuilder.reference.api.v0.models { } implicit def jsonReadsApidocReferenceApiGroup: play.api.libs.json.Reads[Group] = { - (__ \ "members").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => new Group(members = x) } + (__ \ "members").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => Group(members = x) } } def jsObjectGroup(obj: io.apibuilder.reference.api.v0.models.Group): play.api.libs.json.JsObject = { @@ -375,7 +375,7 @@ package io.apibuilder.reference.api.v0.models { } implicit def jsonReadsApidocReferenceApiUserList: play.api.libs.json.Reads[UserList] = { - (__ \ "users").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => new UserList(users = x) } + (__ \ "users").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => UserList(users = x) } } def jsObjectUserList(obj: io.apibuilder.reference.api.v0.models.UserList): play.api.libs.json.JsObject = { diff --git a/lib/src/test/resources/generators/reference-spec-play-23.txt b/lib/src/test/resources/generators/reference-spec-play-23.txt index 63c8e98e..b7210d27 100644 --- a/lib/src/test/resources/generators/reference-spec-play-23.txt +++ b/lib/src/test/resources/generators/reference-spec-play-23.txt @@ -251,7 +251,7 @@ package io.apibuilder.reference.api.v0.models { } implicit def jsonReadsApidocReferenceApiEcho: play.api.libs.json.Reads[Echo] = { - (__ \ "value").read[String].map { x => new Echo(value = x) } + (__ \ "value").read[String].map { x => Echo(value = x) } } def jsObjectEcho(obj: io.apibuilder.reference.api.v0.models.Echo): play.api.libs.json.JsObject = { @@ -287,7 +287,7 @@ package io.apibuilder.reference.api.v0.models { } implicit def jsonReadsApidocReferenceApiGroup: play.api.libs.json.Reads[Group] = { - (__ \ "members").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => new Group(members = x) } + (__ \ "members").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => Group(members = x) } } def jsObjectGroup(obj: io.apibuilder.reference.api.v0.models.Group): play.api.libs.json.JsObject = { @@ -375,7 +375,7 @@ package io.apibuilder.reference.api.v0.models { } implicit def jsonReadsApidocReferenceApiUserList: play.api.libs.json.Reads[UserList] = { - (__ \ "users").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => new UserList(users = x) } + (__ \ "users").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => UserList(users = x) } } def jsObjectUserList(obj: io.apibuilder.reference.api.v0.models.UserList): play.api.libs.json.JsObject = { diff --git a/lib/src/test/resources/generators/reference-with-imports-spec-ning-client.txt b/lib/src/test/resources/generators/reference-with-imports-spec-ning-client.txt index 5eb9fdfd..fde80c08 100644 --- a/lib/src/test/resources/generators/reference-with-imports-spec-ning-client.txt +++ b/lib/src/test/resources/generators/reference-with-imports-spec-ning-client.txt @@ -252,7 +252,7 @@ package io.apibuilder.reference.api.v0.models { } implicit def jsonReadsApidocReferenceApiEcho: play.api.libs.json.Reads[Echo] = { - (__ \ "value").read[String].map { x => new Echo(value = x) } + (__ \ "value").read[String].map { x => Echo(value = x) } } def jsObjectEcho(obj: io.apibuilder.reference.api.v0.models.Echo): play.api.libs.json.JsObject = { @@ -288,7 +288,7 @@ package io.apibuilder.reference.api.v0.models { } implicit def jsonReadsApidocReferenceApiGroup: play.api.libs.json.Reads[Group] = { - (__ \ "members").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => new Group(members = x) } + (__ \ "members").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => Group(members = x) } } def jsObjectGroup(obj: io.apibuilder.reference.api.v0.models.Group): play.api.libs.json.JsObject = { @@ -376,7 +376,7 @@ package io.apibuilder.reference.api.v0.models { } implicit def jsonReadsApidocReferenceApiUserList: play.api.libs.json.Reads[UserList] = { - (__ \ "users").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => new UserList(users = x) } + (__ \ "users").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => UserList(users = x) } } def jsObjectUserList(obj: io.apibuilder.reference.api.v0.models.UserList): play.api.libs.json.JsObject = { diff --git a/lib/src/test/resources/generators/reference-with-imports-spec-play-23.txt b/lib/src/test/resources/generators/reference-with-imports-spec-play-23.txt index 8d874967..8ea1232b 100644 --- a/lib/src/test/resources/generators/reference-with-imports-spec-play-23.txt +++ b/lib/src/test/resources/generators/reference-with-imports-spec-play-23.txt @@ -252,7 +252,7 @@ package io.apibuilder.reference.api.v0.models { } implicit def jsonReadsApidocReferenceApiEcho: play.api.libs.json.Reads[Echo] = { - (__ \ "value").read[String].map { x => new Echo(value = x) } + (__ \ "value").read[String].map { x => Echo(value = x) } } def jsObjectEcho(obj: io.apibuilder.reference.api.v0.models.Echo): play.api.libs.json.JsObject = { @@ -288,7 +288,7 @@ package io.apibuilder.reference.api.v0.models { } implicit def jsonReadsApidocReferenceApiGroup: play.api.libs.json.Reads[Group] = { - (__ \ "members").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => new Group(members = x) } + (__ \ "members").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => Group(members = x) } } def jsObjectGroup(obj: io.apibuilder.reference.api.v0.models.Group): play.api.libs.json.JsObject = { @@ -376,7 +376,7 @@ package io.apibuilder.reference.api.v0.models { } implicit def jsonReadsApidocReferenceApiUserList: play.api.libs.json.Reads[UserList] = { - (__ \ "users").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => new UserList(users = x) } + (__ \ "users").read[Seq[io.apibuilder.reference.api.v0.models.User]].map { x => UserList(users = x) } } def jsObjectUserList(obj: io.apibuilder.reference.api.v0.models.UserList): play.api.libs.json.JsObject = { diff --git a/lib/src/test/resources/scala-union-enums-json.txt b/lib/src/test/resources/scala-union-enums-json.txt index 13d2db87..7261e307 100644 --- a/lib/src/test/resources/scala-union-enums-json.txt +++ b/lib/src/test/resources/scala-union-enums-json.txt @@ -15,7 +15,6 @@ def jsObjectUserType(obj: test.apidoc.apidoctest.v0.models.UserType): play.api.l case x: test.apidoc.apidoctest.v0.models.UserTypeUndefinedType => sys.error(s"The type[test.apidoc.apidoctest.v0.models.UserTypeUndefinedType] should never be serialized") } } - implicit def jsonWritesAPIBuilderTestUserType: play.api.libs.json.Writes[UserType] = { (obj: test.apidoc.apidoctest.v0.models.UserType) => { jsObjectUserType(obj) diff --git a/lib/src/test/resources/scala-union-models-json-union-type-writers.txt b/lib/src/test/resources/scala-union-models-json-union-type-writers.txt index 57882978..788ce39d 100644 --- a/lib/src/test/resources/scala-union-models-json-union-type-writers.txt +++ b/lib/src/test/resources/scala-union-models-json-union-type-writers.txt @@ -5,7 +5,6 @@ def jsObjectUser(obj: test.apidoc.apidoctest.v0.models.User): play.api.libs.json case x: test.apidoc.apidoctest.v0.models.UserUndefinedType => sys.error(s"The type[test.apidoc.apidoctest.v0.models.UserUndefinedType] should never be serialized") } } - implicit def jsonWritesAPIBuilderTestUser: play.api.libs.json.Writes[User] = { (obj: test.apidoc.apidoctest.v0.models.User) => { jsObjectUser(obj) diff --git a/lib/src/test/resources/scala-union-models-json.txt b/lib/src/test/resources/scala-union-models-json.txt index a9d39488..b49b6ccd 100644 --- a/lib/src/test/resources/scala-union-models-json.txt +++ b/lib/src/test/resources/scala-union-models-json.txt @@ -67,7 +67,6 @@ def jsObjectUser(obj: test.apidoc.apidoctest.v0.models.User): play.api.libs.json case x: test.apidoc.apidoctest.v0.models.UserUndefinedType => sys.error(s"The type[test.apidoc.apidoctest.v0.models.UserUndefinedType] should never be serialized") } } - implicit def jsonWritesAPIBuilderTestUser: play.api.libs.json.Writes[User] = { (obj: test.apidoc.apidoctest.v0.models.User) => { jsObjectUser(obj) diff --git a/lib/src/test/resources/union-types-discriminator-service-play-24.txt b/lib/src/test/resources/union-types-discriminator-service-play-24.txt index 75662fe8..c531d63e 100644 --- a/lib/src/test/resources/union-types-discriminator-service-play-24.txt +++ b/lib/src/test/resources/union-types-discriminator-service-play-24.txt @@ -224,16 +224,16 @@ package io.apibuilder.example.union.types.discriminator.v0.models { } implicit def jsonReadsApidocExampleUnionTypesDiscriminatorUserString: play.api.libs.json.Reads[UserString] = { - (__ \ "value").read[String].map { x => new UserString(value = x) } + (__ \ "value").read[String].map { x => UserString(value = x) } } implicit def jsonReadsApidocExampleUnionTypesDiscriminatorUser: play.api.libs.json.Reads[User] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "registered_user" => js.validate[io.apibuilder.example.union.types.discriminator.v0.models.RegisteredUser] - case "guest_user" => js.validate[io.apibuilder.example.union.types.discriminator.v0.models.GuestUser] - case "system_user" => js.validate[io.apibuilder.example.union.types.discriminator.v0.models.SystemUser] - case "string" => js.validate[io.apibuilder.example.union.types.discriminator.v0.models.UserString] + case "registered_user" => jsonReadsApidocExampleUnionTypesDiscriminatorRegisteredUser.reads(js) + case "guest_user" => jsonReadsApidocExampleUnionTypesDiscriminatorGuestUser.reads(js) + case "system_user" => jsonReadsApidocExampleUnionTypesDiscriminatorSystemUser.reads(js) + case "string" => jsonReadsApidocExampleUnionTypesDiscriminatorString.reads(js) case other => play.api.libs.json.JsSuccess(io.apibuilder.example.union.types.discriminator.v0.models.UserUndefinedType(other)) } } @@ -254,7 +254,6 @@ package io.apibuilder.example.union.types.discriminator.v0.models { } } } - implicit def jsonWritesApidocExampleUnionTypesDiscriminatorUser: play.api.libs.json.Writes[User] = { (obj: io.apibuilder.example.union.types.discriminator.v0.models.User) => { jsObjectUser(obj) diff --git a/lib/src/test/resources/union-types-discriminator-service-play-27.txt b/lib/src/test/resources/union-types-discriminator-service-play-27.txt index 5420cd4a..8db79af9 100644 --- a/lib/src/test/resources/union-types-discriminator-service-play-27.txt +++ b/lib/src/test/resources/union-types-discriminator-service-play-27.txt @@ -224,16 +224,16 @@ package io.apibuilder.example.union.types.discriminator.v0.models { } implicit def jsonReadsApidocExampleUnionTypesDiscriminatorUserString: play.api.libs.json.Reads[UserString] = { - (__ \ "value").read[String].map { x => new UserString(value = x) } + (__ \ "value").read[String].map { x => UserString(value = x) } } implicit def jsonReadsApidocExampleUnionTypesDiscriminatorUser: play.api.libs.json.Reads[User] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "registered_user" => js.validate[io.apibuilder.example.union.types.discriminator.v0.models.RegisteredUser] - case "guest_user" => js.validate[io.apibuilder.example.union.types.discriminator.v0.models.GuestUser] - case "system_user" => js.validate[io.apibuilder.example.union.types.discriminator.v0.models.SystemUser] - case "string" => js.validate[io.apibuilder.example.union.types.discriminator.v0.models.UserString] + case "registered_user" => jsonReadsApidocExampleUnionTypesDiscriminatorRegisteredUser.reads(js) + case "guest_user" => jsonReadsApidocExampleUnionTypesDiscriminatorGuestUser.reads(js) + case "system_user" => jsonReadsApidocExampleUnionTypesDiscriminatorSystemUser.reads(js) + case "string" => jsonReadsApidocExampleUnionTypesDiscriminatorString.reads(js) case other => play.api.libs.json.JsSuccess(io.apibuilder.example.union.types.discriminator.v0.models.UserUndefinedType(other)) } } @@ -254,7 +254,6 @@ package io.apibuilder.example.union.types.discriminator.v0.models { } } } - implicit def jsonWritesApidocExampleUnionTypesDiscriminatorUser: play.api.libs.json.Writes[User] = { (obj: io.apibuilder.example.union.types.discriminator.v0.models.User) => { jsObjectUser(obj)