From 3e87685a8e469b913aa5447eba5abbb6ecd0554c Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 2 Jul 2024 17:24:32 -0400 Subject: [PATCH 01/95] wip --- build.sbt | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/build.sbt b/build.sbt index 1cb0deebc..cf57dd954 100644 --- a/build.sbt +++ b/build.sbt @@ -4,20 +4,11 @@ name := "apibuilder" organization := "io.apibuilder" -ThisBuild / scalaVersion := "2.13.14" - -//ThisBuild / javacOptions ++= Seq("-source", "17", "-target", "17") +ThisBuild / scalaVersion := "3.4.2" lazy val allScalacOptions = Seq( - "-deprecation", "-feature", - "-Xfatal-warnings", - "-unchecked", - "-Xcheckinit", - "-Xlint:adapted-args", - "-Ypatmat-exhaust-depth", "100", // Fixes: Exhaustivity analysis reached max recursion depth, not all missing cases are reported. - "-Wconf:src=generated/.*:silent", - "-Wconf:src=target/.*:silent", // silence the unused imports errors generated by the Play Routes + "-Xfatal-warnings" ) lazy val lib = project @@ -105,7 +96,7 @@ lazy val api = project routesImport += "io.apibuilder.common.v0.Bindables.Models._", routesGenerator := InjectedRoutesGenerator, resolvers += "Scalaz Bintray Repo" at "https://dl.bintray.com/scalaz/releases", - resolvers += "Artifactory" at "https://flow.jfrog.io/flow/libs-release", + resolvers += "jitpack" at "https://jitpack.io", libraryDependencies ++= Seq( filters, jdbc, @@ -118,7 +109,7 @@ lazy val api = project "org.postgresql" % "postgresql" % "42.7.3", "org.mindrot" % "jbcrypt" % "0.4", "com.sendgrid" % "sendgrid-java" % "4.10.2", - "io.flow" %% "lib-postgresql-play-play28" % "0.5.53", + "com.github.mbryzek" % "lib-query" % "0.0.1", "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test, "com.github.tomakehurst" % "wiremock-standalone" % "3.0.1" % Test ), From 9583ca4f0fa6c70481d42de76f5244581bd90230 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 2 Jul 2024 17:27:06 -0400 Subject: [PATCH 02/95] wip --- TODO | 2 +- api/app/controllers/Code.scala | 4 ++-- .../PsqlApibuilderGeneratorInvocationsDao.scala | 4 ++-- api/app/db/generated/PsqlApibuilderTasksDao.scala | 4 ++-- api/app/lib/ExampleJson.scala | 2 +- api/app/lib/ServiceDiff.scala | 4 ++-- build.sbt | 10 +++++----- .../builder/api_json/templates/TemplateMerge.scala | 2 +- core/src/test/scala/helpers/ValidatedTestHelpers.scala | 4 ++-- generated/app/ApicollectiveApibuilderApiV0Client.scala | 2 +- .../app/ApicollectiveApibuilderCommonV0Client.scala | 2 +- .../app/ApicollectiveApibuilderGeneratorV0Client.scala | 2 +- .../app/ApicollectiveApibuilderSpecV0Client.scala | 2 +- .../app/ApicollectiveApibuilderTaskV0Client.scala | 2 +- lib/src/test/scala/helpers/ValidatedTestHelpers.scala | 4 ++-- project/plugins.sbt | 2 +- .../src/main/scala/io/apibuilder/swagger/Parser.scala | 2 +- .../src/main/scala/io/apibuilder/swagger/Util.scala | 2 +- 18 files changed, 28 insertions(+), 28 deletions(-) diff --git a/TODO b/TODO index d178ee5a2..e3678faac 100644 --- a/TODO +++ b/TODO @@ -27,7 +27,7 @@ inserting duplicate records. API changes - generate history of field reordering [warn] /web/apidoc/api/app/db/generators/ServicesDao.scala:118: method apply in trait WithResult is deprecated: Use [[fold]], [[foldWhile]] or [[withResult]] instead, which manages resources and memory -[warn] SQL(sql).on(bind: _*)().toList.map { fromRow(_) }.toSeq +[warn] SQL(sql).on(bind*)().toList.map { fromRow(_) }.toSeq Consider supporting (from swagger): - parameter locations: header, cookie diff --git a/api/app/controllers/Code.scala b/api/app/controllers/Code.scala index 96f30614c..4ed0e6e89 100644 --- a/api/app/controllers/Code.scala +++ b/api/app/controllers/Code.scala @@ -132,7 +132,7 @@ class Code @Inject() ( @nowarn private def _invoke( - request: AnonymousRequest[_], + request: AnonymousRequest[?], params: CodeParams, data: InvocationFormData, generatorKey: String @@ -189,7 +189,7 @@ class Code @Inject() ( } private def invocationForm[T]( - request: AnonymousRequest[_], + request: AnonymousRequest[?], params: CodeParams ): Either[Seq[String], InvocationFormData] = { versionsDao.findVersion(request.authorization, params.orgKey, params.applicationKey, params.versionName) match { diff --git a/api/app/db/generated/PsqlApibuilderGeneratorInvocationsDao.scala b/api/app/db/generated/PsqlApibuilderGeneratorInvocationsDao.scala index 052b1e484..ed291fe3b 100644 --- a/api/app/db/generated/PsqlApibuilderGeneratorInvocationsDao.scala +++ b/api/app/db/generated/PsqlApibuilderGeneratorInvocationsDao.scala @@ -232,7 +232,7 @@ class GeneratorInvocationsDao @Inject() ( if (forms.nonEmpty) { val ids = forms.map(_ => randomId()) val params = ids.zip(forms).map { case (id, form) => toNamedParameter(updatedBy, id, form) } - BatchSql(InsertQuery.sql(), params.head, params.tail: _*).execute()(c) + BatchSql(InsertQuery.sql(), params.head, params.tail*).execute()(c) ids } else { Nil @@ -278,7 +278,7 @@ class GeneratorInvocationsDao @Inject() ( def updateBatchWithConnection(c: Connection, updatedBy: UUID, idsAndForms: Seq[(String, GeneratorInvocationForm)]): Unit = { if (idsAndForms.nonEmpty) { val params = idsAndForms.map { case (id, form) => toNamedParameter(updatedBy, id, form) } - BatchSql(UpdateQuery.sql(), params.head, params.tail: _*).execute()(c) + BatchSql(UpdateQuery.sql(), params.head, params.tail*).execute()(c) () } } diff --git a/api/app/db/generated/PsqlApibuilderTasksDao.scala b/api/app/db/generated/PsqlApibuilderTasksDao.scala index 8e7334734..e3f31c7c2 100644 --- a/api/app/db/generated/PsqlApibuilderTasksDao.scala +++ b/api/app/db/generated/PsqlApibuilderTasksDao.scala @@ -403,7 +403,7 @@ class TasksDao @Inject() ( def upsertBatchByTypeIdAndType(c: Connection, updatedBy: UUID, forms: Seq[TaskForm]): Unit = { if (forms.nonEmpty) { val params = forms.map(toNamedParameter(updatedBy, _)) - BatchSql(UpsertQuery.sql(), params.head, params.tail: _*).execute()(c) + BatchSql(UpsertQuery.sql(), params.head, params.tail*).execute()(c) () } } @@ -447,7 +447,7 @@ class TasksDao @Inject() ( def updateBatchWithConnection(c: Connection, updatedBy: UUID, forms: Seq[TaskForm]): Unit = { if (forms.nonEmpty) { val params = forms.map(toNamedParameter(updatedBy, _)) - BatchSql(UpdateQuery.sql(), params.head, params.tail: _*).execute()(c) + BatchSql(UpdateQuery.sql(), params.head, params.tail*).execute()(c) () } } diff --git a/api/app/lib/ExampleJson.scala b/api/app/lib/ExampleJson.scala index be1582ec8..39403c3a4 100644 --- a/api/app/lib/ExampleJson.scala +++ b/api/app/lib/ExampleJson.scala @@ -67,7 +67,7 @@ case class ExampleJson(service: Service, selection: Selection) { filter { f => selection == Selection.All || f.required }. map { field => (field.name, mockValue(field, typeAcc)) - }: _* + }* ) ) diff --git a/api/app/lib/ServiceDiff.scala b/api/app/lib/ServiceDiff.scala index b4ce00ad8..a300d0a4d 100644 --- a/api/app/lib/ServiceDiff.scala +++ b/api/app/lib/ServiceDiff.scala @@ -708,8 +708,8 @@ case class ServiceDiff( } def diffAttributes(prefix: String, a: Seq[Attribute], b: Seq[Attribute]): Seq[Diff] = { - val aMap = Map(a map ( attr => attr.name -> attr ): _*) - val bMap = Map(b map ( attr => attr.name -> attr ): _*) + val aMap = Map(a map ( attr => attr.name -> attr )*) + val bMap = Map(b map ( attr => attr.name -> attr )*) val aNames = aMap.keys.toSeq val bNames = bMap.keys.toSeq diff --git a/build.sbt b/build.sbt index cf57dd954..115358e52 100644 --- a/build.sbt +++ b/build.sbt @@ -13,7 +13,7 @@ lazy val allScalacOptions = Seq( lazy val lib = project .in(file("lib")) - .settings(commonSettings: _*) + .settings(commonSettings*) val avroVersion = "1.11.1" @@ -59,7 +59,7 @@ lazy val core = project .in(file("core")) .dependsOn(generated, lib, avro, swagger) .aggregate(generated, lib) - .settings(commonSettings: _*) + .settings(commonSettings*) .settings( resolvers += "Typesafe Maven Repository" at "https://repo.typesafe.com/typesafe/maven-releases/", libraryDependencies ++= Seq( @@ -73,7 +73,7 @@ lazy val core = project lazy val generated = project .in(file("generated")) .enablePlugins(PlayScala) - .settings(commonSettings: _*) + .settings(commonSettings*) .settings( libraryDependencies ++= Seq( ws @@ -85,7 +85,7 @@ lazy val api = project .dependsOn(generated, core % "compile->compile;test->test") .aggregate(generated, core) .enablePlugins(PlayScala, JavaAgent) - .settings(commonSettings: _*) + .settings(commonSettings*) .settings( scalacOptions ++= allScalacOptions, PlayKeys.fileWatchService := play.dev.filewatch.FileWatchService.jdk7(play.sbt.run.toLoggerProxy(sLog.value)), @@ -126,7 +126,7 @@ lazy val app = project .dependsOn(generated, lib) .aggregate(generated, lib) .enablePlugins(PlayScala, JavaAgent, SbtTwirl) - .settings(commonSettings: _*) + .settings(commonSettings*) .settings( scalacOptions ++= allScalacOptions, PlayKeys.fileWatchService := play.dev.filewatch.FileWatchService.jdk7(play.sbt.run.toLoggerProxy(sLog.value)), diff --git a/core/src/main/scala/core/builder/api_json/templates/TemplateMerge.scala b/core/src/main/scala/core/builder/api_json/templates/TemplateMerge.scala index 30147ce66..5e876d0d1 100644 --- a/core/src/main/scala/core/builder/api_json/templates/TemplateMerge.scala +++ b/core/src/main/scala/core/builder/api_json/templates/TemplateMerge.scala @@ -66,7 +66,7 @@ private[templates] abstract class TemplateMerge[T](templates: Map[String, T]) { remaining.toList match { case Nil if first.isEmpty => None case Nil => Some(first) - case one :: rest => union((first ++ one).distinct, rest: _*) + case one :: rest => union((first ++ one).distinct, rest*) } } } diff --git a/core/src/test/scala/helpers/ValidatedTestHelpers.scala b/core/src/test/scala/helpers/ValidatedTestHelpers.scala index ad202742d..90697e64d 100644 --- a/core/src/test/scala/helpers/ValidatedTestHelpers.scala +++ b/core/src/test/scala/helpers/ValidatedTestHelpers.scala @@ -5,14 +5,14 @@ import cats.data.ValidatedNec trait ValidatedTestHelpers { - def expectValid[T](r: ValidatedNec[_, T]): T = { + def expectValid[T](r: ValidatedNec[?, T]): T = { r match { case Valid(o) => o case Invalid(errors) => sys.error(s"Expected valid but was invalid: ${errors.toNonEmptyList}") } } - def expectInvalid[T](r: ValidatedNec[T, _]): Seq[T] = { + def expectInvalid[T](r: ValidatedNec[T, ?]): Seq[T] = { r match { case Valid(_) => sys.error("Expected invalid but was valid") case Invalid(errors) => errors.toNonEmptyList.toList diff --git a/generated/app/ApicollectiveApibuilderApiV0Client.scala b/generated/app/ApicollectiveApibuilderApiV0Client.scala index 91062f589..2de9cc84e 100644 --- a/generated/app/ApicollectiveApibuilderApiV0Client.scala +++ b/generated/app/ApicollectiveApibuilderApiV0Client.scala @@ -3725,7 +3725,7 @@ package io.apibuilder.api.v0 { "User-Agent" -> Constants.UserAgent, "X-Apidoc-Version" -> Constants.Version, "X-Apidoc-Version-Major" -> Constants.VersionMajor.toString - ).addHttpHeaders(defaultHeaders : _*) + ).addHttpHeaders(defaultHeaders *) auth.fold(holder) { case Authorization.Basic(username, password) => { holder.withAuth(username, password.getOrElse(""), play.api.libs.ws.WSAuthScheme.BASIC) diff --git a/generated/app/ApicollectiveApibuilderCommonV0Client.scala b/generated/app/ApicollectiveApibuilderCommonV0Client.scala index c97ed39a7..bc8837a7b 100644 --- a/generated/app/ApicollectiveApibuilderCommonV0Client.scala +++ b/generated/app/ApicollectiveApibuilderCommonV0Client.scala @@ -350,7 +350,7 @@ package io.apibuilder.common.v0 { "User-Agent" -> Constants.UserAgent, "X-Apidoc-Version" -> Constants.Version, "X-Apidoc-Version-Major" -> Constants.VersionMajor.toString - ).addHttpHeaders(defaultHeaders : _*) + ).addHttpHeaders(defaultHeaders *) auth.fold(holder) { case Authorization.Basic(username, password) => { holder.withAuth(username, password.getOrElse(""), play.api.libs.ws.WSAuthScheme.BASIC) diff --git a/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala b/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala index c7a40ceb6..e5329a73b 100644 --- a/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala +++ b/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala @@ -573,7 +573,7 @@ package io.apibuilder.generator.v0 { "User-Agent" -> Constants.UserAgent, "X-Apidoc-Version" -> Constants.Version, "X-Apidoc-Version-Major" -> Constants.VersionMajor.toString - ).addHttpHeaders(defaultHeaders : _*) + ).addHttpHeaders(defaultHeaders *) auth.fold(holder) { case Authorization.Basic(username, password) => { holder.withAuth(username, password.getOrElse(""), play.api.libs.ws.WSAuthScheme.BASIC) diff --git a/generated/app/ApicollectiveApibuilderSpecV0Client.scala b/generated/app/ApicollectiveApibuilderSpecV0Client.scala index ee6572087..b5c2c69c8 100644 --- a/generated/app/ApicollectiveApibuilderSpecV0Client.scala +++ b/generated/app/ApicollectiveApibuilderSpecV0Client.scala @@ -1579,7 +1579,7 @@ package io.apibuilder.spec.v0 { "User-Agent" -> Constants.UserAgent, "X-Apidoc-Version" -> Constants.Version, "X-Apidoc-Version-Major" -> Constants.VersionMajor.toString - ).addHttpHeaders(defaultHeaders : _*) + ).addHttpHeaders(defaultHeaders *) auth.fold(holder) { case Authorization.Basic(username, password) => { holder.withAuth(username, password.getOrElse(""), play.api.libs.ws.WSAuthScheme.BASIC) diff --git a/generated/app/ApicollectiveApibuilderTaskV0Client.scala b/generated/app/ApicollectiveApibuilderTaskV0Client.scala index 932816769..9f7fca241 100644 --- a/generated/app/ApicollectiveApibuilderTaskV0Client.scala +++ b/generated/app/ApicollectiveApibuilderTaskV0Client.scala @@ -493,7 +493,7 @@ package io.apibuilder.task.v0 { "User-Agent" -> Constants.UserAgent, "X-Apidoc-Version" -> Constants.Version, "X-Apidoc-Version-Major" -> Constants.VersionMajor.toString - ).addHttpHeaders(defaultHeaders : _*) + ).addHttpHeaders(defaultHeaders *) auth.fold(holder) { case Authorization.Basic(username, password) => { holder.withAuth(username, password.getOrElse(""), play.api.libs.ws.WSAuthScheme.BASIC) diff --git a/lib/src/test/scala/helpers/ValidatedTestHelpers.scala b/lib/src/test/scala/helpers/ValidatedTestHelpers.scala index ad202742d..90697e64d 100644 --- a/lib/src/test/scala/helpers/ValidatedTestHelpers.scala +++ b/lib/src/test/scala/helpers/ValidatedTestHelpers.scala @@ -5,14 +5,14 @@ import cats.data.ValidatedNec trait ValidatedTestHelpers { - def expectValid[T](r: ValidatedNec[_, T]): T = { + def expectValid[T](r: ValidatedNec[?, T]): T = { r match { case Valid(o) => o case Invalid(errors) => sys.error(s"Expected valid but was invalid: ${errors.toNonEmptyList}") } } - def expectInvalid[T](r: ValidatedNec[T, _]): Seq[T] = { + def expectInvalid[T](r: ValidatedNec[T, ?]): Seq[T] = { r match { case Valid(_) => sys.error("Expected invalid but was valid") case Invalid(errors) => errors.toNonEmptyList.toList diff --git a/project/plugins.sbt b/project/plugins.sbt index d09611587..9bab3c9be 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -7,7 +7,7 @@ resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releas // Use the Play sbt plugin for Play projects addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.9.4") -addSbtPlugin("com.typesafe.play" % "sbt-twirl" % "1.6.7") +addSbtPlugin("com.typesafe.play" % "sbt-twirl" % "1.6.8") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1") diff --git a/swagger/src/main/scala/io/apibuilder/swagger/Parser.scala b/swagger/src/main/scala/io/apibuilder/swagger/Parser.scala index df83664aa..ed9f541d7 100644 --- a/swagger/src/main/scala/io/apibuilder/swagger/Parser.scala +++ b/swagger/src/main/scala/io/apibuilder/swagger/Parser.scala @@ -229,7 +229,7 @@ case class Parser(config: ServiceConfiguration) { plural = Text.pluralize(enumTypeName), description = None, deprecation = None, - values = param.asInstanceOf[AbstractSerializableParameter[_]].getEnum.asScala.map { value => + values = param.asInstanceOf[AbstractSerializableParameter[?]].getEnum.asScala.map { value => EnumValue(name = value, description = None, deprecation = None, attributes = Seq()) }.toSeq, attributes = Seq(), diff --git a/swagger/src/main/scala/io/apibuilder/swagger/Util.scala b/swagger/src/main/scala/io/apibuilder/swagger/Util.scala index 84891648b..134b7621c 100644 --- a/swagger/src/main/scala/io/apibuilder/swagger/Util.scala +++ b/swagger/src/main/scala/io/apibuilder/swagger/Util.scala @@ -112,7 +112,7 @@ object Util { def hasStringEnum(param: swaggerparams.Parameter): Boolean = { (param.isInstanceOf[swaggerparams.PathParameter] || param.isInstanceOf[swaggerparams.QueryParameter]) && { param match { - case enumerableParam: swaggerparams.AbstractSerializableParameter[_] => + case enumerableParam: swaggerparams.AbstractSerializableParameter[?] => enumerableParam.getType.equals(swaggerproperties.StringProperty.TYPE) && enumerableParam.getEnum != null && !enumerableParam.getEnum.isEmpty From 620156cdf7ede7a29dfb59c8454c3add7cba00a5 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 2 Jul 2024 17:31:36 -0400 Subject: [PATCH 03/95] wip --- .apibuilder/.tracked_files | 20 +- .apibuilder/config | 12 +- ...collectiveApibuilderApiV0Conversions.scala | 22 +- .../ApicollectiveApibuilderApiV0Parsers.scala | 100 +++- api/conf/routes | 8 +- build.sbt | 2 +- ...icollectiveApibuilderApiJsonV0Models.scala | 54 +-- .../ApicollectiveApibuilderApiV0Client.scala | 458 +++++++++++++----- ...picollectiveApibuilderCommonV0Client.scala | 41 +- ...ollectiveApibuilderGeneratorV0Client.scala | 45 +- .../ApicollectiveApibuilderSpecV0Client.scala | 106 ++-- .../ApicollectiveApibuilderTaskV0Client.scala | 86 ++-- 12 files changed, 628 insertions(+), 326 deletions(-) diff --git a/.apibuilder/.tracked_files b/.apibuilder/.tracked_files index 1d8610353..6452dd836 100644 --- a/.apibuilder/.tracked_files +++ b/.apibuilder/.tracked_files @@ -4,39 +4,39 @@ apicollective: anorm_2_8_parsers: - api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala - api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala - play_2_8_client: + play_2_9_scala_3_client: - generated/app/ApicollectiveApibuilderApiV0Client.scala play_2_x_routes: - api/conf/routes apibuilder-api-json: - play_2_x_json: + play_2_x_scala_3_json: - core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala apibuilder-common: anorm_2_8_parsers: - api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala - api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala - play_2_8_client: - - generated/app/ApicollectiveApibuilderCommonV0Client.scala play_2_8_mock_client: - generated/app/ApicollectiveApibuilderCommonV0MockClient.scala + play_2_9_scala_3_client: + - generated/app/ApicollectiveApibuilderCommonV0Client.scala apibuilder-generator: anorm_2_8_parsers: - api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala - api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala - play_2_8_client: - - generated/app/ApicollectiveApibuilderGeneratorV0Client.scala play_2_8_mock_client: - generated/app/ApicollectiveApibuilderGeneratorV0MockClient.scala + play_2_9_scala_3_client: + - generated/app/ApicollectiveApibuilderGeneratorV0Client.scala apibuilder-spec: anorm_2_8_parsers: - api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala - api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala - play_2_8_client: - - generated/app/ApicollectiveApibuilderSpecV0Client.scala play_2_8_mock_client: - generated/app/ApicollectiveApibuilderSpecV0MockClient.scala + play_2_9_scala_3_client: + - generated/app/ApicollectiveApibuilderSpecV0Client.scala apibuilder-task: - play_2_8_client: - - generated/app/ApicollectiveApibuilderTaskV0Client.scala play_2_8_mock_client: - generated/app/ApicollectiveApibuilderTaskV0MockClient.scala + play_2_9_scala_3_client: + - generated/app/ApicollectiveApibuilderTaskV0Client.scala diff --git a/.apibuilder/config b/.apibuilder/config index 54463cb61..37a7be97a 100644 --- a/.apibuilder/config +++ b/.apibuilder/config @@ -3,34 +3,34 @@ code: apibuilder-api: version: latest generators: - play_2_8_client: generated/app + play_2_9_scala_3_client: generated/app play_2_x_routes: api/conf/routes anorm_2_8_parsers: api/app/generated apibuilder-api-json: version: latest generators: - play_2_x_json: core/src/main/scala/core/generated + play_2_x_scala_3_json: core/src/main/scala/core/generated apibuilder-spec: version: latest generators: - play_2_8_client: generated/app + play_2_9_scala_3_client: generated/app play_2_8_mock_client: generated/app anorm_2_8_parsers: api/app/generated apibuilder-common: version: latest generators: - play_2_8_client: generated/app + play_2_9_scala_3_client: generated/app play_2_8_mock_client: generated/app anorm_2_8_parsers: api/app/generated apibuilder-generator: version: latest generators: - play_2_8_client: generated/app + play_2_9_scala_3_client: generated/app play_2_8_mock_client: generated/app anorm_2_8_parsers: api/app/generated apibuilder-task: version: latest generators: - play_2_8_client: generated/app + play_2_9_scala_3_client: generated/app play_2_8_mock_client: generated/app diff --git a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala index 50ab262fa..8ca56306b 100644 --- a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/anorm_2_8_parsers + * Service version: 0.16.48 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/anorm_2_8_parsers */ package io.apibuilder.api.v0.anorm.conversions { @@ -55,6 +55,8 @@ package io.apibuilder.api.v0.anorm.conversions { import io.apibuilder.api.v0.models.json._ implicit val columnToSeqApibuilderApiAppSortBy: Column[Seq[_root_.io.apibuilder.api.v0.models.AppSortBy]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.AppSortBy]] } implicit val columnToMapApibuilderApiAppSortBy: Column[Map[String, _root_.io.apibuilder.api.v0.models.AppSortBy]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.AppSortBy]] } + implicit val columnToSeqApibuilderApiBatchStatus: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchStatus]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchStatus]] } + implicit val columnToMapApibuilderApiBatchStatus: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchStatus]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchStatus]] } implicit val columnToSeqApibuilderApiOriginalType: Column[Seq[_root_.io.apibuilder.api.v0.models.OriginalType]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.OriginalType]] } implicit val columnToMapApibuilderApiOriginalType: Column[Map[String, _root_.io.apibuilder.api.v0.models.OriginalType]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.OriginalType]] } implicit val columnToSeqApibuilderApiPublication: Column[Seq[_root_.io.apibuilder.api.v0.models.Publication]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Publication]] } @@ -85,12 +87,16 @@ package io.apibuilder.api.v0.anorm.conversions { implicit val columnToMapApibuilderApiAttributeValueForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.AttributeValueForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.AttributeValueForm]] } implicit val columnToSeqApibuilderApiAuthentication: Column[Seq[_root_.io.apibuilder.api.v0.models.Authentication]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Authentication]] } implicit val columnToMapApibuilderApiAuthentication: Column[Map[String, _root_.io.apibuilder.api.v0.models.Authentication]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Authentication]] } - implicit val columnToSeqApibuilderApiBatchDownloadApplicationForm: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationForm]] } - implicit val columnToMapApibuilderApiBatchDownloadApplicationForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplicationForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplicationForm]] } - implicit val columnToSeqApibuilderApiBatchDownloadApplications: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplications]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplications]] } - implicit val columnToMapApibuilderApiBatchDownloadApplications: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplications]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplications]] } - implicit val columnToSeqApibuilderApiBatchDownloadApplicationsForm: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationsForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationsForm]] } - implicit val columnToMapApibuilderApiBatchDownloadApplicationsForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplicationsForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplicationsForm]] } + implicit val columnToSeqApibuilderApiBatch: Column[Seq[_root_.io.apibuilder.api.v0.models.Batch]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Batch]] } + implicit val columnToMapApibuilderApiBatch: Column[Map[String, _root_.io.apibuilder.api.v0.models.Batch]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Batch]] } + implicit val columnToSeqApibuilderApiBatchData: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchData]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchData]] } + implicit val columnToMapApibuilderApiBatchData: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchData]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchData]] } + implicit val columnToSeqApibuilderApiBatchDownloadForm: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadForm]] } + implicit val columnToMapApibuilderApiBatchDownloadForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadForm]] } + implicit val columnToSeqApibuilderApiBatchDownloadFormApplication: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadFormApplication]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadFormApplication]] } + implicit val columnToMapApibuilderApiBatchDownloadFormApplication: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadFormApplication]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadFormApplication]] } + implicit val columnToSeqApibuilderApiBatchForm: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchForm]] } + implicit val columnToMapApibuilderApiBatchForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchForm]] } implicit val columnToSeqApibuilderApiChange: Column[Seq[_root_.io.apibuilder.api.v0.models.Change]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Change]] } implicit val columnToMapApibuilderApiChange: Column[Map[String, _root_.io.apibuilder.api.v0.models.Change]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Change]] } implicit val columnToSeqApibuilderApiChangeVersion: Column[Seq[_root_.io.apibuilder.api.v0.models.ChangeVersion]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.ChangeVersion]] } diff --git a/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala index 5d8bde1dd..933ceaede 100644 --- a/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala +++ b/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/anorm_2_8_parsers + * Service version: 0.16.48 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/anorm_2_8_parsers */ import anorm._ @@ -26,6 +26,18 @@ package io.apibuilder.api.v0.anorm.parsers { } + object BatchStatus { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchStatus] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser(name: String = "batch_status", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.BatchStatus] = { + SqlParser.str(prefixOpt.getOrElse("") + name) map { + case value => io.apibuilder.api.v0.models.BatchStatus(value) + } + } + + } + object OriginalType { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.OriginalType] = parser(prefixOpt = Some(s"$prefix$sep")) @@ -349,21 +361,24 @@ package io.apibuilder.api.v0.anorm.parsers { } - object BatchDownloadApplicationForm { + object Batch { - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplicationForm] = parser(prefixOpt = Some(s"$prefix$sep")) + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Batch] = parser(prefixOpt = Some(s"$prefix$sep")) def parser( - applicationKey: String = "application_key", - version: String = "version", + id: String = "id", + status: String = "status", + dataPrefix: String = "data", prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplicationForm] = { - SqlParser.str(prefixOpt.getOrElse("") + applicationKey) ~ - SqlParser.str(prefixOpt.getOrElse("") + version) map { - case applicationKey ~ version => { - io.apibuilder.api.v0.models.BatchDownloadApplicationForm( - applicationKey = applicationKey, - version = version + ): RowParser[io.apibuilder.api.v0.models.Batch] = { + SqlParser.str(prefixOpt.getOrElse("") + id) ~ + io.apibuilder.api.v0.anorm.parsers.BatchStatus.parser(prefixOpt.getOrElse("") + status) ~ + io.apibuilder.api.v0.anorm.parsers.BatchData.parserWithPrefix(prefixOpt.getOrElse("") + dataPrefix).? map { + case id ~ status ~ data => { + io.apibuilder.api.v0.models.Batch( + id = id, + status = status, + data = data ) } } @@ -371,17 +386,17 @@ package io.apibuilder.api.v0.anorm.parsers { } - object BatchDownloadApplications { + object BatchData { - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplications] = parser(prefixOpt = Some(s"$prefix$sep")) + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchData] = parser(prefixOpt = Some(s"$prefix$sep")) def parser( applications: String = "applications", prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplications] = { + ): RowParser[io.apibuilder.api.v0.models.BatchData] = { SqlParser.get[Seq[io.apibuilder.api.v0.models.Version]](prefixOpt.getOrElse("") + applications) map { case applications => { - io.apibuilder.api.v0.models.BatchDownloadApplications( + io.apibuilder.api.v0.models.BatchData( applications = applications ) } @@ -390,17 +405,58 @@ package io.apibuilder.api.v0.anorm.parsers { } - object BatchDownloadApplicationsForm { + object BatchDownloadForm { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchDownloadForm] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + applications: String = "applications", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.api.v0.models.BatchDownloadForm] = { + SqlParser.get[Seq[io.apibuilder.api.v0.models.BatchDownloadFormApplication]](prefixOpt.getOrElse("") + applications) map { + case applications => { + io.apibuilder.api.v0.models.BatchDownloadForm( + applications = applications + ) + } + } + } + + } + + object BatchDownloadFormApplication { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchDownloadFormApplication] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + applicationKey: String = "application_key", + version: String = "version", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.api.v0.models.BatchDownloadFormApplication] = { + SqlParser.str(prefixOpt.getOrElse("") + applicationKey) ~ + SqlParser.str(prefixOpt.getOrElse("") + version) map { + case applicationKey ~ version => { + io.apibuilder.api.v0.models.BatchDownloadFormApplication( + applicationKey = applicationKey, + version = version + ) + } + } + } + + } + + object BatchForm { - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplicationsForm] = parser(prefixOpt = Some(s"$prefix$sep")) + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchForm] = parser(prefixOpt = Some(s"$prefix$sep")) def parser( applications: String = "applications", prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplicationsForm] = { - SqlParser.get[Seq[io.apibuilder.api.v0.models.BatchDownloadApplicationForm]](prefixOpt.getOrElse("") + applications) map { + ): RowParser[io.apibuilder.api.v0.models.BatchForm] = { + SqlParser.get[Seq[io.apibuilder.api.v0.models.VersionForm]](prefixOpt.getOrElse("") + applications) map { case applications => { - io.apibuilder.api.v0.models.BatchDownloadApplicationsForm( + io.apibuilder.api.v0.models.BatchForm( applications = applications ) } diff --git a/api/conf/routes b/api/conf/routes index faefc1ae8..9c62f94fe 100644 --- a/api/conf/routes +++ b/api/conf/routes @@ -1,6 +1,6 @@ # Generated by API Builder - https://www.apibuilder.io -# Service version: 0.16.43 -# apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/play_2_x_routes +# Service version: 0.16.48 +# User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/play_2_x_routes GET /attributes controllers.Attributes.get(guid: _root_.scala.Option[_root_.java.util.UUID], name: _root_.scala.Option[String], limit: Long ?= 25L, offset: Long ?= 0L) GET /attributes/:name controllers.Attributes.getByName(name: String) @@ -65,7 +65,9 @@ POST /:orgKey controllers PUT /:orgKey/:applicationKey controllers.Applications.putByApplicationKey(orgKey: String, applicationKey: String) DELETE /:orgKey/:applicationKey controllers.Applications.deleteByApplicationKey(orgKey: String, applicationKey: String) POST /:orgKey/:applicationKey/move controllers.Applications.postMoveByApplicationKey(orgKey: String, applicationKey: String) -POST /:orgKey/batch/download/applications controllers.BatchDownloadApplications.post(orgKey: String) +POST /:orgKey/batch/applications controllers.Batches.post(orgKey: String) +POST /:orgKey/batch/applications/dryrun controllers.Batches.postDryrun(orgKey: String) +POST /:orgKey/batch/applications/download controllers.Batches.postDownload(orgKey: String) POST /:orgKey/:applicationKey/:version/form controllers.Code.postForm(orgKey: String, applicationKey: String, version: String) GET /:orgKey/:applicationKey/:version/:generatorKey controllers.Code.getByGeneratorKey(orgKey: String, applicationKey: String, version: String, generatorKey: String) POST /:orgKey/:applicationKey/:version/:generatorKey controllers.Code.postByGeneratorKey(orgKey: String, applicationKey: String, version: String, generatorKey: String) diff --git a/build.sbt b/build.sbt index 115358e52..af1e2e51d 100644 --- a/build.sbt +++ b/build.sbt @@ -54,7 +54,7 @@ lazy val swagger = project ) ) -val circeVersion = "0.14.8" +val circeVersion = "0.14.9" lazy val core = project .in(file("core")) .dependsOn(generated, lib, avro, swagger) diff --git a/core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala b/core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala index d8c36ecd9..432f57eff 100644 --- a/core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala +++ b/core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-api-json/latest/play_2_x_json + * Service version: 0.16.48 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api-json/latest/play_2_x_scala_3_json */ package io.apibuilder.api.json.v0.models { @@ -304,7 +304,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonAnnotation: play.api.libs.json.Reads[Annotation] = { + implicit def jsonReadsApibuilderApiJsonAnnotation: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Annotation] = { for { description <- (__ \ "description").readNullable[String] deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.api.json.v0.models.Deprecation] @@ -328,7 +328,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonApiJson: play.api.libs.json.Reads[ApiJson] = { + implicit def jsonReadsApibuilderApiJsonApiJson: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.ApiJson] = { for { name <- (__ \ "name").read[String] info <- (__ \ "info").readNullable[io.apibuilder.api.json.v0.models.Info] @@ -388,7 +388,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonAttribute: play.api.libs.json.Reads[Attribute] = { + implicit def jsonReadsApibuilderApiJsonAttribute: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Attribute] = { for { name <- (__ \ "name").read[String] value <- (__ \ "value").read[_root_.play.api.libs.json.JsObject] @@ -408,7 +408,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonBody: play.api.libs.json.Reads[Body] = { + implicit def jsonReadsApibuilderApiJsonBody: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Body] = { for { `type` <- (__ \ "type").read[String] description <- (__ \ "description").readNullable[String] @@ -440,7 +440,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonContact: play.api.libs.json.Reads[Contact] = { + implicit def jsonReadsApibuilderApiJsonContact: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Contact] = { for { name <- (__ \ "name").readNullable[String] url <- (__ \ "url").readNullable[String] @@ -469,8 +469,8 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonDeprecation: play.api.libs.json.Reads[Deprecation] = { - (__ \ "description").readNullable[String].map { x => new Deprecation(description = x) } + implicit def jsonReadsApibuilderApiJsonDeprecation: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Deprecation] = { + (__ \ "description").readNullable[String].map { x => Deprecation(description = x) } } def jsObjectDeprecation(obj: io.apibuilder.api.json.v0.models.Deprecation): play.api.libs.json.JsObject = { @@ -486,7 +486,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonEnum: play.api.libs.json.Reads[Enum] = { + implicit def jsonReadsApibuilderApiJsonEnum: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Enum] = { for { plural <- (__ \ "plural").readNullable[String] description <- (__ \ "description").readNullable[String] @@ -523,7 +523,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonEnumValue: play.api.libs.json.Reads[EnumValue] = { + implicit def jsonReadsApibuilderApiJsonEnumValue: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.EnumValue] = { for { name <- (__ \ "name").read[String] value <- (__ \ "value").readNullable[String] @@ -560,7 +560,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonField: play.api.libs.json.Reads[Field] = { + implicit def jsonReadsApibuilderApiJsonField: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Field] = { for { name <- (__ \ "name").read[String] `type` <- (__ \ "type").read[String] @@ -621,7 +621,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonHeader: play.api.libs.json.Reads[Header] = { + implicit def jsonReadsApibuilderApiJsonHeader: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Header] = { for { name <- (__ \ "name").read[String] `type` <- (__ \ "type").read[String] @@ -657,8 +657,8 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonImport: play.api.libs.json.Reads[Import] = { - (__ \ "uri").read[String].map { x => new Import(uri = x) } + implicit def jsonReadsApibuilderApiJsonImport: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Import] = { + (__ \ "uri").read[String].map { x => Import(uri = x) } } def jsObjectImport(obj: io.apibuilder.api.json.v0.models.Import): play.api.libs.json.JsObject = { @@ -673,7 +673,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonInfo: play.api.libs.json.Reads[Info] = { + implicit def jsonReadsApibuilderApiJsonInfo: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Info] = { for { contact <- (__ \ "contact").readNullable[io.apibuilder.api.json.v0.models.Contact] license <- (__ \ "license").readNullable[io.apibuilder.api.json.v0.models.License] @@ -697,7 +697,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonInterface: play.api.libs.json.Reads[Interface] = { + implicit def jsonReadsApibuilderApiJsonInterface: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Interface] = { for { plural <- (__ \ "plural").readNullable[String] description <- (__ \ "description").readNullable[String] @@ -736,7 +736,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonLicense: play.api.libs.json.Reads[License] = { + implicit def jsonReadsApibuilderApiJsonLicense: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.License] = { for { name <- (__ \ "name").read[String] url <- (__ \ "url").readNullable[String] @@ -758,7 +758,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonModel: play.api.libs.json.Reads[Model] = { + implicit def jsonReadsApibuilderApiJsonModel: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Model] = { for { description <- (__ \ "description").readNullable[String] plural <- (__ \ "plural").readNullable[String] @@ -805,7 +805,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonOperation: play.api.libs.json.Reads[Operation] = { + implicit def jsonReadsApibuilderApiJsonOperation: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Operation] = { for { method <- (__ \ "method").read[String] path <- (__ \ "path").readNullable[String] @@ -857,7 +857,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonParameter: play.api.libs.json.Reads[Parameter] = { + implicit def jsonReadsApibuilderApiJsonParameter: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Parameter] = { for { name <- (__ \ "name").read[String] `type` <- (__ \ "type").read[String] @@ -915,7 +915,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonResource: play.api.libs.json.Reads[Resource] = { + implicit def jsonReadsApibuilderApiJsonResource: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Resource] = { for { path <- (__ \ "path").readNullable[String] description <- (__ \ "description").readNullable[String] @@ -957,7 +957,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonResponse: play.api.libs.json.Reads[Response] = { + implicit def jsonReadsApibuilderApiJsonResponse: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Response] = { for { `type` <- (__ \ "type").read[String] headers <- (__ \ "headers").readNullable[Seq[io.apibuilder.api.json.v0.models.Header]] @@ -994,7 +994,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonTemplateDeclaration: play.api.libs.json.Reads[TemplateDeclaration] = { + implicit def jsonReadsApibuilderApiJsonTemplateDeclaration: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.TemplateDeclaration] = { for { name <- (__ \ "name").read[String] cast <- (__ \ "cast").readNullable[Map[String, String]] @@ -1016,7 +1016,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonTemplates: play.api.libs.json.Reads[Templates] = { + implicit def jsonReadsApibuilderApiJsonTemplates: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Templates] = { for { models <- (__ \ "models").readNullable[Map[String, io.apibuilder.api.json.v0.models.Model]] resources <- (__ \ "resources").readNullable[Map[String, io.apibuilder.api.json.v0.models.Resource]] @@ -1040,7 +1040,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonUnion: play.api.libs.json.Reads[Union] = { + implicit def jsonReadsApibuilderApiJsonUnion: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.Union] = { for { plural <- (__ \ "plural").readNullable[String] discriminator <- (__ \ "discriminator").readNullable[String] @@ -1087,7 +1087,7 @@ package io.apibuilder.api.json.v0.models { } } - implicit def jsonReadsApibuilderApiJsonUnionType: play.api.libs.json.Reads[UnionType] = { + implicit def jsonReadsApibuilderApiJsonUnionType: play.api.libs.json.Reads[io.apibuilder.api.json.v0.models.UnionType] = { for { `type` <- (__ \ "type").read[String] description <- (__ \ "description").readNullable[String] diff --git a/generated/app/ApicollectiveApibuilderApiV0Client.scala b/generated/app/ApicollectiveApibuilderApiV0Client.scala index 2de9cc84e..c933fd90a 100644 --- a/generated/app/ApicollectiveApibuilderApiV0Client.scala +++ b/generated/app/ApicollectiveApibuilderApiV0Client.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/play_2_8_client + * Service version: 0.16.48 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/play_2_9_scala_3_client */ package io.apibuilder.api.v0.models { @@ -194,17 +194,34 @@ package io.apibuilder.api.v0.models { session: io.apibuilder.api.v0.models.Session ) - final case class BatchDownloadApplicationForm( - applicationKey: String, - version: String = "latest" + /** + * Supports creating a batch operation which will run async. Caller can fetch the + * resource and check the status. + * + * @param data Populated once the batch is ready + */ + + final case class Batch( + id: String, + status: io.apibuilder.api.v0.models.BatchStatus, + data: _root_.scala.Option[io.apibuilder.api.v0.models.BatchData] = None ) - final case class BatchDownloadApplications( + final case class BatchData( applications: Seq[io.apibuilder.api.v0.models.Version] ) - final case class BatchDownloadApplicationsForm( - applications: Seq[io.apibuilder.api.v0.models.BatchDownloadApplicationForm] + final case class BatchDownloadForm( + applications: Seq[io.apibuilder.api.v0.models.BatchDownloadFormApplication] + ) + + final case class BatchDownloadFormApplication( + applicationKey: String, + version: String = "latest" + ) + + final case class BatchForm( + applications: Seq[io.apibuilder.api.v0.models.VersionForm] ) /** @@ -716,6 +733,41 @@ package io.apibuilder.api.v0.models { } + sealed trait BatchStatus extends _root_.scala.Product with _root_.scala.Serializable + + object BatchStatus { + + case object Created extends BatchStatus { override def toString = "created" } + case object Processing extends BatchStatus { override def toString = "processing" } + case object Ready extends BatchStatus { override def toString = "ready" } + case object Failed extends BatchStatus { override def toString = "failed" } + /** + * UNDEFINED captures values that are sent either in error or + * that were added by the server after this library was + * generated. We want to make it easy and obvious for users of + * this library to handle this case gracefully. + * + * We use all CAPS for the variable name to avoid collisions + * with the camel cased values above. + */ + final case class UNDEFINED(override val toString: String) extends BatchStatus + + /** + * all returns a list of all the valid, known values. We use + * lower case to avoid collisions with the camel cased values + * above. + */ + val all: scala.List[BatchStatus] = scala.List(Created, Processing, Ready, Failed) + + private + val byName: Map[String, BatchStatus] = all.map(x => x.toString.toLowerCase -> x).toMap + + def apply(value: String): BatchStatus = fromString(value).getOrElse(UNDEFINED(value)) + + def fromString(value: String): _root_.scala.Option[BatchStatus] = byName.get(value.toLowerCase) + + } + sealed trait OriginalType extends _root_.scala.Product with _root_.scala.Serializable object OriginalType { @@ -996,6 +1048,38 @@ package io.apibuilder.api.v0.models { } } + implicit val jsonReadsApibuilderApiBatchStatus: play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchStatus] = new play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchStatus] { + def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[io.apibuilder.api.v0.models.BatchStatus] = { + js match { + case v: play.api.libs.json.JsString => play.api.libs.json.JsSuccess(io.apibuilder.api.v0.models.BatchStatus(v.value)) + case _ => { + (js \ "value").validate[String] match { + case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(io.apibuilder.api.v0.models.BatchStatus(v)) + case err: play.api.libs.json.JsError => + (js \ "batch_status").validate[String] match { + case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(io.apibuilder.api.v0.models.BatchStatus(v)) + case err: play.api.libs.json.JsError => err + } + } + } + } + } + } + + def jsonWritesApibuilderApiBatchStatus(obj: io.apibuilder.api.v0.models.BatchStatus) = { + play.api.libs.json.JsString(obj.toString) + } + + def jsObjectBatchStatus(obj: io.apibuilder.api.v0.models.BatchStatus) = { + play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsString(obj.toString)) + } + + implicit def jsonWritesApibuilderApiBatchStatus: play.api.libs.json.Writes[BatchStatus] = { + (obj: io.apibuilder.api.v0.models.BatchStatus) => { + jsonWritesApibuilderApiBatchStatus(obj) + } + } + implicit val jsonReadsApibuilderApiOriginalType: play.api.libs.json.Reads[io.apibuilder.api.v0.models.OriginalType] = new play.api.libs.json.Reads[io.apibuilder.api.v0.models.OriginalType] { def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[io.apibuilder.api.v0.models.OriginalType] = { js match { @@ -1124,7 +1208,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiApplication: play.api.libs.json.Reads[Application] = { + implicit def jsonReadsApibuilderApiApplication: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Application] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] organization <- (__ \ "organization").read[io.apibuilder.common.v0.models.Reference] @@ -1158,7 +1242,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiApplicationForm: play.api.libs.json.Reads[ApplicationForm] = { + implicit def jsonReadsApibuilderApiApplicationForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.ApplicationForm] = { for { name <- (__ \ "name").read[String] key <- (__ \ "key").readNullable[String] @@ -1187,7 +1271,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiApplicationMetadata: play.api.libs.json.Reads[ApplicationMetadata] = { + implicit def jsonReadsApibuilderApiApplicationMetadata: play.api.libs.json.Reads[io.apibuilder.api.v0.models.ApplicationMetadata] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] key <- (__ \ "key").read[String] @@ -1207,8 +1291,8 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiApplicationMetadataVersion: play.api.libs.json.Reads[ApplicationMetadataVersion] = { - (__ \ "version").read[String].map { x => new ApplicationMetadataVersion(version = x) } + implicit def jsonReadsApibuilderApiApplicationMetadataVersion: play.api.libs.json.Reads[io.apibuilder.api.v0.models.ApplicationMetadataVersion] = { + (__ \ "version").read[String].map { x => ApplicationMetadataVersion(version = x) } } def jsObjectApplicationMetadataVersion(obj: io.apibuilder.api.v0.models.ApplicationMetadataVersion): play.api.libs.json.JsObject = { @@ -1223,7 +1307,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiApplicationSummary: play.api.libs.json.Reads[ApplicationSummary] = { + def jsonReadsApibuilderApiApplicationSummary: play.api.libs.json.Reads[io.apibuilder.api.v0.models.ApplicationSummary] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] organization <- (__ \ "organization").read[io.apibuilder.common.v0.models.Reference] @@ -1239,13 +1323,13 @@ package io.apibuilder.api.v0.models { ) ++ play.api.libs.json.Json.obj("type" -> "application_summary") } - implicit def jsonWritesApibuilderApiApplicationSummary: play.api.libs.json.Writes[ApplicationSummary] = { + def jsonWritesApibuilderApiApplicationSummary: play.api.libs.json.Writes[ApplicationSummary] = { (obj: io.apibuilder.api.v0.models.ApplicationSummary) => { jsObjectApplicationSummary(obj) } } - implicit def jsonReadsApibuilderApiAttribute: play.api.libs.json.Reads[Attribute] = { + implicit def jsonReadsApibuilderApiAttribute: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Attribute] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] name <- (__ \ "name").read[String] @@ -1271,7 +1355,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiAttributeForm: play.api.libs.json.Reads[AttributeForm] = { + implicit def jsonReadsApibuilderApiAttributeForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.AttributeForm] = { for { name <- (__ \ "name").read[String] description <- (__ \ "description").readNullable[String] @@ -1293,7 +1377,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiAttributeSummary: play.api.libs.json.Reads[AttributeSummary] = { + implicit def jsonReadsApibuilderApiAttributeSummary: play.api.libs.json.Reads[io.apibuilder.api.v0.models.AttributeSummary] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] name <- (__ \ "name").read[String] @@ -1313,7 +1397,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiAttributeValue: play.api.libs.json.Reads[AttributeValue] = { + implicit def jsonReadsApibuilderApiAttributeValue: play.api.libs.json.Reads[io.apibuilder.api.v0.models.AttributeValue] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] attribute <- (__ \ "attribute").read[io.apibuilder.api.v0.models.AttributeSummary] @@ -1337,8 +1421,8 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiAttributeValueForm: play.api.libs.json.Reads[AttributeValueForm] = { - (__ \ "value").read[String].map { x => new AttributeValueForm(value = x) } + implicit def jsonReadsApibuilderApiAttributeValueForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.AttributeValueForm] = { + (__ \ "value").read[String].map { x => AttributeValueForm(value = x) } } def jsObjectAttributeValueForm(obj: io.apibuilder.api.v0.models.AttributeValueForm): play.api.libs.json.JsObject = { @@ -1353,7 +1437,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiAuthentication: play.api.libs.json.Reads[Authentication] = { + implicit def jsonReadsApibuilderApiAuthentication: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Authentication] = { for { user <- (__ \ "user").read[io.apibuilder.api.v0.models.User] session <- (__ \ "session").read[io.apibuilder.api.v0.models.Session] @@ -1373,59 +1457,99 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiBatchDownloadApplicationForm: play.api.libs.json.Reads[BatchDownloadApplicationForm] = { + implicit def jsonReadsApibuilderApiBatch: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Batch] = { for { - applicationKey <- (__ \ "application_key").read[String] - version <- (__ \ "version").readWithDefault[String]("latest") - } yield BatchDownloadApplicationForm(applicationKey, version) + id <- (__ \ "id").read[String] + status <- (__ \ "status").read[io.apibuilder.api.v0.models.BatchStatus] + data <- (__ \ "data").readNullable[io.apibuilder.api.v0.models.BatchData] + } yield Batch(id, status, data) } - def jsObjectBatchDownloadApplicationForm(obj: io.apibuilder.api.v0.models.BatchDownloadApplicationForm): play.api.libs.json.JsObject = { + def jsObjectBatch(obj: io.apibuilder.api.v0.models.Batch): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( - "application_key" -> play.api.libs.json.JsString(obj.applicationKey), - "version" -> play.api.libs.json.JsString(obj.version) + "id" -> play.api.libs.json.JsString(obj.id), + "status" -> play.api.libs.json.JsString(obj.status.toString) + ) ++ (obj.data match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("data" -> jsObjectBatchData(x)) + }) + } + + implicit def jsonWritesApibuilderApiBatch: play.api.libs.json.Writes[Batch] = { + (obj: io.apibuilder.api.v0.models.Batch) => { + jsObjectBatch(obj) + } + } + + implicit def jsonReadsApibuilderApiBatchData: play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchData] = { + (__ \ "applications").read[Seq[io.apibuilder.api.v0.models.Version]].map { x => BatchData(applications = x) } + } + + def jsObjectBatchData(obj: io.apibuilder.api.v0.models.BatchData): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "applications" -> play.api.libs.json.Json.toJson(obj.applications) ) } - implicit def jsonWritesApibuilderApiBatchDownloadApplicationForm: play.api.libs.json.Writes[BatchDownloadApplicationForm] = { - (obj: io.apibuilder.api.v0.models.BatchDownloadApplicationForm) => { - jsObjectBatchDownloadApplicationForm(obj) + implicit def jsonWritesApibuilderApiBatchData: play.api.libs.json.Writes[BatchData] = { + (obj: io.apibuilder.api.v0.models.BatchData) => { + jsObjectBatchData(obj) } } - implicit def jsonReadsApibuilderApiBatchDownloadApplications: play.api.libs.json.Reads[BatchDownloadApplications] = { - (__ \ "applications").read[Seq[io.apibuilder.api.v0.models.Version]].map { x => new BatchDownloadApplications(applications = x) } + implicit def jsonReadsApibuilderApiBatchDownloadForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchDownloadForm] = { + (__ \ "applications").read[Seq[io.apibuilder.api.v0.models.BatchDownloadFormApplication]].map { x => BatchDownloadForm(applications = x) } } - def jsObjectBatchDownloadApplications(obj: io.apibuilder.api.v0.models.BatchDownloadApplications): play.api.libs.json.JsObject = { + def jsObjectBatchDownloadForm(obj: io.apibuilder.api.v0.models.BatchDownloadForm): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "applications" -> play.api.libs.json.Json.toJson(obj.applications) ) } - implicit def jsonWritesApibuilderApiBatchDownloadApplications: play.api.libs.json.Writes[BatchDownloadApplications] = { - (obj: io.apibuilder.api.v0.models.BatchDownloadApplications) => { - jsObjectBatchDownloadApplications(obj) + implicit def jsonWritesApibuilderApiBatchDownloadForm: play.api.libs.json.Writes[BatchDownloadForm] = { + (obj: io.apibuilder.api.v0.models.BatchDownloadForm) => { + jsObjectBatchDownloadForm(obj) } } - implicit def jsonReadsApibuilderApiBatchDownloadApplicationsForm: play.api.libs.json.Reads[BatchDownloadApplicationsForm] = { - (__ \ "applications").read[Seq[io.apibuilder.api.v0.models.BatchDownloadApplicationForm]].map { x => new BatchDownloadApplicationsForm(applications = x) } + implicit def jsonReadsApibuilderApiBatchDownloadFormApplication: play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchDownloadFormApplication] = { + for { + applicationKey <- (__ \ "application_key").read[String] + version <- (__ \ "version").readWithDefault[String]("latest") + } yield BatchDownloadFormApplication(applicationKey, version) } - def jsObjectBatchDownloadApplicationsForm(obj: io.apibuilder.api.v0.models.BatchDownloadApplicationsForm): play.api.libs.json.JsObject = { + def jsObjectBatchDownloadFormApplication(obj: io.apibuilder.api.v0.models.BatchDownloadFormApplication): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "application_key" -> play.api.libs.json.JsString(obj.applicationKey), + "version" -> play.api.libs.json.JsString(obj.version) + ) + } + + implicit def jsonWritesApibuilderApiBatchDownloadFormApplication: play.api.libs.json.Writes[BatchDownloadFormApplication] = { + (obj: io.apibuilder.api.v0.models.BatchDownloadFormApplication) => { + jsObjectBatchDownloadFormApplication(obj) + } + } + + implicit def jsonReadsApibuilderApiBatchForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchForm] = { + (__ \ "applications").read[Seq[io.apibuilder.api.v0.models.VersionForm]].map { x => BatchForm(applications = x) } + } + + def jsObjectBatchForm(obj: io.apibuilder.api.v0.models.BatchForm): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "applications" -> play.api.libs.json.Json.toJson(obj.applications) ) } - implicit def jsonWritesApibuilderApiBatchDownloadApplicationsForm: play.api.libs.json.Writes[BatchDownloadApplicationsForm] = { - (obj: io.apibuilder.api.v0.models.BatchDownloadApplicationsForm) => { - jsObjectBatchDownloadApplicationsForm(obj) + implicit def jsonWritesApibuilderApiBatchForm: play.api.libs.json.Writes[BatchForm] = { + (obj: io.apibuilder.api.v0.models.BatchForm) => { + jsObjectBatchForm(obj) } } - implicit def jsonReadsApibuilderApiChange: play.api.libs.json.Reads[Change] = { + implicit def jsonReadsApibuilderApiChange: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Change] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] organization <- (__ \ "organization").read[io.apibuilder.common.v0.models.Reference] @@ -1459,7 +1583,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiChangeVersion: play.api.libs.json.Reads[ChangeVersion] = { + implicit def jsonReadsApibuilderApiChangeVersion: play.api.libs.json.Reads[io.apibuilder.api.v0.models.ChangeVersion] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] version <- (__ \ "version").read[String] @@ -1479,8 +1603,8 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiCleartextToken: play.api.libs.json.Reads[CleartextToken] = { - (__ \ "token").read[String].map { x => new CleartextToken(token = x) } + implicit def jsonReadsApibuilderApiCleartextToken: play.api.libs.json.Reads[io.apibuilder.api.v0.models.CleartextToken] = { + (__ \ "token").read[String].map { x => CleartextToken(token = x) } } def jsObjectCleartextToken(obj: io.apibuilder.api.v0.models.CleartextToken): play.api.libs.json.JsObject = { @@ -1495,7 +1619,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiCode: play.api.libs.json.Reads[Code] = { + implicit def jsonReadsApibuilderApiCode: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Code] = { for { generator <- (__ \ "generator").read[io.apibuilder.api.v0.models.GeneratorWithService] source <- (__ \ "source").read[String] @@ -1517,8 +1641,8 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiCodeForm: play.api.libs.json.Reads[CodeForm] = { - (__ \ "attributes").read[Seq[io.apibuilder.generator.v0.models.Attribute]].map { x => new CodeForm(attributes = x) } + implicit def jsonReadsApibuilderApiCodeForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.CodeForm] = { + (__ \ "attributes").read[Seq[io.apibuilder.generator.v0.models.Attribute]].map { x => CodeForm(attributes = x) } } def jsObjectCodeForm(obj: io.apibuilder.api.v0.models.CodeForm): play.api.libs.json.JsObject = { @@ -1533,7 +1657,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiDiffBreaking: play.api.libs.json.Reads[DiffBreaking] = { + def jsonReadsApibuilderApiDiffBreaking: play.api.libs.json.Reads[io.apibuilder.api.v0.models.DiffBreaking] = { for { description <- (__ \ "description").read[String] isMaterial <- (__ \ "is_material").read[Boolean] @@ -1547,13 +1671,13 @@ package io.apibuilder.api.v0.models { ) ++ play.api.libs.json.Json.obj("type" -> "diff_breaking") } - implicit def jsonWritesApibuilderApiDiffBreaking: play.api.libs.json.Writes[DiffBreaking] = { + def jsonWritesApibuilderApiDiffBreaking: play.api.libs.json.Writes[DiffBreaking] = { (obj: io.apibuilder.api.v0.models.DiffBreaking) => { jsObjectDiffBreaking(obj) } } - implicit def jsonReadsApibuilderApiDiffNonBreaking: play.api.libs.json.Reads[DiffNonBreaking] = { + def jsonReadsApibuilderApiDiffNonBreaking: play.api.libs.json.Reads[io.apibuilder.api.v0.models.DiffNonBreaking] = { for { description <- (__ \ "description").read[String] isMaterial <- (__ \ "is_material").read[Boolean] @@ -1567,14 +1691,14 @@ package io.apibuilder.api.v0.models { ) ++ play.api.libs.json.Json.obj("type" -> "diff_non_breaking") } - implicit def jsonWritesApibuilderApiDiffNonBreaking: play.api.libs.json.Writes[DiffNonBreaking] = { + def jsonWritesApibuilderApiDiffNonBreaking: play.api.libs.json.Writes[DiffNonBreaking] = { (obj: io.apibuilder.api.v0.models.DiffNonBreaking) => { jsObjectDiffNonBreaking(obj) } } - implicit def jsonReadsApibuilderApiDomain: play.api.libs.json.Reads[Domain] = { - (__ \ "name").read[String].map { x => new Domain(name = x) } + implicit def jsonReadsApibuilderApiDomain: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Domain] = { + (__ \ "name").read[String].map { x => Domain(name = x) } } def jsObjectDomain(obj: io.apibuilder.api.v0.models.Domain): play.api.libs.json.JsObject = { @@ -1589,8 +1713,8 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiEmailVerificationConfirmationForm: play.api.libs.json.Reads[EmailVerificationConfirmationForm] = { - (__ \ "token").read[String].map { x => new EmailVerificationConfirmationForm(token = x) } + implicit def jsonReadsApibuilderApiEmailVerificationConfirmationForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.EmailVerificationConfirmationForm] = { + (__ \ "token").read[String].map { x => EmailVerificationConfirmationForm(token = x) } } def jsObjectEmailVerificationConfirmationForm(obj: io.apibuilder.api.v0.models.EmailVerificationConfirmationForm): play.api.libs.json.JsObject = { @@ -1605,7 +1729,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiError: play.api.libs.json.Reads[Error] = { + implicit def jsonReadsApibuilderApiError: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Error] = { for { code <- (__ \ "code").read[String] message <- (__ \ "message").read[String] @@ -1625,7 +1749,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiGeneratorForm: play.api.libs.json.Reads[GeneratorForm] = { + implicit def jsonReadsApibuilderApiGeneratorForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.GeneratorForm] = { for { serviceGuid <- (__ \ "service_guid").read[_root_.java.util.UUID] generator <- (__ \ "generator").read[io.apibuilder.generator.v0.models.Generator] @@ -1645,7 +1769,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiGeneratorService: play.api.libs.json.Reads[GeneratorService] = { + implicit def jsonReadsApibuilderApiGeneratorService: play.api.libs.json.Reads[io.apibuilder.api.v0.models.GeneratorService] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] uri <- (__ \ "uri").read[String] @@ -1667,8 +1791,8 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiGeneratorServiceForm: play.api.libs.json.Reads[GeneratorServiceForm] = { - (__ \ "uri").read[String].map { x => new GeneratorServiceForm(uri = x) } + implicit def jsonReadsApibuilderApiGeneratorServiceForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.GeneratorServiceForm] = { + (__ \ "uri").read[String].map { x => GeneratorServiceForm(uri = x) } } def jsObjectGeneratorServiceForm(obj: io.apibuilder.api.v0.models.GeneratorServiceForm): play.api.libs.json.JsObject = { @@ -1683,7 +1807,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiGeneratorWithService: play.api.libs.json.Reads[GeneratorWithService] = { + implicit def jsonReadsApibuilderApiGeneratorWithService: play.api.libs.json.Reads[io.apibuilder.api.v0.models.GeneratorWithService] = { for { service <- (__ \ "service").read[io.apibuilder.api.v0.models.GeneratorService] generator <- (__ \ "generator").read[io.apibuilder.generator.v0.models.Generator] @@ -1703,7 +1827,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiItem: play.api.libs.json.Reads[Item] = { + implicit def jsonReadsApibuilderApiItem: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Item] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] detail <- (__ \ "detail").read[io.apibuilder.api.v0.models.ItemDetail] @@ -1729,7 +1853,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiMembership: play.api.libs.json.Reads[Membership] = { + implicit def jsonReadsApibuilderApiMembership: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Membership] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] user <- (__ \ "user").read[io.apibuilder.api.v0.models.User] @@ -1755,7 +1879,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiMembershipRequest: play.api.libs.json.Reads[MembershipRequest] = { + implicit def jsonReadsApibuilderApiMembershipRequest: play.api.libs.json.Reads[io.apibuilder.api.v0.models.MembershipRequest] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] user <- (__ \ "user").read[io.apibuilder.api.v0.models.User] @@ -1781,8 +1905,8 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiMoveForm: play.api.libs.json.Reads[MoveForm] = { - (__ \ "org_key").read[String].map { x => new MoveForm(orgKey = x) } + implicit def jsonReadsApibuilderApiMoveForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.MoveForm] = { + (__ \ "org_key").read[String].map { x => MoveForm(orgKey = x) } } def jsObjectMoveForm(obj: io.apibuilder.api.v0.models.MoveForm): play.api.libs.json.JsObject = { @@ -1797,7 +1921,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiOrganization: play.api.libs.json.Reads[Organization] = { + implicit def jsonReadsApibuilderApiOrganization: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Organization] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] key <- (__ \ "key").read[String] @@ -1827,7 +1951,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiOrganizationForm: play.api.libs.json.Reads[OrganizationForm] = { + implicit def jsonReadsApibuilderApiOrganizationForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.OrganizationForm] = { for { name <- (__ \ "name").read[String] key <- (__ \ "key").readNullable[String] @@ -1858,7 +1982,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiOriginal: play.api.libs.json.Reads[Original] = { + implicit def jsonReadsApibuilderApiOriginal: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Original] = { for { `type` <- (__ \ "type").read[io.apibuilder.api.v0.models.OriginalType] data <- (__ \ "data").read[String] @@ -1878,7 +2002,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiOriginalForm: play.api.libs.json.Reads[OriginalForm] = { + implicit def jsonReadsApibuilderApiOriginalForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.OriginalForm] = { for { `type` <- (__ \ "type").readNullable[io.apibuilder.api.v0.models.OriginalType] data <- (__ \ "data").read[String] @@ -1900,7 +2024,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiPasswordReset: play.api.libs.json.Reads[PasswordReset] = { + implicit def jsonReadsApibuilderApiPasswordReset: play.api.libs.json.Reads[io.apibuilder.api.v0.models.PasswordReset] = { for { token <- (__ \ "token").read[String] password <- (__ \ "password").read[String] @@ -1920,8 +2044,8 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiPasswordResetRequest: play.api.libs.json.Reads[PasswordResetRequest] = { - (__ \ "email").read[String].map { x => new PasswordResetRequest(email = x) } + implicit def jsonReadsApibuilderApiPasswordResetRequest: play.api.libs.json.Reads[io.apibuilder.api.v0.models.PasswordResetRequest] = { + (__ \ "email").read[String].map { x => PasswordResetRequest(email = x) } } def jsObjectPasswordResetRequest(obj: io.apibuilder.api.v0.models.PasswordResetRequest): play.api.libs.json.JsObject = { @@ -1936,7 +2060,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiSession: play.api.libs.json.Reads[Session] = { + implicit def jsonReadsApibuilderApiSession: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Session] = { for { id <- (__ \ "id").read[String] expiresAt <- (__ \ "expires_at").read[_root_.org.joda.time.DateTime] @@ -1956,7 +2080,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiSubscription: play.api.libs.json.Reads[Subscription] = { + implicit def jsonReadsApibuilderApiSubscription: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Subscription] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] organization <- (__ \ "organization").read[io.apibuilder.api.v0.models.Organization] @@ -1982,7 +2106,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiSubscriptionForm: play.api.libs.json.Reads[SubscriptionForm] = { + implicit def jsonReadsApibuilderApiSubscriptionForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.SubscriptionForm] = { for { organizationKey <- (__ \ "organization_key").read[String] userGuid <- (__ \ "user_guid").read[_root_.java.util.UUID] @@ -2004,7 +2128,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiToken: play.api.libs.json.Reads[Token] = { + implicit def jsonReadsApibuilderApiToken: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Token] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] user <- (__ \ "user").read[io.apibuilder.api.v0.models.User] @@ -2032,7 +2156,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiTokenForm: play.api.libs.json.Reads[TokenForm] = { + implicit def jsonReadsApibuilderApiTokenForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.TokenForm] = { for { userGuid <- (__ \ "user_guid").read[_root_.java.util.UUID] description <- (__ \ "description").readNullable[String] @@ -2054,7 +2178,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiUser: play.api.libs.json.Reads[User] = { + implicit def jsonReadsApibuilderApiUser: play.api.libs.json.Reads[io.apibuilder.api.v0.models.User] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] email <- (__ \ "email").read[String] @@ -2082,7 +2206,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiUserForm: play.api.libs.json.Reads[UserForm] = { + implicit def jsonReadsApibuilderApiUserForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.UserForm] = { for { email <- (__ \ "email").read[String] password <- (__ \ "password").read[String] @@ -2111,7 +2235,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiUserSummary: play.api.libs.json.Reads[UserSummary] = { + implicit def jsonReadsApibuilderApiUserSummary: play.api.libs.json.Reads[io.apibuilder.api.v0.models.UserSummary] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] nickname <- (__ \ "nickname").read[String] @@ -2131,7 +2255,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiUserUpdateForm: play.api.libs.json.Reads[UserUpdateForm] = { + implicit def jsonReadsApibuilderApiUserUpdateForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.UserUpdateForm] = { for { email <- (__ \ "email").read[String] nickname <- (__ \ "nickname").read[String] @@ -2155,7 +2279,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiValidation: play.api.libs.json.Reads[Validation] = { + implicit def jsonReadsApibuilderApiValidation: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Validation] = { for { valid <- (__ \ "valid").read[Boolean] errors <- (__ \ "errors").read[Seq[String]] @@ -2175,7 +2299,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiVersion: play.api.libs.json.Reads[Version] = { + implicit def jsonReadsApibuilderApiVersion: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Version] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] organization <- (__ \ "organization").read[io.apibuilder.common.v0.models.Reference] @@ -2207,7 +2331,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiVersionForm: play.api.libs.json.Reads[VersionForm] = { + implicit def jsonReadsApibuilderApiVersionForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.VersionForm] = { for { originalForm <- (__ \ "original_form").read[io.apibuilder.api.v0.models.OriginalForm] visibility <- (__ \ "visibility").readNullable[io.apibuilder.api.v0.models.Visibility] @@ -2229,7 +2353,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiWatch: play.api.libs.json.Reads[Watch] = { + implicit def jsonReadsApibuilderApiWatch: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Watch] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] user <- (__ \ "user").read[io.apibuilder.api.v0.models.User] @@ -2255,7 +2379,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiWatchForm: play.api.libs.json.Reads[WatchForm] = { + implicit def jsonReadsApibuilderApiWatchForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.WatchForm] = { for { userGuid <- (__ \ "user_guid").read[_root_.java.util.UUID] organizationKey <- (__ \ "organization_key").read[String] @@ -2277,18 +2401,31 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiDiff: play.api.libs.json.Reads[Diff] = (js: play.api.libs.json.JsValue) => { + implicit def jsonReadsApibuilderApiDiff[T <: io.apibuilder.api.v0.models.Diff]: play.api.libs.json.Reads[T] = (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" => jsonReadsApibuilderApiDiffBreaking.reads(js) + case "diff_non_breaking" => jsonReadsApibuilderApiDiffNonBreaking.reads(js) case other => play.api.libs.json.JsSuccess(io.apibuilder.api.v0.models.DiffUndefinedType(other)) } } (js \ "type").validate[String] match { case e: play.api.libs.json.JsError => e - case s: play.api.libs.json.JsSuccess[String] => readDiscriminator(s.value) + case s: play.api.libs.json.JsSuccess[String] => readDiscriminator(s.value).map(_.asInstanceOf[T]) + } + } + + + implicit def jsonReadsApibuilderApiDiffSeq[T <: io.apibuilder.api.v0.models.Diff]: play.api.libs.json.Reads[Seq[T]] = { + case a: play.api.libs.json.JsArray => { + val all: Seq[play.api.libs.json.JsResult[io.apibuilder.api.v0.models.Diff]] = a.value.map(jsonReadsApibuilderApiDiff.reads).toSeq + + all.collect { case e: play.api.libs.json.JsError => e }.toList match { + case Nil => play.api.libs.json.JsSuccess(all.collect { case play.api.libs.json.JsSuccess(v, _) => v.asInstanceOf[T] }) + case errors => play.api.libs.json.JsError(play.api.libs.json.JsError.merge(errors.flatMap(_.errors), Nil)) + } } + case other => play.api.libs.json.JsError(s"Expected array but found [" + other.getClass.getName + "]") } def jsObjectDiff(obj: io.apibuilder.api.v0.models.Diff): play.api.libs.json.JsObject = { @@ -2301,23 +2438,37 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonWritesApibuilderApiDiff: play.api.libs.json.Writes[Diff] = { + implicit def jsonWritesApibuilderApiDiff[T <: io.apibuilder.api.v0.models.Diff]: play.api.libs.json.Writes[T] = { (obj: io.apibuilder.api.v0.models.Diff) => { jsObjectDiff(obj) } } - implicit def jsonReadsApibuilderApiItemDetail: play.api.libs.json.Reads[ItemDetail] = (js: play.api.libs.json.JsValue) => { + + implicit def jsonReadsApibuilderApiItemDetail[T <: io.apibuilder.api.v0.models.ItemDetail]: play.api.libs.json.Reads[T] = (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" => jsonReadsApibuilderApiApplicationSummary.reads(js) case other => play.api.libs.json.JsSuccess(io.apibuilder.api.v0.models.ItemDetailUndefinedType(other)) } } (js \ "type").validate[String] match { case e: play.api.libs.json.JsError => e - case s: play.api.libs.json.JsSuccess[String] => readDiscriminator(s.value) + case s: play.api.libs.json.JsSuccess[String] => readDiscriminator(s.value).map(_.asInstanceOf[T]) + } + } + + + implicit def jsonReadsApibuilderApiItemDetailSeq[T <: io.apibuilder.api.v0.models.ItemDetail]: play.api.libs.json.Reads[Seq[T]] = { + case a: play.api.libs.json.JsArray => { + val all: Seq[play.api.libs.json.JsResult[io.apibuilder.api.v0.models.ItemDetail]] = a.value.map(jsonReadsApibuilderApiItemDetail.reads).toSeq + + all.collect { case e: play.api.libs.json.JsError => e }.toList match { + case Nil => play.api.libs.json.JsSuccess(all.collect { case play.api.libs.json.JsSuccess(v, _) => v.asInstanceOf[T] }) + case errors => play.api.libs.json.JsError(play.api.libs.json.JsError.merge(errors.flatMap(_.errors), Nil)) + } } + case other => play.api.libs.json.JsError(s"Expected array but found [" + other.getClass.getName + "]") } def jsObjectItemDetail(obj: io.apibuilder.api.v0.models.ItemDetail): play.api.libs.json.JsObject = { @@ -2329,7 +2480,7 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonWritesApibuilderApiItemDetail: play.api.libs.json.Writes[ItemDetail] = { + implicit def jsonWritesApibuilderApiItemDetail[T <: io.apibuilder.api.v0.models.ItemDetail]: play.api.libs.json.Writes[T] = { (obj: io.apibuilder.api.v0.models.ItemDetail) => { jsObjectItemDetail(obj) } @@ -2367,6 +2518,15 @@ package io.apibuilder.api.v0 { implicit def pathBindableAppSortBy(implicit stringBinder: QueryStringBindable[String]): PathBindable[io.apibuilder.api.v0.models.AppSortBy] = ApibuilderPathBindable(appSortByConverter) implicit def queryStringBindableAppSortBy(implicit stringBinder: QueryStringBindable[String]): QueryStringBindable[io.apibuilder.api.v0.models.AppSortBy] = ApibuilderQueryStringBindable(appSortByConverter) + val batchStatusConverter: ApibuilderTypeConverter[io.apibuilder.api.v0.models.BatchStatus] = new ApibuilderTypeConverter[io.apibuilder.api.v0.models.BatchStatus] { + override def convert(value: String): io.apibuilder.api.v0.models.BatchStatus = io.apibuilder.api.v0.models.BatchStatus(value) + override def convert(value: io.apibuilder.api.v0.models.BatchStatus): String = value.toString + override def example: io.apibuilder.api.v0.models.BatchStatus = io.apibuilder.api.v0.models.BatchStatus.Created + override def validValues: Seq[io.apibuilder.api.v0.models.BatchStatus] = io.apibuilder.api.v0.models.BatchStatus.all + } + implicit def pathBindableBatchStatus(implicit stringBinder: QueryStringBindable[String]): PathBindable[io.apibuilder.api.v0.models.BatchStatus] = ApibuilderPathBindable(batchStatusConverter) + implicit def queryStringBindableBatchStatus(implicit stringBinder: QueryStringBindable[String]): QueryStringBindable[io.apibuilder.api.v0.models.BatchStatus] = ApibuilderQueryStringBindable(batchStatusConverter) + val originalTypeConverter: ApibuilderTypeConverter[io.apibuilder.api.v0.models.OriginalType] = new ApibuilderTypeConverter[io.apibuilder.api.v0.models.OriginalType] { override def convert(value: String): io.apibuilder.api.v0.models.OriginalType = io.apibuilder.api.v0.models.OriginalType(value) override def convert(value: io.apibuilder.api.v0.models.OriginalType): String = value.toString @@ -2492,8 +2652,8 @@ package io.apibuilder.api.v0 { val BaseUrl = "https://api.apibuilder.io" val Namespace = "io.apibuilder.api.v0" - val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/play_2_8_client" - val Version = "0.16.43" + val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/play_2_9_scala_3_client" + val Version = "0.16.48" val VersionMajor = 0 } @@ -2519,7 +2679,7 @@ package io.apibuilder.api.v0 { def authentications: Authentications = Authentications - def batchDownloadApplications: BatchDownloadApplications = BatchDownloadApplications + def batches: Batches = Batches def changes: Changes = Changes @@ -2752,16 +2912,44 @@ package io.apibuilder.api.v0 { } } - object BatchDownloadApplications extends BatchDownloadApplications { + object Batches extends Batches { override def post( orgKey: String, - batchDownloadApplicationsForm: io.apibuilder.api.v0.models.BatchDownloadApplicationsForm, + batchForm: io.apibuilder.api.v0.models.BatchForm, requestHeaders: Seq[(String, String)] = Nil - )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.BatchDownloadApplications] = { - val payload = play.api.libs.json.Json.toJson(batchDownloadApplicationsForm) + )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.Batch] = { + val payload = play.api.libs.json.Json.toJson(batchForm) - _executeRequest("POST", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/batch/download/applications", body = Some(payload), requestHeaders = requestHeaders).map { - case r if r.status == 201 => _root_.io.apibuilder.api.v0.Client.parseJson("io.apibuilder.api.v0.models.BatchDownloadApplications", r, _.validate[io.apibuilder.api.v0.models.BatchDownloadApplications]) + _executeRequest("POST", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/batch/applications", body = Some(payload), requestHeaders = requestHeaders).map { + case r if r.status == 201 => _root_.io.apibuilder.api.v0.Client.parseJson("io.apibuilder.api.v0.models.Batch", r, _.validate[io.apibuilder.api.v0.models.Batch]) + case r if r.status == 409 => throw io.apibuilder.api.v0.errors.ErrorsResponse(r) + case r => throw io.apibuilder.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 201, 409") + } + } + + override def postDryrun( + orgKey: String, + batchDownloadForm: io.apibuilder.api.v0.models.BatchDownloadForm, + requestHeaders: Seq[(String, String)] = Nil + )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.Batch] = { + val payload = play.api.libs.json.Json.toJson(batchDownloadForm) + + _executeRequest("POST", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/batch/applications/dryrun", body = Some(payload), requestHeaders = requestHeaders).map { + case r if r.status == 201 => _root_.io.apibuilder.api.v0.Client.parseJson("io.apibuilder.api.v0.models.Batch", r, _.validate[io.apibuilder.api.v0.models.Batch]) + case r if r.status == 409 => throw io.apibuilder.api.v0.errors.ErrorsResponse(r) + case r => throw io.apibuilder.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 201, 409") + } + } + + override def postDownload( + orgKey: String, + batchDownloadForm: io.apibuilder.api.v0.models.BatchDownloadForm, + requestHeaders: Seq[(String, String)] = Nil + )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.Batch] = { + val payload = play.api.libs.json.Json.toJson(batchDownloadForm) + + _executeRequest("POST", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/batch/applications/download", body = Some(payload), requestHeaders = requestHeaders).map { + case r if r.status == 201 => _root_.io.apibuilder.api.v0.Client.parseJson("io.apibuilder.api.v0.models.Batch", r, _.validate[io.apibuilder.api.v0.models.Batch]) case r if r.status == 409 => throw io.apibuilder.api.v0.errors.ErrorsResponse(r) case r => throw io.apibuilder.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 201, 409") } @@ -3725,12 +3913,11 @@ package io.apibuilder.api.v0 { "User-Agent" -> Constants.UserAgent, "X-Apidoc-Version" -> Constants.Version, "X-Apidoc-Version-Major" -> Constants.VersionMajor.toString - ).addHttpHeaders(defaultHeaders *) + ).addHttpHeaders(defaultHeaders*) auth.fold(holder) { case Authorization.Basic(username, password) => { holder.withAuth(username, password.getOrElse(""), play.api.libs.ws.WSAuthScheme.BASIC) } - case a => sys.error("Invalid authorization scheme[" + a.getClass + "]") } } @@ -3753,30 +3940,32 @@ package io.apibuilder.api.v0 { requestHeaders: Seq[(String, String)] = Nil, body: Option[play.api.libs.json.JsValue] = None ): scala.concurrent.Future[play.api.libs.ws.WSResponse] = { + import play.api.libs.ws.WSBodyWritables.writeableOf_JsValue + method.toUpperCase match { case "GET" => { - _logRequest("GET", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).get() + _logRequest("GET", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).get() } case "POST" => { - _logRequest("POST", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders):_*).addQueryStringParameters(queryParameters:_*)).post(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("POST", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders)*).addQueryStringParameters(queryParameters*)).post(body.getOrElse(play.api.libs.json.Json.obj())) } case "PUT" => { - _logRequest("PUT", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders):_*).addQueryStringParameters(queryParameters:_*)).put(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("PUT", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders)*).addQueryStringParameters(queryParameters*)).put(body.getOrElse(play.api.libs.json.Json.obj())) } case "PATCH" => { - _logRequest("PATCH", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).patch(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("PATCH", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).patch(body.getOrElse(play.api.libs.json.Json.obj())) } case "DELETE" => { - _logRequest("DELETE", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).delete() + _logRequest("DELETE", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).delete() } case "HEAD" => { - _logRequest("HEAD", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).head() + _logRequest("HEAD", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).head() } case "OPTIONS" => { - _logRequest("OPTIONS", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).options() + _logRequest("OPTIONS", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).options() } case _ => { - _logRequest(method, _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)) + _logRequest(method, _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)) sys.error("Unsupported method[%s]".format(method)) } } @@ -3824,7 +4013,7 @@ package io.apibuilder.api.v0 { def applications: io.apibuilder.api.v0.Applications def attributes: io.apibuilder.api.v0.Attributes def authentications: io.apibuilder.api.v0.Authentications - def batchDownloadApplications: io.apibuilder.api.v0.BatchDownloadApplications + def batches: io.apibuilder.api.v0.Batches def changes: io.apibuilder.api.v0.Changes def code: io.apibuilder.api.v0.Code def domains: io.apibuilder.api.v0.Domains @@ -3987,15 +4176,34 @@ package io.apibuilder.api.v0 { )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.Authentication] } - trait BatchDownloadApplications { + trait Batches { /** - * Retrieve multiple applications in one api call. + * Upsert multiple applications in one api call. Validation happens first - we + * store results only if ALL applications are valid */ def post( orgKey: String, - batchDownloadApplicationsForm: io.apibuilder.api.v0.models.BatchDownloadApplicationsForm, + batchForm: io.apibuilder.api.v0.models.BatchForm, + requestHeaders: Seq[(String, String)] = Nil + )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.Batch] + + /** + * Validate a batch of applications without SAVING anything to the database + */ + def postDryrun( + orgKey: String, + batchDownloadForm: io.apibuilder.api.v0.models.BatchDownloadForm, + requestHeaders: Seq[(String, String)] = Nil + )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.Batch] + + /** + * Download multiple applications in one api call. + */ + def postDownload( + orgKey: String, + batchDownloadForm: io.apibuilder.api.v0.models.BatchDownloadForm, requestHeaders: Seq[(String, String)] = Nil - )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.BatchDownloadApplications] + )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.Batch] } trait Changes { @@ -4560,7 +4768,7 @@ package io.apibuilder.api.v0 { /** * Retrieve a specific version of an application. * - * @param version The version of tthis application to download, or the keyword latest to get the + * @param version The version of this application to download, or the keyword latest to get the * latest version */ def getByApplicationKeyAndVersion( diff --git a/generated/app/ApicollectiveApibuilderCommonV0Client.scala b/generated/app/ApicollectiveApibuilderCommonV0Client.scala index bc8837a7b..48e6223ea 100644 --- a/generated/app/ApicollectiveApibuilderCommonV0Client.scala +++ b/generated/app/ApicollectiveApibuilderCommonV0Client.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-common/latest/play_2_8_client + * Service version: 0.16.48 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-common/latest/play_2_9_scala_3_client */ package io.apibuilder.common.v0.models { @@ -126,7 +126,7 @@ package io.apibuilder.common.v0.models { } } - implicit def jsonReadsApibuilderCommonAudit: play.api.libs.json.Reads[Audit] = { + implicit def jsonReadsApibuilderCommonAudit: play.api.libs.json.Reads[io.apibuilder.common.v0.models.Audit] = { for { createdAt <- (__ \ "created_at").read[_root_.org.joda.time.DateTime] createdBy <- (__ \ "created_by").read[io.apibuilder.common.v0.models.ReferenceGuid] @@ -150,8 +150,8 @@ package io.apibuilder.common.v0.models { } } - implicit def jsonReadsApibuilderCommonHealthcheck: play.api.libs.json.Reads[Healthcheck] = { - (__ \ "status").read[String].map { x => new Healthcheck(status = x) } + implicit def jsonReadsApibuilderCommonHealthcheck: play.api.libs.json.Reads[io.apibuilder.common.v0.models.Healthcheck] = { + (__ \ "status").read[String].map { x => Healthcheck(status = x) } } def jsObjectHealthcheck(obj: io.apibuilder.common.v0.models.Healthcheck): play.api.libs.json.JsObject = { @@ -166,7 +166,7 @@ package io.apibuilder.common.v0.models { } } - implicit def jsonReadsApibuilderCommonReference: play.api.libs.json.Reads[Reference] = { + implicit def jsonReadsApibuilderCommonReference: play.api.libs.json.Reads[io.apibuilder.common.v0.models.Reference] = { for { guid <- (__ \ "guid").read[_root_.java.util.UUID] key <- (__ \ "key").read[String] @@ -186,8 +186,8 @@ package io.apibuilder.common.v0.models { } } - implicit def jsonReadsApibuilderCommonReferenceGuid: play.api.libs.json.Reads[ReferenceGuid] = { - (__ \ "guid").read[_root_.java.util.UUID].map { x => new ReferenceGuid(guid = x) } + implicit def jsonReadsApibuilderCommonReferenceGuid: play.api.libs.json.Reads[io.apibuilder.common.v0.models.ReferenceGuid] = { + (__ \ "guid").read[_root_.java.util.UUID].map { x => ReferenceGuid(guid = x) } } def jsObjectReferenceGuid(obj: io.apibuilder.common.v0.models.ReferenceGuid): play.api.libs.json.JsObject = { @@ -322,8 +322,8 @@ package io.apibuilder.common.v0 { object Constants { val Namespace = "io.apibuilder.common.v0" - val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-common/latest/play_2_8_client" - val Version = "0.16.43" + val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-common/latest/play_2_9_scala_3_client" + val Version = "0.16.48" val VersionMajor = 0 } @@ -350,12 +350,11 @@ package io.apibuilder.common.v0 { "User-Agent" -> Constants.UserAgent, "X-Apidoc-Version" -> Constants.Version, "X-Apidoc-Version-Major" -> Constants.VersionMajor.toString - ).addHttpHeaders(defaultHeaders *) + ).addHttpHeaders(defaultHeaders*) auth.fold(holder) { case Authorization.Basic(username, password) => { holder.withAuth(username, password.getOrElse(""), play.api.libs.ws.WSAuthScheme.BASIC) } - case a => sys.error("Invalid authorization scheme[" + a.getClass + "]") } } @@ -378,30 +377,32 @@ package io.apibuilder.common.v0 { requestHeaders: Seq[(String, String)] = Nil, body: Option[play.api.libs.json.JsValue] = None ): scala.concurrent.Future[play.api.libs.ws.WSResponse] = { + import play.api.libs.ws.WSBodyWritables.writeableOf_JsValue + method.toUpperCase match { case "GET" => { - _logRequest("GET", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).get() + _logRequest("GET", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).get() } case "POST" => { - _logRequest("POST", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders):_*).addQueryStringParameters(queryParameters:_*)).post(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("POST", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders)*).addQueryStringParameters(queryParameters*)).post(body.getOrElse(play.api.libs.json.Json.obj())) } case "PUT" => { - _logRequest("PUT", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders):_*).addQueryStringParameters(queryParameters:_*)).put(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("PUT", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders)*).addQueryStringParameters(queryParameters*)).put(body.getOrElse(play.api.libs.json.Json.obj())) } case "PATCH" => { - _logRequest("PATCH", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).patch(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("PATCH", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).patch(body.getOrElse(play.api.libs.json.Json.obj())) } case "DELETE" => { - _logRequest("DELETE", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).delete() + _logRequest("DELETE", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).delete() } case "HEAD" => { - _logRequest("HEAD", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).head() + _logRequest("HEAD", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).head() } case "OPTIONS" => { - _logRequest("OPTIONS", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).options() + _logRequest("OPTIONS", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).options() } case _ => { - _logRequest(method, _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)) + _logRequest(method, _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)) sys.error("Unsupported method[%s]".format(method)) } } diff --git a/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala b/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala index e5329a73b..921b5653a 100644 --- a/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala +++ b/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-generator/latest/play_2_8_client + * Service version: 0.16.48 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-generator/latest/play_2_9_scala_3_client */ package io.apibuilder.generator.v0.models { @@ -197,7 +197,7 @@ package io.apibuilder.generator.v0.models { } } - implicit def jsonReadsApibuilderGeneratorAttribute: play.api.libs.json.Reads[Attribute] = { + implicit def jsonReadsApibuilderGeneratorAttribute: play.api.libs.json.Reads[io.apibuilder.generator.v0.models.Attribute] = { for { name <- (__ \ "name").read[String] value <- (__ \ "value").read[String] @@ -217,7 +217,7 @@ package io.apibuilder.generator.v0.models { } } - implicit def jsonReadsApibuilderGeneratorError: play.api.libs.json.Reads[Error] = { + implicit def jsonReadsApibuilderGeneratorError: play.api.libs.json.Reads[io.apibuilder.generator.v0.models.Error] = { for { code <- (__ \ "code").read[String] message <- (__ \ "message").read[String] @@ -237,7 +237,7 @@ package io.apibuilder.generator.v0.models { } } - implicit def jsonReadsApibuilderGeneratorFile: play.api.libs.json.Reads[File] = { + implicit def jsonReadsApibuilderGeneratorFile: play.api.libs.json.Reads[io.apibuilder.generator.v0.models.File] = { for { name <- (__ \ "name").read[String] dir <- (__ \ "dir").readNullable[String] @@ -266,7 +266,7 @@ package io.apibuilder.generator.v0.models { } } - implicit def jsonReadsApibuilderGeneratorGenerator: play.api.libs.json.Reads[Generator] = { + implicit def jsonReadsApibuilderGeneratorGenerator: play.api.libs.json.Reads[io.apibuilder.generator.v0.models.Generator] = { for { key <- (__ \ "key").read[String] name <- (__ \ "name").read[String] @@ -297,8 +297,8 @@ package io.apibuilder.generator.v0.models { } } - implicit def jsonReadsApibuilderGeneratorHealthcheck: play.api.libs.json.Reads[Healthcheck] = { - (__ \ "status").read[String].map { x => new Healthcheck(status = x) } + implicit def jsonReadsApibuilderGeneratorHealthcheck: play.api.libs.json.Reads[io.apibuilder.generator.v0.models.Healthcheck] = { + (__ \ "status").read[String].map { x => Healthcheck(status = x) } } def jsObjectHealthcheck(obj: io.apibuilder.generator.v0.models.Healthcheck): play.api.libs.json.JsObject = { @@ -313,7 +313,7 @@ package io.apibuilder.generator.v0.models { } } - implicit def jsonReadsApibuilderGeneratorInvocation: play.api.libs.json.Reads[Invocation] = { + implicit def jsonReadsApibuilderGeneratorInvocation: play.api.libs.json.Reads[io.apibuilder.generator.v0.models.Invocation] = { for { source <- (__ \ "source").read[String] files <- (__ \ "files").read[Seq[io.apibuilder.generator.v0.models.File]] @@ -333,7 +333,7 @@ package io.apibuilder.generator.v0.models { } } - implicit def jsonReadsApibuilderGeneratorInvocationForm: play.api.libs.json.Reads[InvocationForm] = { + implicit def jsonReadsApibuilderGeneratorInvocationForm: play.api.libs.json.Reads[io.apibuilder.generator.v0.models.InvocationForm] = { for { service <- (__ \ "service").read[io.apibuilder.spec.v0.models.Service] attributes <- (__ \ "attributes").read[Seq[io.apibuilder.generator.v0.models.Attribute]] @@ -483,8 +483,8 @@ package io.apibuilder.generator.v0 { val BaseUrl = "https://api.apibuilder.io" val Namespace = "io.apibuilder.generator.v0" - val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-generator/latest/play_2_8_client" - val Version = "0.16.43" + val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-generator/latest/play_2_9_scala_3_client" + val Version = "0.16.48" val VersionMajor = 0 } @@ -573,12 +573,11 @@ package io.apibuilder.generator.v0 { "User-Agent" -> Constants.UserAgent, "X-Apidoc-Version" -> Constants.Version, "X-Apidoc-Version-Major" -> Constants.VersionMajor.toString - ).addHttpHeaders(defaultHeaders *) + ).addHttpHeaders(defaultHeaders*) auth.fold(holder) { case Authorization.Basic(username, password) => { holder.withAuth(username, password.getOrElse(""), play.api.libs.ws.WSAuthScheme.BASIC) } - case a => sys.error("Invalid authorization scheme[" + a.getClass + "]") } } @@ -601,30 +600,32 @@ package io.apibuilder.generator.v0 { requestHeaders: Seq[(String, String)] = Nil, body: Option[play.api.libs.json.JsValue] = None ): scala.concurrent.Future[play.api.libs.ws.WSResponse] = { + import play.api.libs.ws.WSBodyWritables.writeableOf_JsValue + method.toUpperCase match { case "GET" => { - _logRequest("GET", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).get() + _logRequest("GET", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).get() } case "POST" => { - _logRequest("POST", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders):_*).addQueryStringParameters(queryParameters:_*)).post(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("POST", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders)*).addQueryStringParameters(queryParameters*)).post(body.getOrElse(play.api.libs.json.Json.obj())) } case "PUT" => { - _logRequest("PUT", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders):_*).addQueryStringParameters(queryParameters:_*)).put(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("PUT", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders)*).addQueryStringParameters(queryParameters*)).put(body.getOrElse(play.api.libs.json.Json.obj())) } case "PATCH" => { - _logRequest("PATCH", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).patch(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("PATCH", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).patch(body.getOrElse(play.api.libs.json.Json.obj())) } case "DELETE" => { - _logRequest("DELETE", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).delete() + _logRequest("DELETE", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).delete() } case "HEAD" => { - _logRequest("HEAD", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).head() + _logRequest("HEAD", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).head() } case "OPTIONS" => { - _logRequest("OPTIONS", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).options() + _logRequest("OPTIONS", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).options() } case _ => { - _logRequest(method, _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)) + _logRequest(method, _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)) sys.error("Unsupported method[%s]".format(method)) } } diff --git a/generated/app/ApicollectiveApibuilderSpecV0Client.scala b/generated/app/ApicollectiveApibuilderSpecV0Client.scala index b5c2c69c8..e7140a550 100644 --- a/generated/app/ApicollectiveApibuilderSpecV0Client.scala +++ b/generated/app/ApicollectiveApibuilderSpecV0Client.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/play_2_8_client + * Service version: 0.16.48 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/play_2_9_scala_3_client */ package io.apibuilder.spec.v0.models { @@ -582,7 +582,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecAnnotation: play.api.libs.json.Reads[Annotation] = { + implicit def jsonReadsApibuilderSpecAnnotation: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Annotation] = { for { name <- (__ \ "name").read[String] description <- (__ \ "description").readNullable[String] @@ -609,8 +609,8 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecApidoc: play.api.libs.json.Reads[Apidoc] = { - (__ \ "version").read[String].map { x => new Apidoc(version = x) } + implicit def jsonReadsApibuilderSpecApidoc: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Apidoc] = { + (__ \ "version").read[String].map { x => Apidoc(version = x) } } def jsObjectApidoc(obj: io.apibuilder.spec.v0.models.Apidoc): play.api.libs.json.JsObject = { @@ -625,8 +625,8 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecApplication: play.api.libs.json.Reads[Application] = { - (__ \ "key").read[String].map { x => new Application(key = x) } + implicit def jsonReadsApibuilderSpecApplication: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Application] = { + (__ \ "key").read[String].map { x => Application(key = x) } } def jsObjectApplication(obj: io.apibuilder.spec.v0.models.Application): play.api.libs.json.JsObject = { @@ -641,7 +641,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecAttribute: play.api.libs.json.Reads[Attribute] = { + implicit def jsonReadsApibuilderSpecAttribute: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Attribute] = { for { name <- (__ \ "name").read[String] value <- (__ \ "value").read[_root_.play.api.libs.json.JsObject] @@ -670,7 +670,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecBody: play.api.libs.json.Reads[Body] = { + implicit def jsonReadsApibuilderSpecBody: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Body] = { for { `type` <- (__ \ "type").read[String] description <- (__ \ "description").readNullable[String] @@ -699,7 +699,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecContact: play.api.libs.json.Reads[Contact] = { + implicit def jsonReadsApibuilderSpecContact: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Contact] = { for { name <- (__ \ "name").readNullable[String] url <- (__ \ "url").readNullable[String] @@ -728,8 +728,8 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecDeprecation: play.api.libs.json.Reads[Deprecation] = { - (__ \ "description").readNullable[String].map { x => new Deprecation(description = x) } + implicit def jsonReadsApibuilderSpecDeprecation: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Deprecation] = { + (__ \ "description").readNullable[String].map { x => Deprecation(description = x) } } def jsObjectDeprecation(obj: io.apibuilder.spec.v0.models.Deprecation): play.api.libs.json.JsObject = { @@ -745,7 +745,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecEnum: play.api.libs.json.Reads[Enum] = { + implicit def jsonReadsApibuilderSpecEnum: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Enum] = { for { name <- (__ \ "name").read[String] plural <- (__ \ "plural").read[String] @@ -778,7 +778,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecEnumValue: play.api.libs.json.Reads[EnumValue] = { + implicit def jsonReadsApibuilderSpecEnumValue: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.EnumValue] = { for { name <- (__ \ "name").read[String] description <- (__ \ "description").readNullable[String] @@ -812,7 +812,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecField: play.api.libs.json.Reads[Field] = { + implicit def jsonReadsApibuilderSpecField: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Field] = { for { name <- (__ \ "name").read[String] `type` <- (__ \ "type").read[String] @@ -867,7 +867,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecHeader: play.api.libs.json.Reads[Header] = { + implicit def jsonReadsApibuilderSpecHeader: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Header] = { for { name <- (__ \ "name").read[String] `type` <- (__ \ "type").read[String] @@ -905,7 +905,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecImport: play.api.libs.json.Reads[Import] = { + implicit def jsonReadsApibuilderSpecImport: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Import] = { for { uri <- (__ \ "uri").read[String] namespace <- (__ \ "namespace").read[String] @@ -941,7 +941,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecInfo: play.api.libs.json.Reads[Info] = { + implicit def jsonReadsApibuilderSpecInfo: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Info] = { for { license <- (__ \ "license").readNullable[io.apibuilder.spec.v0.models.License] contact <- (__ \ "contact").readNullable[io.apibuilder.spec.v0.models.Contact] @@ -965,7 +965,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecInterface: play.api.libs.json.Reads[Interface] = { + implicit def jsonReadsApibuilderSpecInterface: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Interface] = { for { name <- (__ \ "name").read[String] plural <- (__ \ "plural").read[String] @@ -998,7 +998,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecLicense: play.api.libs.json.Reads[License] = { + implicit def jsonReadsApibuilderSpecLicense: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.License] = { for { name <- (__ \ "name").read[String] url <- (__ \ "url").readNullable[String] @@ -1020,7 +1020,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecModel: play.api.libs.json.Reads[Model] = { + implicit def jsonReadsApibuilderSpecModel: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Model] = { for { name <- (__ \ "name").read[String] plural <- (__ \ "plural").read[String] @@ -1055,7 +1055,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecOperation: play.api.libs.json.Reads[Operation] = { + implicit def jsonReadsApibuilderSpecOperation: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Operation] = { for { method <- (__ \ "method").read[io.apibuilder.spec.v0.models.Method] path <- (__ \ "path").read[String] @@ -1095,8 +1095,8 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecOrganization: play.api.libs.json.Reads[Organization] = { - (__ \ "key").read[String].map { x => new Organization(key = x) } + implicit def jsonReadsApibuilderSpecOrganization: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Organization] = { + (__ \ "key").read[String].map { x => Organization(key = x) } } def jsObjectOrganization(obj: io.apibuilder.spec.v0.models.Organization): play.api.libs.json.JsObject = { @@ -1111,7 +1111,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecParameter: play.api.libs.json.Reads[Parameter] = { + implicit def jsonReadsApibuilderSpecParameter: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Parameter] = { for { name <- (__ \ "name").read[String] `type` <- (__ \ "type").read[String] @@ -1169,7 +1169,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecResource: play.api.libs.json.Reads[Resource] = { + implicit def jsonReadsApibuilderSpecResource: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Resource] = { for { `type` <- (__ \ "type").read[String] plural <- (__ \ "plural").read[String] @@ -1207,7 +1207,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecResponse: play.api.libs.json.Reads[Response] = { + implicit def jsonReadsApibuilderSpecResponse: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Response] = { for { code <- (__ \ "code").read[io.apibuilder.spec.v0.models.ResponseCode] `type` <- (__ \ "type").read[String] @@ -1246,7 +1246,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecService: play.api.libs.json.Reads[Service] = { + implicit def jsonReadsApibuilderSpecService: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Service] = { for { apidoc <- (__ \ "apidoc").readNullable[io.apibuilder.spec.v0.models.Apidoc] name <- (__ \ "name").read[String] @@ -1306,7 +1306,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecUnion: play.api.libs.json.Reads[Union] = { + implicit def jsonReadsApibuilderSpecUnion: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Union] = { for { name <- (__ \ "name").read[String] plural <- (__ \ "plural").read[String] @@ -1346,7 +1346,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecUnionType: play.api.libs.json.Reads[UnionType] = { + implicit def jsonReadsApibuilderSpecUnionType: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.UnionType] = { for { `type` <- (__ \ "type").read[String] description <- (__ \ "description").readNullable[String] @@ -1385,11 +1385,11 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonReadsApibuilderSpecResponseCodeInt: play.api.libs.json.Reads[ResponseCodeInt] = { - (__ \ "value").read[Int].map { x => new ResponseCodeInt(value = x) } + implicit def jsonReadsApibuilderSpecResponseCodeInt: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.ResponseCodeInt] = { + (__ \ "value").read[Int].map { x => ResponseCodeInt(value = x) } } - implicit def jsonReadsApibuilderSpecResponseCode: play.api.libs.json.Reads[ResponseCode] = { + implicit def jsonReadsApibuilderSpecResponseCode[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[T] = { ( (__ \ "integer").read(jsonReadsApibuilderSpecResponseCodeInt).asInstanceOf[play.api.libs.json.Reads[ResponseCode]] orElse @@ -1399,6 +1399,19 @@ package io.apibuilder.spec.v0.models { ) } + + implicit def jsonReadsApibuilderSpecResponseCodeSeq[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[Seq[T]] = { + case a: play.api.libs.json.JsArray => { + val all: Seq[play.api.libs.json.JsResult[io.apibuilder.spec.v0.models.ResponseCode]] = a.value.map(jsonReadsApibuilderSpecResponseCode.reads).toSeq + + all.collect { case e: play.api.libs.json.JsError => e }.toList match { + case Nil => play.api.libs.json.JsSuccess(all.collect { case play.api.libs.json.JsSuccess(v, _) => v.asInstanceOf[T] }) + case errors => play.api.libs.json.JsError(play.api.libs.json.JsError.merge(errors.flatMap(_.errors), Nil)) + } + } + case other => play.api.libs.json.JsError(s"Expected array but found [" + other.getClass.getName + "]") + } + def jsObjectResponseCode(obj: io.apibuilder.spec.v0.models.ResponseCode): play.api.libs.json.JsObject = { obj match { case x: io.apibuilder.spec.v0.models.ResponseCodeInt => play.api.libs.json.Json.obj("integer" -> play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsNumber(x.value))) @@ -1407,7 +1420,7 @@ package io.apibuilder.spec.v0.models { } } - implicit def jsonWritesApibuilderSpecResponseCode: play.api.libs.json.Writes[ResponseCode] = { + implicit def jsonWritesApibuilderSpecResponseCode[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Writes[T] = { (obj: io.apibuilder.spec.v0.models.ResponseCode) => { jsObjectResponseCode(obj) } @@ -1551,8 +1564,8 @@ package io.apibuilder.spec.v0 { object Constants { val Namespace = "io.apibuilder.spec.v0" - val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/play_2_8_client" - val Version = "0.16.43" + val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/play_2_9_scala_3_client" + val Version = "0.16.48" val VersionMajor = 0 } @@ -1579,12 +1592,11 @@ package io.apibuilder.spec.v0 { "User-Agent" -> Constants.UserAgent, "X-Apidoc-Version" -> Constants.Version, "X-Apidoc-Version-Major" -> Constants.VersionMajor.toString - ).addHttpHeaders(defaultHeaders *) + ).addHttpHeaders(defaultHeaders*) auth.fold(holder) { case Authorization.Basic(username, password) => { holder.withAuth(username, password.getOrElse(""), play.api.libs.ws.WSAuthScheme.BASIC) } - case a => sys.error("Invalid authorization scheme[" + a.getClass + "]") } } @@ -1607,30 +1619,32 @@ package io.apibuilder.spec.v0 { requestHeaders: Seq[(String, String)] = Nil, body: Option[play.api.libs.json.JsValue] = None ): scala.concurrent.Future[play.api.libs.ws.WSResponse] = { + import play.api.libs.ws.WSBodyWritables.writeableOf_JsValue + method.toUpperCase match { case "GET" => { - _logRequest("GET", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).get() + _logRequest("GET", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).get() } case "POST" => { - _logRequest("POST", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders):_*).addQueryStringParameters(queryParameters:_*)).post(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("POST", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders)*).addQueryStringParameters(queryParameters*)).post(body.getOrElse(play.api.libs.json.Json.obj())) } case "PUT" => { - _logRequest("PUT", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders):_*).addQueryStringParameters(queryParameters:_*)).put(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("PUT", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders)*).addQueryStringParameters(queryParameters*)).put(body.getOrElse(play.api.libs.json.Json.obj())) } case "PATCH" => { - _logRequest("PATCH", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).patch(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("PATCH", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).patch(body.getOrElse(play.api.libs.json.Json.obj())) } case "DELETE" => { - _logRequest("DELETE", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).delete() + _logRequest("DELETE", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).delete() } case "HEAD" => { - _logRequest("HEAD", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).head() + _logRequest("HEAD", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).head() } case "OPTIONS" => { - _logRequest("OPTIONS", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).options() + _logRequest("OPTIONS", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).options() } case _ => { - _logRequest(method, _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)) + _logRequest(method, _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)) sys.error("Unsupported method[%s]".format(method)) } } diff --git a/generated/app/ApicollectiveApibuilderTaskV0Client.scala b/generated/app/ApicollectiveApibuilderTaskV0Client.scala index 9f7fca241..1d407808e 100644 --- a/generated/app/ApicollectiveApibuilderTaskV0Client.scala +++ b/generated/app/ApicollectiveApibuilderTaskV0Client.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-task/latest/play_2_8_client + * Service version: 0.16.48 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-task/latest/play_2_9_scala_3_client */ package io.apibuilder.task.v0.models { @@ -163,7 +163,7 @@ package io.apibuilder.task.v0.models { } } - implicit def jsonReadsApibuilderTaskDiffVersionData: play.api.libs.json.Reads[DiffVersionData] = { + implicit def jsonReadsApibuilderTaskDiffVersionData: play.api.libs.json.Reads[io.apibuilder.task.v0.models.DiffVersionData] = { for { oldVersionGuid <- (__ \ "old_version_guid").read[_root_.java.util.UUID] newVersionGuid <- (__ \ "new_version_guid").read[_root_.java.util.UUID] @@ -183,8 +183,8 @@ package io.apibuilder.task.v0.models { } } - implicit def jsonReadsApibuilderTaskEmailDataApplicationCreated: play.api.libs.json.Reads[EmailDataApplicationCreated] = { - (__ \ "application_guid").read[_root_.java.util.UUID].map { x => new EmailDataApplicationCreated(applicationGuid = x) } + def jsonReadsApibuilderTaskEmailDataApplicationCreated: play.api.libs.json.Reads[io.apibuilder.task.v0.models.EmailDataApplicationCreated] = { + (__ \ "application_guid").read[_root_.java.util.UUID].map { x => EmailDataApplicationCreated(applicationGuid = x) } } def jsObjectEmailDataApplicationCreated(obj: io.apibuilder.task.v0.models.EmailDataApplicationCreated): play.api.libs.json.JsObject = { @@ -193,14 +193,14 @@ package io.apibuilder.task.v0.models { ) } - implicit def jsonWritesApibuilderTaskEmailDataApplicationCreated: play.api.libs.json.Writes[EmailDataApplicationCreated] = { + def jsonWritesApibuilderTaskEmailDataApplicationCreated: play.api.libs.json.Writes[EmailDataApplicationCreated] = { (obj: io.apibuilder.task.v0.models.EmailDataApplicationCreated) => { jsObjectEmailDataApplicationCreated(obj) } } - implicit def jsonReadsApibuilderTaskEmailDataEmailVerificationCreated: play.api.libs.json.Reads[EmailDataEmailVerificationCreated] = { - (__ \ "guid").read[_root_.java.util.UUID].map { x => new EmailDataEmailVerificationCreated(guid = x) } + def jsonReadsApibuilderTaskEmailDataEmailVerificationCreated: play.api.libs.json.Reads[io.apibuilder.task.v0.models.EmailDataEmailVerificationCreated] = { + (__ \ "guid").read[_root_.java.util.UUID].map { x => EmailDataEmailVerificationCreated(guid = x) } } def jsObjectEmailDataEmailVerificationCreated(obj: io.apibuilder.task.v0.models.EmailDataEmailVerificationCreated): play.api.libs.json.JsObject = { @@ -209,14 +209,14 @@ package io.apibuilder.task.v0.models { ) } - implicit def jsonWritesApibuilderTaskEmailDataEmailVerificationCreated: play.api.libs.json.Writes[EmailDataEmailVerificationCreated] = { + def jsonWritesApibuilderTaskEmailDataEmailVerificationCreated: play.api.libs.json.Writes[EmailDataEmailVerificationCreated] = { (obj: io.apibuilder.task.v0.models.EmailDataEmailVerificationCreated) => { jsObjectEmailDataEmailVerificationCreated(obj) } } - implicit def jsonReadsApibuilderTaskEmailDataMembershipCreated: play.api.libs.json.Reads[EmailDataMembershipCreated] = { - (__ \ "guid").read[_root_.java.util.UUID].map { x => new EmailDataMembershipCreated(guid = x) } + def jsonReadsApibuilderTaskEmailDataMembershipCreated: play.api.libs.json.Reads[io.apibuilder.task.v0.models.EmailDataMembershipCreated] = { + (__ \ "guid").read[_root_.java.util.UUID].map { x => EmailDataMembershipCreated(guid = x) } } def jsObjectEmailDataMembershipCreated(obj: io.apibuilder.task.v0.models.EmailDataMembershipCreated): play.api.libs.json.JsObject = { @@ -225,13 +225,13 @@ package io.apibuilder.task.v0.models { ) } - implicit def jsonWritesApibuilderTaskEmailDataMembershipCreated: play.api.libs.json.Writes[EmailDataMembershipCreated] = { + def jsonWritesApibuilderTaskEmailDataMembershipCreated: play.api.libs.json.Writes[EmailDataMembershipCreated] = { (obj: io.apibuilder.task.v0.models.EmailDataMembershipCreated) => { jsObjectEmailDataMembershipCreated(obj) } } - implicit def jsonReadsApibuilderTaskEmailDataMembershipRequestAccepted: play.api.libs.json.Reads[EmailDataMembershipRequestAccepted] = { + def jsonReadsApibuilderTaskEmailDataMembershipRequestAccepted: play.api.libs.json.Reads[io.apibuilder.task.v0.models.EmailDataMembershipRequestAccepted] = { for { organizationGuid <- (__ \ "organization_guid").read[_root_.java.util.UUID] userGuid <- (__ \ "user_guid").read[_root_.java.util.UUID] @@ -247,14 +247,14 @@ package io.apibuilder.task.v0.models { ) } - implicit def jsonWritesApibuilderTaskEmailDataMembershipRequestAccepted: play.api.libs.json.Writes[EmailDataMembershipRequestAccepted] = { + def jsonWritesApibuilderTaskEmailDataMembershipRequestAccepted: play.api.libs.json.Writes[EmailDataMembershipRequestAccepted] = { (obj: io.apibuilder.task.v0.models.EmailDataMembershipRequestAccepted) => { jsObjectEmailDataMembershipRequestAccepted(obj) } } - implicit def jsonReadsApibuilderTaskEmailDataMembershipRequestCreated: play.api.libs.json.Reads[EmailDataMembershipRequestCreated] = { - (__ \ "guid").read[_root_.java.util.UUID].map { x => new EmailDataMembershipRequestCreated(guid = x) } + def jsonReadsApibuilderTaskEmailDataMembershipRequestCreated: play.api.libs.json.Reads[io.apibuilder.task.v0.models.EmailDataMembershipRequestCreated] = { + (__ \ "guid").read[_root_.java.util.UUID].map { x => EmailDataMembershipRequestCreated(guid = x) } } def jsObjectEmailDataMembershipRequestCreated(obj: io.apibuilder.task.v0.models.EmailDataMembershipRequestCreated): play.api.libs.json.JsObject = { @@ -263,13 +263,13 @@ package io.apibuilder.task.v0.models { ) } - implicit def jsonWritesApibuilderTaskEmailDataMembershipRequestCreated: play.api.libs.json.Writes[EmailDataMembershipRequestCreated] = { + def jsonWritesApibuilderTaskEmailDataMembershipRequestCreated: play.api.libs.json.Writes[EmailDataMembershipRequestCreated] = { (obj: io.apibuilder.task.v0.models.EmailDataMembershipRequestCreated) => { jsObjectEmailDataMembershipRequestCreated(obj) } } - implicit def jsonReadsApibuilderTaskEmailDataMembershipRequestDeclined: play.api.libs.json.Reads[EmailDataMembershipRequestDeclined] = { + def jsonReadsApibuilderTaskEmailDataMembershipRequestDeclined: play.api.libs.json.Reads[io.apibuilder.task.v0.models.EmailDataMembershipRequestDeclined] = { for { organizationGuid <- (__ \ "organization_guid").read[_root_.java.util.UUID] userGuid <- (__ \ "user_guid").read[_root_.java.util.UUID] @@ -283,14 +283,14 @@ package io.apibuilder.task.v0.models { ) } - implicit def jsonWritesApibuilderTaskEmailDataMembershipRequestDeclined: play.api.libs.json.Writes[EmailDataMembershipRequestDeclined] = { + def jsonWritesApibuilderTaskEmailDataMembershipRequestDeclined: play.api.libs.json.Writes[EmailDataMembershipRequestDeclined] = { (obj: io.apibuilder.task.v0.models.EmailDataMembershipRequestDeclined) => { jsObjectEmailDataMembershipRequestDeclined(obj) } } - implicit def jsonReadsApibuilderTaskEmailDataPasswordResetRequestCreated: play.api.libs.json.Reads[EmailDataPasswordResetRequestCreated] = { - (__ \ "guid").read[_root_.java.util.UUID].map { x => new EmailDataPasswordResetRequestCreated(guid = x) } + def jsonReadsApibuilderTaskEmailDataPasswordResetRequestCreated: play.api.libs.json.Reads[io.apibuilder.task.v0.models.EmailDataPasswordResetRequestCreated] = { + (__ \ "guid").read[_root_.java.util.UUID].map { x => EmailDataPasswordResetRequestCreated(guid = x) } } def jsObjectEmailDataPasswordResetRequestCreated(obj: io.apibuilder.task.v0.models.EmailDataPasswordResetRequestCreated): play.api.libs.json.JsObject = { @@ -299,13 +299,13 @@ package io.apibuilder.task.v0.models { ) } - implicit def jsonWritesApibuilderTaskEmailDataPasswordResetRequestCreated: play.api.libs.json.Writes[EmailDataPasswordResetRequestCreated] = { + def jsonWritesApibuilderTaskEmailDataPasswordResetRequestCreated: play.api.libs.json.Writes[EmailDataPasswordResetRequestCreated] = { (obj: io.apibuilder.task.v0.models.EmailDataPasswordResetRequestCreated) => { jsObjectEmailDataPasswordResetRequestCreated(obj) } } - implicit def jsonReadsApibuilderTaskEmailData: play.api.libs.json.Reads[EmailData] = { + implicit def jsonReadsApibuilderTaskEmailData[T <: io.apibuilder.task.v0.models.EmailData]: play.api.libs.json.Reads[T] = { ( (__ \ "email_data_application_created").read(jsonReadsApibuilderTaskEmailDataApplicationCreated).asInstanceOf[play.api.libs.json.Reads[EmailData]] orElse @@ -325,6 +325,19 @@ package io.apibuilder.task.v0.models { ) } + + implicit def jsonReadsApibuilderTaskEmailDataSeq[T <: io.apibuilder.task.v0.models.EmailData]: play.api.libs.json.Reads[Seq[T]] = { + case a: play.api.libs.json.JsArray => { + val all: Seq[play.api.libs.json.JsResult[io.apibuilder.task.v0.models.EmailData]] = a.value.map(jsonReadsApibuilderTaskEmailData.reads).toSeq + + all.collect { case e: play.api.libs.json.JsError => e }.toList match { + case Nil => play.api.libs.json.JsSuccess(all.collect { case play.api.libs.json.JsSuccess(v, _) => v.asInstanceOf[T] }) + case errors => play.api.libs.json.JsError(play.api.libs.json.JsError.merge(errors.flatMap(_.errors), Nil)) + } + } + case other => play.api.libs.json.JsError(s"Expected array but found [" + other.getClass.getName + "]") + } + def jsObjectEmailData(obj: io.apibuilder.task.v0.models.EmailData): play.api.libs.json.JsObject = { obj match { case x: io.apibuilder.task.v0.models.EmailDataApplicationCreated => play.api.libs.json.Json.obj("email_data_application_created" -> jsObjectEmailDataApplicationCreated(x)) @@ -338,7 +351,7 @@ package io.apibuilder.task.v0.models { } } - implicit def jsonWritesApibuilderTaskEmailData: play.api.libs.json.Writes[EmailData] = { + implicit def jsonWritesApibuilderTaskEmailData[T <: io.apibuilder.task.v0.models.EmailData]: play.api.libs.json.Writes[T] = { (obj: io.apibuilder.task.v0.models.EmailData) => { jsObjectEmailData(obj) } @@ -464,8 +477,8 @@ package io.apibuilder.task.v0 { object Constants { val Namespace = "io.apibuilder.task.v0" - val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-task/latest/play_2_8_client" - val Version = "0.16.43" + val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-task/latest/play_2_9_scala_3_client" + val Version = "0.16.48" val VersionMajor = 0 } @@ -493,12 +506,11 @@ package io.apibuilder.task.v0 { "User-Agent" -> Constants.UserAgent, "X-Apidoc-Version" -> Constants.Version, "X-Apidoc-Version-Major" -> Constants.VersionMajor.toString - ).addHttpHeaders(defaultHeaders *) + ).addHttpHeaders(defaultHeaders*) auth.fold(holder) { case Authorization.Basic(username, password) => { holder.withAuth(username, password.getOrElse(""), play.api.libs.ws.WSAuthScheme.BASIC) } - case a => sys.error("Invalid authorization scheme[" + a.getClass + "]") } } @@ -521,30 +533,32 @@ package io.apibuilder.task.v0 { requestHeaders: Seq[(String, String)] = Nil, body: Option[play.api.libs.json.JsValue] = None ): scala.concurrent.Future[play.api.libs.ws.WSResponse] = { + import play.api.libs.ws.WSBodyWritables.writeableOf_JsValue + method.toUpperCase match { case "GET" => { - _logRequest("GET", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).get() + _logRequest("GET", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).get() } case "POST" => { - _logRequest("POST", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders):_*).addQueryStringParameters(queryParameters:_*)).post(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("POST", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders)*).addQueryStringParameters(queryParameters*)).post(body.getOrElse(play.api.libs.json.Json.obj())) } case "PUT" => { - _logRequest("PUT", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders):_*).addQueryStringParameters(queryParameters:_*)).put(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("PUT", _requestHolder(path).addHttpHeaders(_withJsonContentType(requestHeaders)*).addQueryStringParameters(queryParameters*)).put(body.getOrElse(play.api.libs.json.Json.obj())) } case "PATCH" => { - _logRequest("PATCH", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).patch(body.getOrElse(play.api.libs.json.Json.obj())) + _logRequest("PATCH", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).patch(body.getOrElse(play.api.libs.json.Json.obj())) } case "DELETE" => { - _logRequest("DELETE", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).delete() + _logRequest("DELETE", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).delete() } case "HEAD" => { - _logRequest("HEAD", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).head() + _logRequest("HEAD", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).head() } case "OPTIONS" => { - _logRequest("OPTIONS", _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)).options() + _logRequest("OPTIONS", _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)).options() } case _ => { - _logRequest(method, _requestHolder(path).addHttpHeaders(requestHeaders:_*).addQueryStringParameters(queryParameters:_*)) + _logRequest(method, _requestHolder(path).addHttpHeaders(requestHeaders*).addQueryStringParameters(queryParameters*)) sys.error("Unsupported method[%s]".format(method)) } } From db18e089d944f4acc3d15f2300300dd6e8d5a845 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 2 Jul 2024 17:34:27 -0400 Subject: [PATCH 04/95] wip --- .../ApicollectiveApibuilderTaskV0Client.scala | 135 ++++++++++++------ spec/apibuilder-task.json | 1 + 2 files changed, 92 insertions(+), 44 deletions(-) diff --git a/generated/app/ApicollectiveApibuilderTaskV0Client.scala b/generated/app/ApicollectiveApibuilderTaskV0Client.scala index 1d407808e..fb728ebef 100644 --- a/generated/app/ApicollectiveApibuilderTaskV0Client.scala +++ b/generated/app/ApicollectiveApibuilderTaskV0Client.scala @@ -1,11 +1,41 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.48 + * Service version: 0.16.50 * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-task/latest/play_2_9_scala_3_client */ package io.apibuilder.task.v0.models { - sealed trait EmailData extends _root_.scala.Product with _root_.scala.Serializable + sealed trait EmailData extends _root_.scala.Product with _root_.scala.Serializable { + def emailDataDiscriminator: EmailDataDiscriminator + + } + + /** + * Defines the valid discriminator values for the type EmailData + */ + sealed trait EmailDataDiscriminator extends _root_.scala.Product with _root_.scala.Serializable + + object EmailDataDiscriminator { + + case object EmailDataApplicationCreated extends EmailDataDiscriminator { override def toString = "email_data_application_created" } + case object EmailDataEmailVerificationCreated extends EmailDataDiscriminator { override def toString = "email_data_email_verification_created" } + case object EmailDataMembershipCreated extends EmailDataDiscriminator { override def toString = "email_data_membership_created" } + case object EmailDataMembershipRequestCreated extends EmailDataDiscriminator { override def toString = "email_data_membership_request_created" } + case object EmailDataMembershipRequestAccepted extends EmailDataDiscriminator { override def toString = "email_data_membership_request_accepted" } + case object EmailDataMembershipRequestDeclined extends EmailDataDiscriminator { override def toString = "email_data_membership_request_declined" } + case object EmailDataPasswordResetRequestCreated extends EmailDataDiscriminator { override def toString = "email_data_password_reset_request_created" } + + final case class UNDEFINED(override val toString: String) extends EmailDataDiscriminator + + val all: scala.List[EmailDataDiscriminator] = scala.List(EmailDataApplicationCreated, EmailDataEmailVerificationCreated, EmailDataMembershipCreated, EmailDataMembershipRequestCreated, EmailDataMembershipRequestAccepted, EmailDataMembershipRequestDeclined, EmailDataPasswordResetRequestCreated) + + private val byName: Map[String, EmailDataDiscriminator] = all.map(x => x.toString.toLowerCase -> x).toMap + + def apply(value: String): EmailDataDiscriminator = fromString(value).getOrElse(UNDEFINED(value)) + + def fromString(value: String): _root_.scala.Option[EmailDataDiscriminator] = byName.get(value.toLowerCase) + + } final case class DiffVersionData( oldVersionGuid: _root_.java.util.UUID, newVersionGuid: _root_.java.util.UUID @@ -13,34 +43,48 @@ package io.apibuilder.task.v0.models { final case class EmailDataApplicationCreated( applicationGuid: _root_.java.util.UUID - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.EmailDataApplicationCreated + } final case class EmailDataEmailVerificationCreated( guid: _root_.java.util.UUID - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.EmailDataEmailVerificationCreated + } final case class EmailDataMembershipCreated( guid: _root_.java.util.UUID - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.EmailDataMembershipCreated + } final case class EmailDataMembershipRequestAccepted( organizationGuid: _root_.java.util.UUID, userGuid: _root_.java.util.UUID, role: io.apibuilder.common.v0.models.MembershipRole - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.EmailDataMembershipRequestAccepted + } final case class EmailDataMembershipRequestCreated( guid: _root_.java.util.UUID - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.EmailDataMembershipRequestCreated + } final case class EmailDataMembershipRequestDeclined( organizationGuid: _root_.java.util.UUID, userGuid: _root_.java.util.UUID - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.EmailDataMembershipRequestDeclined + } final case class EmailDataPasswordResetRequestCreated( guid: _root_.java.util.UUID - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.EmailDataPasswordResetRequestCreated + } /** * Provides future compatibility in clients - in the future, when a type is added @@ -53,7 +97,9 @@ package io.apibuilder.task.v0.models { final case class EmailDataUndefinedType( description: String - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.UNDEFINED(description) + } sealed trait TaskType extends _root_.scala.Product with _root_.scala.Serializable object TaskType { @@ -190,7 +236,7 @@ package io.apibuilder.task.v0.models { def jsObjectEmailDataApplicationCreated(obj: io.apibuilder.task.v0.models.EmailDataApplicationCreated): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "application_guid" -> play.api.libs.json.JsString(obj.applicationGuid.toString) - ) + ) ++ play.api.libs.json.Json.obj("discriminator" -> "email_data_application_created") } def jsonWritesApibuilderTaskEmailDataApplicationCreated: play.api.libs.json.Writes[EmailDataApplicationCreated] = { @@ -206,7 +252,7 @@ package io.apibuilder.task.v0.models { def jsObjectEmailDataEmailVerificationCreated(obj: io.apibuilder.task.v0.models.EmailDataEmailVerificationCreated): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString) - ) + ) ++ play.api.libs.json.Json.obj("discriminator" -> "email_data_email_verification_created") } def jsonWritesApibuilderTaskEmailDataEmailVerificationCreated: play.api.libs.json.Writes[EmailDataEmailVerificationCreated] = { @@ -222,7 +268,7 @@ package io.apibuilder.task.v0.models { def jsObjectEmailDataMembershipCreated(obj: io.apibuilder.task.v0.models.EmailDataMembershipCreated): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString) - ) + ) ++ play.api.libs.json.Json.obj("discriminator" -> "email_data_membership_created") } def jsonWritesApibuilderTaskEmailDataMembershipCreated: play.api.libs.json.Writes[EmailDataMembershipCreated] = { @@ -244,7 +290,7 @@ package io.apibuilder.task.v0.models { "organization_guid" -> play.api.libs.json.JsString(obj.organizationGuid.toString), "user_guid" -> play.api.libs.json.JsString(obj.userGuid.toString), "role" -> play.api.libs.json.JsString(obj.role.toString) - ) + ) ++ play.api.libs.json.Json.obj("discriminator" -> "email_data_membership_request_accepted") } def jsonWritesApibuilderTaskEmailDataMembershipRequestAccepted: play.api.libs.json.Writes[EmailDataMembershipRequestAccepted] = { @@ -260,7 +306,7 @@ package io.apibuilder.task.v0.models { def jsObjectEmailDataMembershipRequestCreated(obj: io.apibuilder.task.v0.models.EmailDataMembershipRequestCreated): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString) - ) + ) ++ play.api.libs.json.Json.obj("discriminator" -> "email_data_membership_request_created") } def jsonWritesApibuilderTaskEmailDataMembershipRequestCreated: play.api.libs.json.Writes[EmailDataMembershipRequestCreated] = { @@ -280,7 +326,7 @@ package io.apibuilder.task.v0.models { play.api.libs.json.Json.obj( "organization_guid" -> play.api.libs.json.JsString(obj.organizationGuid.toString), "user_guid" -> play.api.libs.json.JsString(obj.userGuid.toString) - ) + ) ++ play.api.libs.json.Json.obj("discriminator" -> "email_data_membership_request_declined") } def jsonWritesApibuilderTaskEmailDataMembershipRequestDeclined: play.api.libs.json.Writes[EmailDataMembershipRequestDeclined] = { @@ -296,7 +342,7 @@ package io.apibuilder.task.v0.models { def jsObjectEmailDataPasswordResetRequestCreated(obj: io.apibuilder.task.v0.models.EmailDataPasswordResetRequestCreated): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString) - ) + ) ++ play.api.libs.json.Json.obj("discriminator" -> "email_data_password_reset_request_created") } def jsonWritesApibuilderTaskEmailDataPasswordResetRequestCreated: play.api.libs.json.Writes[EmailDataPasswordResetRequestCreated] = { @@ -305,24 +351,23 @@ package io.apibuilder.task.v0.models { } } - implicit def jsonReadsApibuilderTaskEmailData[T <: io.apibuilder.task.v0.models.EmailData]: play.api.libs.json.Reads[T] = { - ( - (__ \ "email_data_application_created").read(jsonReadsApibuilderTaskEmailDataApplicationCreated).asInstanceOf[play.api.libs.json.Reads[EmailData]] - orElse - (__ \ "email_data_email_verification_created").read(jsonReadsApibuilderTaskEmailDataEmailVerificationCreated).asInstanceOf[play.api.libs.json.Reads[EmailData]] - orElse - (__ \ "email_data_membership_created").read(jsonReadsApibuilderTaskEmailDataMembershipCreated).asInstanceOf[play.api.libs.json.Reads[EmailData]] - orElse - (__ \ "email_data_membership_request_created").read(jsonReadsApibuilderTaskEmailDataMembershipRequestCreated).asInstanceOf[play.api.libs.json.Reads[EmailData]] - orElse - (__ \ "email_data_membership_request_accepted").read(jsonReadsApibuilderTaskEmailDataMembershipRequestAccepted).asInstanceOf[play.api.libs.json.Reads[EmailData]] - orElse - (__ \ "email_data_membership_request_declined").read(jsonReadsApibuilderTaskEmailDataMembershipRequestDeclined).asInstanceOf[play.api.libs.json.Reads[EmailData]] - orElse - (__ \ "email_data_password_reset_request_created").read(jsonReadsApibuilderTaskEmailDataPasswordResetRequestCreated).asInstanceOf[play.api.libs.json.Reads[EmailData]] - orElse - play.api.libs.json.Reads(jsValue => play.api.libs.json.JsSuccess(EmailDataUndefinedType(jsValue.toString))).asInstanceOf[play.api.libs.json.Reads[EmailData]] - ) + implicit def jsonReadsApibuilderTaskEmailData[T <: io.apibuilder.task.v0.models.EmailData]: play.api.libs.json.Reads[T] = (js: play.api.libs.json.JsValue) => { + def readDiscriminator(discriminator: String) = { + discriminator match { + case "email_data_application_created" => jsonReadsApibuilderTaskEmailDataApplicationCreated.reads(js) + case "email_data_email_verification_created" => jsonReadsApibuilderTaskEmailDataEmailVerificationCreated.reads(js) + case "email_data_membership_created" => jsonReadsApibuilderTaskEmailDataMembershipCreated.reads(js) + case "email_data_membership_request_created" => jsonReadsApibuilderTaskEmailDataMembershipRequestCreated.reads(js) + case "email_data_membership_request_accepted" => jsonReadsApibuilderTaskEmailDataMembershipRequestAccepted.reads(js) + case "email_data_membership_request_declined" => jsonReadsApibuilderTaskEmailDataMembershipRequestDeclined.reads(js) + case "email_data_password_reset_request_created" => jsonReadsApibuilderTaskEmailDataPasswordResetRequestCreated.reads(js) + case other => play.api.libs.json.JsSuccess(io.apibuilder.task.v0.models.EmailDataUndefinedType(other)) + } + } + (js \ "discriminator").validate[String] match { + case e: play.api.libs.json.JsError => e + case s: play.api.libs.json.JsSuccess[String] => readDiscriminator(s.value).map(_.asInstanceOf[T]) + } } @@ -340,14 +385,16 @@ package io.apibuilder.task.v0.models { def jsObjectEmailData(obj: io.apibuilder.task.v0.models.EmailData): play.api.libs.json.JsObject = { obj match { - case x: io.apibuilder.task.v0.models.EmailDataApplicationCreated => play.api.libs.json.Json.obj("email_data_application_created" -> jsObjectEmailDataApplicationCreated(x)) - case x: io.apibuilder.task.v0.models.EmailDataEmailVerificationCreated => play.api.libs.json.Json.obj("email_data_email_verification_created" -> jsObjectEmailDataEmailVerificationCreated(x)) - case x: io.apibuilder.task.v0.models.EmailDataMembershipCreated => play.api.libs.json.Json.obj("email_data_membership_created" -> jsObjectEmailDataMembershipCreated(x)) - case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestCreated => play.api.libs.json.Json.obj("email_data_membership_request_created" -> jsObjectEmailDataMembershipRequestCreated(x)) - case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestAccepted => play.api.libs.json.Json.obj("email_data_membership_request_accepted" -> jsObjectEmailDataMembershipRequestAccepted(x)) - case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestDeclined => play.api.libs.json.Json.obj("email_data_membership_request_declined" -> jsObjectEmailDataMembershipRequestDeclined(x)) - case x: io.apibuilder.task.v0.models.EmailDataPasswordResetRequestCreated => play.api.libs.json.Json.obj("email_data_password_reset_request_created" -> jsObjectEmailDataPasswordResetRequestCreated(x)) - case x: io.apibuilder.task.v0.models.EmailDataUndefinedType => sys.error(s"The type[io.apibuilder.task.v0.models.EmailDataUndefinedType] should never be serialized") + case x: io.apibuilder.task.v0.models.EmailDataApplicationCreated => jsObjectEmailDataApplicationCreated(x) + case x: io.apibuilder.task.v0.models.EmailDataEmailVerificationCreated => jsObjectEmailDataEmailVerificationCreated(x) + case x: io.apibuilder.task.v0.models.EmailDataMembershipCreated => jsObjectEmailDataMembershipCreated(x) + case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestCreated => jsObjectEmailDataMembershipRequestCreated(x) + case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestAccepted => jsObjectEmailDataMembershipRequestAccepted(x) + case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestDeclined => jsObjectEmailDataMembershipRequestDeclined(x) + case x: io.apibuilder.task.v0.models.EmailDataPasswordResetRequestCreated => jsObjectEmailDataPasswordResetRequestCreated(x) + case other => { + sys.error(s"The type[${other.getClass.getName}] has no JSON writer") + } } } @@ -478,7 +525,7 @@ package io.apibuilder.task.v0 { val Namespace = "io.apibuilder.task.v0" val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-task/latest/play_2_9_scala_3_client" - val Version = "0.16.48" + val Version = "0.16.50" val VersionMajor = 0 } diff --git a/spec/apibuilder-task.json b/spec/apibuilder-task.json index 981ce800f..0ca3c4958 100644 --- a/spec/apibuilder-task.json +++ b/spec/apibuilder-task.json @@ -36,6 +36,7 @@ "unions": { "email_data": { + "discriminator": "discriminator", "types": [ { "type": "email_data_application_created" }, { "type": "email_data_email_verification_created" }, From 40ecdef3659a6e096ff6a44f8df212595a92b33f Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 2 Jul 2024 17:35:09 -0400 Subject: [PATCH 05/95] wip --- lib/src/main/scala/Kind.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/main/scala/Kind.scala b/lib/src/main/scala/Kind.scala index 366aa5a89..207fc07c9 100644 --- a/lib/src/main/scala/Kind.scala +++ b/lib/src/main/scala/Kind.scala @@ -60,7 +60,7 @@ case class DatatypeResolver( } } } - }) ++ interfaceNames.find(_ == name).map(Kind.Interface).toSeq + }) ++ interfaceNames.find(_ == name).map(Kind.Interface(_)).toSeq } } From fc4c43f0b2d1472dca9b47abebcd27c24bf5e9d2 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 2 Jul 2024 17:38:58 -0400 Subject: [PATCH 06/95] wip --- README.md | 2 +- build.sbt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index f41f04bc1..29c263412 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Build Status](https://travis-ci.org/apicollective/apibuilder.svg?branch=main)](https://travis-ci.org/apicollective/apibuilder) -apibuilder +API Builder ========== Simple, Comprehensive Tooling for Modern APIs. diff --git a/build.sbt b/build.sbt index af1e2e51d..653e34573 100644 --- a/build.sbt +++ b/build.sbt @@ -173,7 +173,6 @@ lazy val commonSettings: Seq[Setting[_]] = Seq( name ~= ("apibuilder-" + _), organization := "io.apibuilder", libraryDependencies ++= Seq( - "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.17.1", "com.typesafe.play" %% "play-json-joda" % playJsonVersion, "org.atteo" % "evo-inflector" % "1.3", "org.typelevel" %% "cats-core" % "2.12.0", From 7a888def0734977b2f95f5864bf611ed1846666c Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 2 Jul 2024 17:59:40 -0400 Subject: [PATCH 07/95] wip --- build.sbt | 14 ++++++++------ .../ApicollectiveApibuilderCommonV0Client.scala | 2 +- .../ApicollectiveApibuilderGeneratorV0Client.scala | 4 ++-- .../app/ApicollectiveApibuilderSpecV0Client.scala | 12 ++++++------ 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/build.sbt b/build.sbt index 653e34573..06579e1de 100644 --- a/build.sbt +++ b/build.sbt @@ -15,10 +15,11 @@ lazy val lib = project .in(file("lib")) .settings(commonSettings*) -val avroVersion = "1.11.1" - val playJsonVersion = "2.10.6" +/* +val avroVersion = "1.11.1" + lazy val avro = project .in(file("avro")) .dependsOn(generated, lib % "compile->compile;test->test") @@ -53,11 +54,12 @@ lazy val swagger = project "--add-opens=java.base/sun.security.ssl=ALL-UNNAMED" ) ) + */ val circeVersion = "0.14.9" lazy val core = project .in(file("core")) - .dependsOn(generated, lib, avro, swagger) + .dependsOn(generated, lib) .aggregate(generated, lib) .settings(commonSettings*) .settings( @@ -104,8 +106,8 @@ lazy val api = project "com.google.inject" % "guice" % "5.1.0", "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0", "org.projectlombok" % "lombok" % "1.18.32" % "provided", - "com.typesafe.play" %% "play-json-joda" % playJsonVersion, "com.typesafe.play" %% "play-json" % playJsonVersion, + "com.typesafe.play" %% "play-json-joda" % playJsonVersion, "org.postgresql" % "postgresql" % "42.7.3", "org.mindrot" % "jbcrypt" % "0.4", "com.sendgrid" % "sendgrid-java" % "4.10.2", @@ -140,8 +142,8 @@ lazy val app = project "com.google.inject" % "guice" % "5.1.0", "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0", "org.projectlombok" % "lombok" % "1.18.28" % "provided", - "com.typesafe.play" %% "play-json-joda" % playJsonVersion, "com.typesafe.play" %% "play-json" % playJsonVersion, + "com.typesafe.play" %% "play-json-joda" % playJsonVersion, "org.apache.commons" % "commons-compress" % "1.26.2", "com.github.tototoshi" %% "scala-csv" % "1.4.0", "com.vladsch.flexmark" % "flexmark-all" % "0.64.8", @@ -176,7 +178,7 @@ lazy val commonSettings: Seq[Setting[_]] = Seq( "com.typesafe.play" %% "play-json-joda" % playJsonVersion, "org.atteo" % "evo-inflector" % "1.3", "org.typelevel" %% "cats-core" % "2.12.0", - "org.slf4j" % "slf4j-api" % "2.0.13", + //"org.slf4j" % "slf4j-api" % "2.0.13", "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test ), scalacOptions ++= allScalacOptions, diff --git a/generated/app/ApicollectiveApibuilderCommonV0Client.scala b/generated/app/ApicollectiveApibuilderCommonV0Client.scala index 48e6223ea..02bba2970 100644 --- a/generated/app/ApicollectiveApibuilderCommonV0Client.scala +++ b/generated/app/ApicollectiveApibuilderCommonV0Client.scala @@ -460,4 +460,4 @@ package io.apibuilder.common.v0 { } -} \ No newline at end of file +} diff --git a/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala b/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala index 921b5653a..155377930 100644 --- a/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala +++ b/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala @@ -309,7 +309,7 @@ package io.apibuilder.generator.v0.models { implicit def jsonWritesApibuilderGeneratorHealthcheck: play.api.libs.json.Writes[Healthcheck] = { (obj: io.apibuilder.generator.v0.models.Healthcheck) => { - jsObjectHealthcheck(obj) + io.apibuilder.generator.v0.models.json.jsObjectHealthcheck(obj) } } @@ -737,4 +737,4 @@ package io.apibuilder.generator.v0 { } -} \ No newline at end of file +} diff --git a/generated/app/ApicollectiveApibuilderSpecV0Client.scala b/generated/app/ApicollectiveApibuilderSpecV0Client.scala index e7140a550..5e86dfe8b 100644 --- a/generated/app/ApicollectiveApibuilderSpecV0Client.scala +++ b/generated/app/ApicollectiveApibuilderSpecV0Client.scala @@ -1391,11 +1391,11 @@ package io.apibuilder.spec.v0.models { implicit def jsonReadsApibuilderSpecResponseCode[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[T] = { ( - (__ \ "integer").read(jsonReadsApibuilderSpecResponseCodeInt).asInstanceOf[play.api.libs.json.Reads[ResponseCode]] - orElse - (__ \ "response_code_option").read(jsonReadsApibuilderSpecResponseCodeOption).asInstanceOf[play.api.libs.json.Reads[ResponseCode]] - orElse - play.api.libs.json.Reads(jsValue => play.api.libs.json.JsSuccess(ResponseCodeUndefinedType(jsValue.toString))).asInstanceOf[play.api.libs.json.Reads[ResponseCode]] + (__ \ "integer").read(jsonReadsApibuilderSpecResponseCodeInt).orElse { + (__ \ "response_code_option").read(jsonReadsApibuilderSpecResponseCodeOption).orElse { + play.api.libs.json.Reads(jsValue => play.api.libs.json.JsSuccess(ResponseCodeUndefinedType(jsValue.toString))) + } + } ) } @@ -1702,4 +1702,4 @@ package io.apibuilder.spec.v0 { } -} \ No newline at end of file +} From d775200fc4de7da7e12a6a858e66a8f546b160ae Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 2 Jul 2024 18:03:28 -0400 Subject: [PATCH 08/95] wip --- .../app/ApicollectiveApibuilderSpecV0Client.scala | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/generated/app/ApicollectiveApibuilderSpecV0Client.scala b/generated/app/ApicollectiveApibuilderSpecV0Client.scala index 5e86dfe8b..b981ba554 100644 --- a/generated/app/ApicollectiveApibuilderSpecV0Client.scala +++ b/generated/app/ApicollectiveApibuilderSpecV0Client.scala @@ -1389,16 +1389,7 @@ package io.apibuilder.spec.v0.models { (__ \ "value").read[Int].map { x => ResponseCodeInt(value = x) } } - implicit def jsonReadsApibuilderSpecResponseCode[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[T] = { - ( - (__ \ "integer").read(jsonReadsApibuilderSpecResponseCodeInt).orElse { - (__ \ "response_code_option").read(jsonReadsApibuilderSpecResponseCodeOption).orElse { - play.api.libs.json.Reads(jsValue => play.api.libs.json.JsSuccess(ResponseCodeUndefinedType(jsValue.toString))) - } - } - ) - } - + implicit def jsonReadsApibuilderSpecResponseCode[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[T] = ??? implicit def jsonReadsApibuilderSpecResponseCodeSeq[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[Seq[T]] = { case a: play.api.libs.json.JsArray => { From 0753f535191464b3511e150ea475215ebc71db34 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 2 Jul 2024 18:06:07 -0400 Subject: [PATCH 09/95] wip --- build.sbt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 06579e1de..160427c40 100644 --- a/build.sbt +++ b/build.sbt @@ -14,6 +14,13 @@ lazy val allScalacOptions = Seq( lazy val lib = project .in(file("lib")) .settings(commonSettings*) + .settings(resolversSettings) + +lazy val resolversSettings = Seq( + resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/", + resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases", + resolvers += "jitpack" at "https://jitpack.io", +) val playJsonVersion = "2.10.6" @@ -63,7 +70,6 @@ lazy val core = project .aggregate(generated, lib) .settings(commonSettings*) .settings( - resolvers += "Typesafe Maven Repository" at "https://repo.typesafe.com/typesafe/maven-releases/", libraryDependencies ++= Seq( "com.typesafe.play" %% "play-json" % playJsonVersion, "io.circe" %% "circe-core" % circeVersion, @@ -97,8 +103,6 @@ lazy val api = project routesImport += "io.apibuilder.api.v0.Bindables.Models._", routesImport += "io.apibuilder.common.v0.Bindables.Models._", routesGenerator := InjectedRoutesGenerator, - resolvers += "Scalaz Bintray Repo" at "https://dl.bintray.com/scalaz/releases", - resolvers += "jitpack" at "https://jitpack.io", libraryDependencies ++= Seq( filters, jdbc, From 69c81355935008ef5c1d1a8f816dc8ac120b83e2 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Wed, 3 Jul 2024 10:28:29 -0400 Subject: [PATCH 10/95] wip --- ...collectiveApibuilderApiV0Conversions.scala | 22 +- .../ApicollectiveApibuilderApiV0Parsers.scala | 100 ++----- api/conf/routes | 8 +- .../ApicollectiveApibuilderApiV0Client.scala | 270 +++--------------- .../ApicollectiveApibuilderTaskV0Client.scala | 4 +- 5 files changed, 80 insertions(+), 324 deletions(-) diff --git a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala index 8ca56306b..c2914743e 100644 --- a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.48 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/anorm_2_8_parsers + * Service version: 0.16.43 + * User agent: apibuilder localhost 9000/apicollective/apibuilder-api/latest/anorm_2_8_parsers */ package io.apibuilder.api.v0.anorm.conversions { @@ -55,8 +55,6 @@ package io.apibuilder.api.v0.anorm.conversions { import io.apibuilder.api.v0.models.json._ implicit val columnToSeqApibuilderApiAppSortBy: Column[Seq[_root_.io.apibuilder.api.v0.models.AppSortBy]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.AppSortBy]] } implicit val columnToMapApibuilderApiAppSortBy: Column[Map[String, _root_.io.apibuilder.api.v0.models.AppSortBy]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.AppSortBy]] } - implicit val columnToSeqApibuilderApiBatchStatus: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchStatus]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchStatus]] } - implicit val columnToMapApibuilderApiBatchStatus: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchStatus]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchStatus]] } implicit val columnToSeqApibuilderApiOriginalType: Column[Seq[_root_.io.apibuilder.api.v0.models.OriginalType]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.OriginalType]] } implicit val columnToMapApibuilderApiOriginalType: Column[Map[String, _root_.io.apibuilder.api.v0.models.OriginalType]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.OriginalType]] } implicit val columnToSeqApibuilderApiPublication: Column[Seq[_root_.io.apibuilder.api.v0.models.Publication]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Publication]] } @@ -87,16 +85,12 @@ package io.apibuilder.api.v0.anorm.conversions { implicit val columnToMapApibuilderApiAttributeValueForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.AttributeValueForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.AttributeValueForm]] } implicit val columnToSeqApibuilderApiAuthentication: Column[Seq[_root_.io.apibuilder.api.v0.models.Authentication]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Authentication]] } implicit val columnToMapApibuilderApiAuthentication: Column[Map[String, _root_.io.apibuilder.api.v0.models.Authentication]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Authentication]] } - implicit val columnToSeqApibuilderApiBatch: Column[Seq[_root_.io.apibuilder.api.v0.models.Batch]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Batch]] } - implicit val columnToMapApibuilderApiBatch: Column[Map[String, _root_.io.apibuilder.api.v0.models.Batch]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Batch]] } - implicit val columnToSeqApibuilderApiBatchData: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchData]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchData]] } - implicit val columnToMapApibuilderApiBatchData: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchData]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchData]] } - implicit val columnToSeqApibuilderApiBatchDownloadForm: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadForm]] } - implicit val columnToMapApibuilderApiBatchDownloadForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadForm]] } - implicit val columnToSeqApibuilderApiBatchDownloadFormApplication: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadFormApplication]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadFormApplication]] } - implicit val columnToMapApibuilderApiBatchDownloadFormApplication: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadFormApplication]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadFormApplication]] } - implicit val columnToSeqApibuilderApiBatchForm: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchForm]] } - implicit val columnToMapApibuilderApiBatchForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchForm]] } + implicit val columnToSeqApibuilderApiBatchDownloadApplicationForm: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationForm]] } + implicit val columnToMapApibuilderApiBatchDownloadApplicationForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplicationForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplicationForm]] } + implicit val columnToSeqApibuilderApiBatchDownloadApplications: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplications]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplications]] } + implicit val columnToMapApibuilderApiBatchDownloadApplications: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplications]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplications]] } + implicit val columnToSeqApibuilderApiBatchDownloadApplicationsForm: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationsForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationsForm]] } + implicit val columnToMapApibuilderApiBatchDownloadApplicationsForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplicationsForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplicationsForm]] } implicit val columnToSeqApibuilderApiChange: Column[Seq[_root_.io.apibuilder.api.v0.models.Change]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Change]] } implicit val columnToMapApibuilderApiChange: Column[Map[String, _root_.io.apibuilder.api.v0.models.Change]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Change]] } implicit val columnToSeqApibuilderApiChangeVersion: Column[Seq[_root_.io.apibuilder.api.v0.models.ChangeVersion]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.ChangeVersion]] } diff --git a/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala index 933ceaede..2217bb554 100644 --- a/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala +++ b/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.48 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/anorm_2_8_parsers + * Service version: 0.16.43 + * User agent: apibuilder localhost 9000/apicollective/apibuilder-api/latest/anorm_2_8_parsers */ import anorm._ @@ -26,18 +26,6 @@ package io.apibuilder.api.v0.anorm.parsers { } - object BatchStatus { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchStatus] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser(name: String = "batch_status", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.BatchStatus] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case value => io.apibuilder.api.v0.models.BatchStatus(value) - } - } - - } - object OriginalType { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.OriginalType] = parser(prefixOpt = Some(s"$prefix$sep")) @@ -361,24 +349,21 @@ package io.apibuilder.api.v0.anorm.parsers { } - object Batch { + object BatchDownloadApplicationForm { - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Batch] = parser(prefixOpt = Some(s"$prefix$sep")) + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplicationForm] = parser(prefixOpt = Some(s"$prefix$sep")) def parser( - id: String = "id", - status: String = "status", - dataPrefix: String = "data", + applicationKey: String = "application_key", + version: String = "version", prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Batch] = { - SqlParser.str(prefixOpt.getOrElse("") + id) ~ - io.apibuilder.api.v0.anorm.parsers.BatchStatus.parser(prefixOpt.getOrElse("") + status) ~ - io.apibuilder.api.v0.anorm.parsers.BatchData.parserWithPrefix(prefixOpt.getOrElse("") + dataPrefix).? map { - case id ~ status ~ data => { - io.apibuilder.api.v0.models.Batch( - id = id, - status = status, - data = data + ): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplicationForm] = { + SqlParser.str(prefixOpt.getOrElse("") + applicationKey) ~ + SqlParser.str(prefixOpt.getOrElse("") + version) map { + case applicationKey ~ version => { + io.apibuilder.api.v0.models.BatchDownloadApplicationForm( + applicationKey = applicationKey, + version = version ) } } @@ -386,17 +371,17 @@ package io.apibuilder.api.v0.anorm.parsers { } - object BatchData { + object BatchDownloadApplications { - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchData] = parser(prefixOpt = Some(s"$prefix$sep")) + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplications] = parser(prefixOpt = Some(s"$prefix$sep")) def parser( applications: String = "applications", prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.BatchData] = { + ): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplications] = { SqlParser.get[Seq[io.apibuilder.api.v0.models.Version]](prefixOpt.getOrElse("") + applications) map { case applications => { - io.apibuilder.api.v0.models.BatchData( + io.apibuilder.api.v0.models.BatchDownloadApplications( applications = applications ) } @@ -405,58 +390,17 @@ package io.apibuilder.api.v0.anorm.parsers { } - object BatchDownloadForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchDownloadForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - applications: String = "applications", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.BatchDownloadForm] = { - SqlParser.get[Seq[io.apibuilder.api.v0.models.BatchDownloadFormApplication]](prefixOpt.getOrElse("") + applications) map { - case applications => { - io.apibuilder.api.v0.models.BatchDownloadForm( - applications = applications - ) - } - } - } - - } - - object BatchDownloadFormApplication { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchDownloadFormApplication] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - applicationKey: String = "application_key", - version: String = "version", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.BatchDownloadFormApplication] = { - SqlParser.str(prefixOpt.getOrElse("") + applicationKey) ~ - SqlParser.str(prefixOpt.getOrElse("") + version) map { - case applicationKey ~ version => { - io.apibuilder.api.v0.models.BatchDownloadFormApplication( - applicationKey = applicationKey, - version = version - ) - } - } - } - - } - - object BatchForm { + object BatchDownloadApplicationsForm { - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchForm] = parser(prefixOpt = Some(s"$prefix$sep")) + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplicationsForm] = parser(prefixOpt = Some(s"$prefix$sep")) def parser( applications: String = "applications", prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.BatchForm] = { - SqlParser.get[Seq[io.apibuilder.api.v0.models.VersionForm]](prefixOpt.getOrElse("") + applications) map { + ): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplicationsForm] = { + SqlParser.get[Seq[io.apibuilder.api.v0.models.BatchDownloadApplicationForm]](prefixOpt.getOrElse("") + applications) map { case applications => { - io.apibuilder.api.v0.models.BatchForm( + io.apibuilder.api.v0.models.BatchDownloadApplicationsForm( applications = applications ) } diff --git a/api/conf/routes b/api/conf/routes index 9c62f94fe..bcdc3b8f3 100644 --- a/api/conf/routes +++ b/api/conf/routes @@ -1,6 +1,6 @@ # Generated by API Builder - https://www.apibuilder.io -# Service version: 0.16.48 -# User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/play_2_x_routes +# Service version: 0.16.43 +# User agent: apibuilder localhost 9000/apicollective/apibuilder-api/latest/play_2_x_routes GET /attributes controllers.Attributes.get(guid: _root_.scala.Option[_root_.java.util.UUID], name: _root_.scala.Option[String], limit: Long ?= 25L, offset: Long ?= 0L) GET /attributes/:name controllers.Attributes.getByName(name: String) @@ -65,9 +65,7 @@ POST /:orgKey controllers PUT /:orgKey/:applicationKey controllers.Applications.putByApplicationKey(orgKey: String, applicationKey: String) DELETE /:orgKey/:applicationKey controllers.Applications.deleteByApplicationKey(orgKey: String, applicationKey: String) POST /:orgKey/:applicationKey/move controllers.Applications.postMoveByApplicationKey(orgKey: String, applicationKey: String) -POST /:orgKey/batch/applications controllers.Batches.post(orgKey: String) -POST /:orgKey/batch/applications/dryrun controllers.Batches.postDryrun(orgKey: String) -POST /:orgKey/batch/applications/download controllers.Batches.postDownload(orgKey: String) +POST /:orgKey/batch/download/applications controllers.BatchDownloadApplications.post(orgKey: String) POST /:orgKey/:applicationKey/:version/form controllers.Code.postForm(orgKey: String, applicationKey: String, version: String) GET /:orgKey/:applicationKey/:version/:generatorKey controllers.Code.getByGeneratorKey(orgKey: String, applicationKey: String, version: String, generatorKey: String) POST /:orgKey/:applicationKey/:version/:generatorKey controllers.Code.postByGeneratorKey(orgKey: String, applicationKey: String, version: String, generatorKey: String) diff --git a/generated/app/ApicollectiveApibuilderApiV0Client.scala b/generated/app/ApicollectiveApibuilderApiV0Client.scala index c933fd90a..c80ad7b81 100644 --- a/generated/app/ApicollectiveApibuilderApiV0Client.scala +++ b/generated/app/ApicollectiveApibuilderApiV0Client.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.48 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/play_2_9_scala_3_client + * Service version: 0.16.43 + * User agent: apibuilder localhost 9000/apicollective/apibuilder-api/latest/play_2_9_scala_3_client */ package io.apibuilder.api.v0.models { @@ -194,34 +194,17 @@ package io.apibuilder.api.v0.models { session: io.apibuilder.api.v0.models.Session ) - /** - * Supports creating a batch operation which will run async. Caller can fetch the - * resource and check the status. - * - * @param data Populated once the batch is ready - */ - - final case class Batch( - id: String, - status: io.apibuilder.api.v0.models.BatchStatus, - data: _root_.scala.Option[io.apibuilder.api.v0.models.BatchData] = None + final case class BatchDownloadApplicationForm( + applicationKey: String, + version: String = "latest" ) - final case class BatchData( + final case class BatchDownloadApplications( applications: Seq[io.apibuilder.api.v0.models.Version] ) - final case class BatchDownloadForm( - applications: Seq[io.apibuilder.api.v0.models.BatchDownloadFormApplication] - ) - - final case class BatchDownloadFormApplication( - applicationKey: String, - version: String = "latest" - ) - - final case class BatchForm( - applications: Seq[io.apibuilder.api.v0.models.VersionForm] + final case class BatchDownloadApplicationsForm( + applications: Seq[io.apibuilder.api.v0.models.BatchDownloadApplicationForm] ) /** @@ -733,41 +716,6 @@ package io.apibuilder.api.v0.models { } - sealed trait BatchStatus extends _root_.scala.Product with _root_.scala.Serializable - - object BatchStatus { - - case object Created extends BatchStatus { override def toString = "created" } - case object Processing extends BatchStatus { override def toString = "processing" } - case object Ready extends BatchStatus { override def toString = "ready" } - case object Failed extends BatchStatus { override def toString = "failed" } - /** - * UNDEFINED captures values that are sent either in error or - * that were added by the server after this library was - * generated. We want to make it easy and obvious for users of - * this library to handle this case gracefully. - * - * We use all CAPS for the variable name to avoid collisions - * with the camel cased values above. - */ - final case class UNDEFINED(override val toString: String) extends BatchStatus - - /** - * all returns a list of all the valid, known values. We use - * lower case to avoid collisions with the camel cased values - * above. - */ - val all: scala.List[BatchStatus] = scala.List(Created, Processing, Ready, Failed) - - private - val byName: Map[String, BatchStatus] = all.map(x => x.toString.toLowerCase -> x).toMap - - def apply(value: String): BatchStatus = fromString(value).getOrElse(UNDEFINED(value)) - - def fromString(value: String): _root_.scala.Option[BatchStatus] = byName.get(value.toLowerCase) - - } - sealed trait OriginalType extends _root_.scala.Product with _root_.scala.Serializable object OriginalType { @@ -1048,38 +996,6 @@ package io.apibuilder.api.v0.models { } } - implicit val jsonReadsApibuilderApiBatchStatus: play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchStatus] = new play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchStatus] { - def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[io.apibuilder.api.v0.models.BatchStatus] = { - js match { - case v: play.api.libs.json.JsString => play.api.libs.json.JsSuccess(io.apibuilder.api.v0.models.BatchStatus(v.value)) - case _ => { - (js \ "value").validate[String] match { - case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(io.apibuilder.api.v0.models.BatchStatus(v)) - case err: play.api.libs.json.JsError => - (js \ "batch_status").validate[String] match { - case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(io.apibuilder.api.v0.models.BatchStatus(v)) - case err: play.api.libs.json.JsError => err - } - } - } - } - } - } - - def jsonWritesApibuilderApiBatchStatus(obj: io.apibuilder.api.v0.models.BatchStatus) = { - play.api.libs.json.JsString(obj.toString) - } - - def jsObjectBatchStatus(obj: io.apibuilder.api.v0.models.BatchStatus) = { - play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsString(obj.toString)) - } - - implicit def jsonWritesApibuilderApiBatchStatus: play.api.libs.json.Writes[BatchStatus] = { - (obj: io.apibuilder.api.v0.models.BatchStatus) => { - jsonWritesApibuilderApiBatchStatus(obj) - } - } - implicit val jsonReadsApibuilderApiOriginalType: play.api.libs.json.Reads[io.apibuilder.api.v0.models.OriginalType] = new play.api.libs.json.Reads[io.apibuilder.api.v0.models.OriginalType] { def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[io.apibuilder.api.v0.models.OriginalType] = { js match { @@ -1457,95 +1373,55 @@ package io.apibuilder.api.v0.models { } } - implicit def jsonReadsApibuilderApiBatch: play.api.libs.json.Reads[io.apibuilder.api.v0.models.Batch] = { + implicit def jsonReadsApibuilderApiBatchDownloadApplicationForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchDownloadApplicationForm] = { for { - id <- (__ \ "id").read[String] - status <- (__ \ "status").read[io.apibuilder.api.v0.models.BatchStatus] - data <- (__ \ "data").readNullable[io.apibuilder.api.v0.models.BatchData] - } yield Batch(id, status, data) - } - - def jsObjectBatch(obj: io.apibuilder.api.v0.models.Batch): play.api.libs.json.JsObject = { - play.api.libs.json.Json.obj( - "id" -> play.api.libs.json.JsString(obj.id), - "status" -> play.api.libs.json.JsString(obj.status.toString) - ) ++ (obj.data match { - case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("data" -> jsObjectBatchData(x)) - }) - } - - implicit def jsonWritesApibuilderApiBatch: play.api.libs.json.Writes[Batch] = { - (obj: io.apibuilder.api.v0.models.Batch) => { - jsObjectBatch(obj) - } - } - - implicit def jsonReadsApibuilderApiBatchData: play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchData] = { - (__ \ "applications").read[Seq[io.apibuilder.api.v0.models.Version]].map { x => BatchData(applications = x) } + applicationKey <- (__ \ "application_key").read[String] + version <- (__ \ "version").readWithDefault[String]("latest") + } yield BatchDownloadApplicationForm(applicationKey, version) } - def jsObjectBatchData(obj: io.apibuilder.api.v0.models.BatchData): play.api.libs.json.JsObject = { + def jsObjectBatchDownloadApplicationForm(obj: io.apibuilder.api.v0.models.BatchDownloadApplicationForm): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( - "applications" -> play.api.libs.json.Json.toJson(obj.applications) + "application_key" -> play.api.libs.json.JsString(obj.applicationKey), + "version" -> play.api.libs.json.JsString(obj.version) ) } - implicit def jsonWritesApibuilderApiBatchData: play.api.libs.json.Writes[BatchData] = { - (obj: io.apibuilder.api.v0.models.BatchData) => { - jsObjectBatchData(obj) + implicit def jsonWritesApibuilderApiBatchDownloadApplicationForm: play.api.libs.json.Writes[BatchDownloadApplicationForm] = { + (obj: io.apibuilder.api.v0.models.BatchDownloadApplicationForm) => { + jsObjectBatchDownloadApplicationForm(obj) } } - implicit def jsonReadsApibuilderApiBatchDownloadForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchDownloadForm] = { - (__ \ "applications").read[Seq[io.apibuilder.api.v0.models.BatchDownloadFormApplication]].map { x => BatchDownloadForm(applications = x) } + implicit def jsonReadsApibuilderApiBatchDownloadApplications: play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchDownloadApplications] = { + (__ \ "applications").read[Seq[io.apibuilder.api.v0.models.Version]].map { x => BatchDownloadApplications(applications = x) } } - def jsObjectBatchDownloadForm(obj: io.apibuilder.api.v0.models.BatchDownloadForm): play.api.libs.json.JsObject = { + def jsObjectBatchDownloadApplications(obj: io.apibuilder.api.v0.models.BatchDownloadApplications): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "applications" -> play.api.libs.json.Json.toJson(obj.applications) ) } - implicit def jsonWritesApibuilderApiBatchDownloadForm: play.api.libs.json.Writes[BatchDownloadForm] = { - (obj: io.apibuilder.api.v0.models.BatchDownloadForm) => { - jsObjectBatchDownloadForm(obj) - } - } - - implicit def jsonReadsApibuilderApiBatchDownloadFormApplication: play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchDownloadFormApplication] = { - for { - applicationKey <- (__ \ "application_key").read[String] - version <- (__ \ "version").readWithDefault[String]("latest") - } yield BatchDownloadFormApplication(applicationKey, version) - } - - def jsObjectBatchDownloadFormApplication(obj: io.apibuilder.api.v0.models.BatchDownloadFormApplication): play.api.libs.json.JsObject = { - play.api.libs.json.Json.obj( - "application_key" -> play.api.libs.json.JsString(obj.applicationKey), - "version" -> play.api.libs.json.JsString(obj.version) - ) - } - - implicit def jsonWritesApibuilderApiBatchDownloadFormApplication: play.api.libs.json.Writes[BatchDownloadFormApplication] = { - (obj: io.apibuilder.api.v0.models.BatchDownloadFormApplication) => { - jsObjectBatchDownloadFormApplication(obj) + implicit def jsonWritesApibuilderApiBatchDownloadApplications: play.api.libs.json.Writes[BatchDownloadApplications] = { + (obj: io.apibuilder.api.v0.models.BatchDownloadApplications) => { + jsObjectBatchDownloadApplications(obj) } } - implicit def jsonReadsApibuilderApiBatchForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchForm] = { - (__ \ "applications").read[Seq[io.apibuilder.api.v0.models.VersionForm]].map { x => BatchForm(applications = x) } + implicit def jsonReadsApibuilderApiBatchDownloadApplicationsForm: play.api.libs.json.Reads[io.apibuilder.api.v0.models.BatchDownloadApplicationsForm] = { + (__ \ "applications").read[Seq[io.apibuilder.api.v0.models.BatchDownloadApplicationForm]].map { x => BatchDownloadApplicationsForm(applications = x) } } - def jsObjectBatchForm(obj: io.apibuilder.api.v0.models.BatchForm): play.api.libs.json.JsObject = { + def jsObjectBatchDownloadApplicationsForm(obj: io.apibuilder.api.v0.models.BatchDownloadApplicationsForm): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "applications" -> play.api.libs.json.Json.toJson(obj.applications) ) } - implicit def jsonWritesApibuilderApiBatchForm: play.api.libs.json.Writes[BatchForm] = { - (obj: io.apibuilder.api.v0.models.BatchForm) => { - jsObjectBatchForm(obj) + implicit def jsonWritesApibuilderApiBatchDownloadApplicationsForm: play.api.libs.json.Writes[BatchDownloadApplicationsForm] = { + (obj: io.apibuilder.api.v0.models.BatchDownloadApplicationsForm) => { + jsObjectBatchDownloadApplicationsForm(obj) } } @@ -2518,15 +2394,6 @@ package io.apibuilder.api.v0 { implicit def pathBindableAppSortBy(implicit stringBinder: QueryStringBindable[String]): PathBindable[io.apibuilder.api.v0.models.AppSortBy] = ApibuilderPathBindable(appSortByConverter) implicit def queryStringBindableAppSortBy(implicit stringBinder: QueryStringBindable[String]): QueryStringBindable[io.apibuilder.api.v0.models.AppSortBy] = ApibuilderQueryStringBindable(appSortByConverter) - val batchStatusConverter: ApibuilderTypeConverter[io.apibuilder.api.v0.models.BatchStatus] = new ApibuilderTypeConverter[io.apibuilder.api.v0.models.BatchStatus] { - override def convert(value: String): io.apibuilder.api.v0.models.BatchStatus = io.apibuilder.api.v0.models.BatchStatus(value) - override def convert(value: io.apibuilder.api.v0.models.BatchStatus): String = value.toString - override def example: io.apibuilder.api.v0.models.BatchStatus = io.apibuilder.api.v0.models.BatchStatus.Created - override def validValues: Seq[io.apibuilder.api.v0.models.BatchStatus] = io.apibuilder.api.v0.models.BatchStatus.all - } - implicit def pathBindableBatchStatus(implicit stringBinder: QueryStringBindable[String]): PathBindable[io.apibuilder.api.v0.models.BatchStatus] = ApibuilderPathBindable(batchStatusConverter) - implicit def queryStringBindableBatchStatus(implicit stringBinder: QueryStringBindable[String]): QueryStringBindable[io.apibuilder.api.v0.models.BatchStatus] = ApibuilderQueryStringBindable(batchStatusConverter) - val originalTypeConverter: ApibuilderTypeConverter[io.apibuilder.api.v0.models.OriginalType] = new ApibuilderTypeConverter[io.apibuilder.api.v0.models.OriginalType] { override def convert(value: String): io.apibuilder.api.v0.models.OriginalType = io.apibuilder.api.v0.models.OriginalType(value) override def convert(value: io.apibuilder.api.v0.models.OriginalType): String = value.toString @@ -2652,8 +2519,8 @@ package io.apibuilder.api.v0 { val BaseUrl = "https://api.apibuilder.io" val Namespace = "io.apibuilder.api.v0" - val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/play_2_9_scala_3_client" - val Version = "0.16.48" + val UserAgent = "apibuilder localhost 9000/apicollective/apibuilder-api/latest/play_2_9_scala_3_client" + val Version = "0.16.43" val VersionMajor = 0 } @@ -2679,7 +2546,7 @@ package io.apibuilder.api.v0 { def authentications: Authentications = Authentications - def batches: Batches = Batches + def batchDownloadApplications: BatchDownloadApplications = BatchDownloadApplications def changes: Changes = Changes @@ -2912,44 +2779,16 @@ package io.apibuilder.api.v0 { } } - object Batches extends Batches { + object BatchDownloadApplications extends BatchDownloadApplications { override def post( orgKey: String, - batchForm: io.apibuilder.api.v0.models.BatchForm, + batchDownloadApplicationsForm: io.apibuilder.api.v0.models.BatchDownloadApplicationsForm, requestHeaders: Seq[(String, String)] = Nil - )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.Batch] = { - val payload = play.api.libs.json.Json.toJson(batchForm) + )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.BatchDownloadApplications] = { + val payload = play.api.libs.json.Json.toJson(batchDownloadApplicationsForm) - _executeRequest("POST", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/batch/applications", body = Some(payload), requestHeaders = requestHeaders).map { - case r if r.status == 201 => _root_.io.apibuilder.api.v0.Client.parseJson("io.apibuilder.api.v0.models.Batch", r, _.validate[io.apibuilder.api.v0.models.Batch]) - case r if r.status == 409 => throw io.apibuilder.api.v0.errors.ErrorsResponse(r) - case r => throw io.apibuilder.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 201, 409") - } - } - - override def postDryrun( - orgKey: String, - batchDownloadForm: io.apibuilder.api.v0.models.BatchDownloadForm, - requestHeaders: Seq[(String, String)] = Nil - )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.Batch] = { - val payload = play.api.libs.json.Json.toJson(batchDownloadForm) - - _executeRequest("POST", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/batch/applications/dryrun", body = Some(payload), requestHeaders = requestHeaders).map { - case r if r.status == 201 => _root_.io.apibuilder.api.v0.Client.parseJson("io.apibuilder.api.v0.models.Batch", r, _.validate[io.apibuilder.api.v0.models.Batch]) - case r if r.status == 409 => throw io.apibuilder.api.v0.errors.ErrorsResponse(r) - case r => throw io.apibuilder.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 201, 409") - } - } - - override def postDownload( - orgKey: String, - batchDownloadForm: io.apibuilder.api.v0.models.BatchDownloadForm, - requestHeaders: Seq[(String, String)] = Nil - )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.Batch] = { - val payload = play.api.libs.json.Json.toJson(batchDownloadForm) - - _executeRequest("POST", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/batch/applications/download", body = Some(payload), requestHeaders = requestHeaders).map { - case r if r.status == 201 => _root_.io.apibuilder.api.v0.Client.parseJson("io.apibuilder.api.v0.models.Batch", r, _.validate[io.apibuilder.api.v0.models.Batch]) + _executeRequest("POST", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/batch/download/applications", body = Some(payload), requestHeaders = requestHeaders).map { + case r if r.status == 201 => _root_.io.apibuilder.api.v0.Client.parseJson("io.apibuilder.api.v0.models.BatchDownloadApplications", r, _.validate[io.apibuilder.api.v0.models.BatchDownloadApplications]) case r if r.status == 409 => throw io.apibuilder.api.v0.errors.ErrorsResponse(r) case r => throw io.apibuilder.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 201, 409") } @@ -4013,7 +3852,7 @@ package io.apibuilder.api.v0 { def applications: io.apibuilder.api.v0.Applications def attributes: io.apibuilder.api.v0.Attributes def authentications: io.apibuilder.api.v0.Authentications - def batches: io.apibuilder.api.v0.Batches + def batchDownloadApplications: io.apibuilder.api.v0.BatchDownloadApplications def changes: io.apibuilder.api.v0.Changes def code: io.apibuilder.api.v0.Code def domains: io.apibuilder.api.v0.Domains @@ -4176,34 +4015,15 @@ package io.apibuilder.api.v0 { )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.Authentication] } - trait Batches { + trait BatchDownloadApplications { /** - * Upsert multiple applications in one api call. Validation happens first - we - * store results only if ALL applications are valid + * Retrieve multiple applications in one api call. */ def post( orgKey: String, - batchForm: io.apibuilder.api.v0.models.BatchForm, - requestHeaders: Seq[(String, String)] = Nil - )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.Batch] - - /** - * Validate a batch of applications without SAVING anything to the database - */ - def postDryrun( - orgKey: String, - batchDownloadForm: io.apibuilder.api.v0.models.BatchDownloadForm, + batchDownloadApplicationsForm: io.apibuilder.api.v0.models.BatchDownloadApplicationsForm, requestHeaders: Seq[(String, String)] = Nil - )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.Batch] - - /** - * Download multiple applications in one api call. - */ - def postDownload( - orgKey: String, - batchDownloadForm: io.apibuilder.api.v0.models.BatchDownloadForm, - requestHeaders: Seq[(String, String)] = Nil - )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.Batch] + )(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[io.apibuilder.api.v0.models.BatchDownloadApplications] } trait Changes { @@ -4768,7 +4588,7 @@ package io.apibuilder.api.v0 { /** * Retrieve a specific version of an application. * - * @param version The version of this application to download, or the keyword latest to get the + * @param version The version of tthis application to download, or the keyword latest to get the * latest version */ def getByApplicationKeyAndVersion( diff --git a/generated/app/ApicollectiveApibuilderTaskV0Client.scala b/generated/app/ApicollectiveApibuilderTaskV0Client.scala index fb728ebef..5d47032ad 100644 --- a/generated/app/ApicollectiveApibuilderTaskV0Client.scala +++ b/generated/app/ApicollectiveApibuilderTaskV0Client.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-task/latest/play_2_9_scala_3_client + * User agent: apibuilder localhost 9000/apicollective/apibuilder-task/latest/play_2_9_scala_3_client */ package io.apibuilder.task.v0.models { @@ -524,7 +524,7 @@ package io.apibuilder.task.v0 { object Constants { val Namespace = "io.apibuilder.task.v0" - val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-task/latest/play_2_9_scala_3_client" + val UserAgent = "apibuilder localhost 9000/apicollective/apibuilder-task/latest/play_2_9_scala_3_client" val Version = "0.16.50" val VersionMajor = 0 From 5319fb517940a223eca9e8f357812bab06c73405 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Wed, 3 Jul 2024 10:32:42 -0400 Subject: [PATCH 11/95] wip --- .apibuilder/.tracked_files | 3 --- build.sbt | 1 + .../ApicollectiveApibuilderGeneratorV0Client.scala | 12 ++++++------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.apibuilder/.tracked_files b/.apibuilder/.tracked_files index 6452dd836..59bad6471 100644 --- a/.apibuilder/.tracked_files +++ b/.apibuilder/.tracked_files @@ -3,7 +3,6 @@ apicollective: apibuilder-api: anorm_2_8_parsers: - api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala - - api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala play_2_9_scala_3_client: - generated/app/ApicollectiveApibuilderApiV0Client.scala play_2_x_routes: @@ -14,7 +13,6 @@ apicollective: apibuilder-common: anorm_2_8_parsers: - api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala - - api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala play_2_8_mock_client: - generated/app/ApicollectiveApibuilderCommonV0MockClient.scala play_2_9_scala_3_client: @@ -30,7 +28,6 @@ apicollective: apibuilder-spec: anorm_2_8_parsers: - api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala - - api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala play_2_8_mock_client: - generated/app/ApicollectiveApibuilderSpecV0MockClient.scala play_2_9_scala_3_client: diff --git a/build.sbt b/build.sbt index 160427c40..f5a6004d9 100644 --- a/build.sbt +++ b/build.sbt @@ -83,6 +83,7 @@ lazy val generated = project .enablePlugins(PlayScala) .settings(commonSettings*) .settings( + scalacOptions ++= Seq("-deprecation:false"), libraryDependencies ++= Seq( ws ) diff --git a/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala b/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala index 155377930..90643c674 100644 --- a/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala +++ b/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.48 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-generator/latest/play_2_9_scala_3_client + * Service version: 0.16.50 + * User agent: apibuilder localhost 9000/apicollective/apibuilder-generator/latest/play_2_9_scala_3_client */ package io.apibuilder.generator.v0.models { @@ -309,7 +309,7 @@ package io.apibuilder.generator.v0.models { implicit def jsonWritesApibuilderGeneratorHealthcheck: play.api.libs.json.Writes[Healthcheck] = { (obj: io.apibuilder.generator.v0.models.Healthcheck) => { - io.apibuilder.generator.v0.models.json.jsObjectHealthcheck(obj) + jsObjectHealthcheck(obj) } } @@ -483,8 +483,8 @@ package io.apibuilder.generator.v0 { val BaseUrl = "https://api.apibuilder.io" val Namespace = "io.apibuilder.generator.v0" - val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-generator/latest/play_2_9_scala_3_client" - val Version = "0.16.48" + val UserAgent = "apibuilder localhost 9000/apicollective/apibuilder-generator/latest/play_2_9_scala_3_client" + val Version = "0.16.50" val VersionMajor = 0 } @@ -737,4 +737,4 @@ package io.apibuilder.generator.v0 { } -} +} \ No newline at end of file From 73836afa763130c6590fefc48915c6ccc44fa2db Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Wed, 3 Jul 2024 10:45:02 -0400 Subject: [PATCH 12/95] wip --- generated/app/ApicollectiveApibuilderGeneratorV0Client.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala b/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala index 90643c674..a40e48c5e 100644 --- a/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala +++ b/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala @@ -193,7 +193,7 @@ package io.apibuilder.generator.v0.models { implicit def jsonWritesApibuilderGeneratorFileFlag: play.api.libs.json.Writes[FileFlag] = { (obj: io.apibuilder.generator.v0.models.FileFlag) => { - jsonWritesApibuilderGeneratorFileFlag(obj) + io.apibuilder.generator.v0.models.json.jsonWritesApibuilderGeneratorFileFlag(obj) } } From c9a76bbdd30426bc88ecc579aeb0f8583e18551b Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Wed, 3 Jul 2024 10:47:06 -0400 Subject: [PATCH 13/95] wip --- .../ApicollectiveApibuilderGeneratorV0Client.scala | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala b/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala index a40e48c5e..bc909651c 100644 --- a/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala +++ b/generated/app/ApicollectiveApibuilderGeneratorV0Client.scala @@ -213,7 +213,7 @@ package io.apibuilder.generator.v0.models { implicit def jsonWritesApibuilderGeneratorAttribute: play.api.libs.json.Writes[Attribute] = { (obj: io.apibuilder.generator.v0.models.Attribute) => { - jsObjectAttribute(obj) + io.apibuilder.generator.v0.models.json.jsObjectAttribute(obj) } } @@ -233,7 +233,7 @@ package io.apibuilder.generator.v0.models { implicit def jsonWritesApibuilderGeneratorError: play.api.libs.json.Writes[Error] = { (obj: io.apibuilder.generator.v0.models.Error) => { - jsObjectError(obj) + io.apibuilder.generator.v0.models.json.jsObjectError(obj) } } @@ -262,7 +262,7 @@ package io.apibuilder.generator.v0.models { implicit def jsonWritesApibuilderGeneratorFile: play.api.libs.json.Writes[File] = { (obj: io.apibuilder.generator.v0.models.File) => { - jsObjectFile(obj) + io.apibuilder.generator.v0.models.json.jsObjectFile(obj) } } @@ -293,7 +293,7 @@ package io.apibuilder.generator.v0.models { implicit def jsonWritesApibuilderGeneratorGenerator: play.api.libs.json.Writes[Generator] = { (obj: io.apibuilder.generator.v0.models.Generator) => { - jsObjectGenerator(obj) + io.apibuilder.generator.v0.models.json.jsObjectGenerator(obj) } } @@ -309,7 +309,7 @@ package io.apibuilder.generator.v0.models { implicit def jsonWritesApibuilderGeneratorHealthcheck: play.api.libs.json.Writes[Healthcheck] = { (obj: io.apibuilder.generator.v0.models.Healthcheck) => { - jsObjectHealthcheck(obj) + io.apibuilder.generator.v0.models.json.jsObjectHealthcheck(obj) } } @@ -329,7 +329,7 @@ package io.apibuilder.generator.v0.models { implicit def jsonWritesApibuilderGeneratorInvocation: play.api.libs.json.Writes[Invocation] = { (obj: io.apibuilder.generator.v0.models.Invocation) => { - jsObjectInvocation(obj) + io.apibuilder.generator.v0.models.json.jsObjectInvocation(obj) } } @@ -358,7 +358,7 @@ package io.apibuilder.generator.v0.models { implicit def jsonWritesApibuilderGeneratorInvocationForm: play.api.libs.json.Writes[InvocationForm] = { (obj: io.apibuilder.generator.v0.models.InvocationForm) => { - jsObjectInvocationForm(obj) + io.apibuilder.generator.v0.models.json.jsObjectInvocationForm(obj) } } } From 035901706f3f2c95966c322df555e8b7eb593b1e Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Wed, 3 Jul 2024 10:52:02 -0400 Subject: [PATCH 14/95] wip --- .apibuilder/.tracked_files | 3 + ...icollectiveApibuilderApiJsonV0Models.scala | 90 ++++----- .../ApicollectiveApibuilderApiV0Client.scala | 178 +++++++++--------- ...picollectiveApibuilderCommonV0Client.scala | 24 +-- .../ApicollectiveApibuilderTaskV0Client.scala | 48 ++--- 5 files changed, 173 insertions(+), 170 deletions(-) diff --git a/.apibuilder/.tracked_files b/.apibuilder/.tracked_files index 59bad6471..6452dd836 100644 --- a/.apibuilder/.tracked_files +++ b/.apibuilder/.tracked_files @@ -3,6 +3,7 @@ apicollective: apibuilder-api: anorm_2_8_parsers: - api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala + - api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala play_2_9_scala_3_client: - generated/app/ApicollectiveApibuilderApiV0Client.scala play_2_x_routes: @@ -13,6 +14,7 @@ apicollective: apibuilder-common: anorm_2_8_parsers: - api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala + - api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala play_2_8_mock_client: - generated/app/ApicollectiveApibuilderCommonV0MockClient.scala play_2_9_scala_3_client: @@ -28,6 +30,7 @@ apicollective: apibuilder-spec: anorm_2_8_parsers: - api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala + - api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala play_2_8_mock_client: - generated/app/ApicollectiveApibuilderSpecV0MockClient.scala play_2_9_scala_3_client: diff --git a/core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala b/core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala index 432f57eff..9406977b7 100644 --- a/core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala +++ b/core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.48 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api-json/latest/play_2_x_scala_3_json + * Service version: 0.16.50 + * User agent: apibuilder localhost 9000/apicollective/apibuilder-api-json/latest/play_2_x_scala_3_json */ package io.apibuilder.api.json.v0.models { @@ -300,7 +300,7 @@ package io.apibuilder.api.json.v0.models { implicit def jsonWritesApibuilderApiJsonParameterLocation: play.api.libs.json.Writes[ParameterLocation] = { (obj: io.apibuilder.api.json.v0.models.ParameterLocation) => { - jsonWritesApibuilderApiJsonParameterLocation(obj) + io.apibuilder.api.json.v0.models.json.jsonWritesApibuilderApiJsonParameterLocation(obj) } } @@ -318,13 +318,13 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderApiJsonAnnotation: play.api.libs.json.Writes[Annotation] = { (obj: io.apibuilder.api.json.v0.models.Annotation) => { - jsObjectAnnotation(obj) + io.apibuilder.api.json.v0.models.json.jsObjectAnnotation(obj) } } @@ -362,7 +362,7 @@ package io.apibuilder.api.json.v0.models { "attributes" -> play.api.libs.json.Json.toJson(obj.attributes) ) ++ (obj.info match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("info" -> jsObjectInfo(x)) + case Some(x) => play.api.libs.json.Json.obj("info" -> io.apibuilder.api.json.v0.models.json.jsObjectInfo(x)) }) ++ (obj.namespace match { case None => play.api.libs.json.Json.obj() @@ -378,13 +378,13 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.templates match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("templates" -> jsObjectTemplates(x)) + case Some(x) => play.api.libs.json.Json.obj("templates" -> io.apibuilder.api.json.v0.models.json.jsObjectTemplates(x)) }) } implicit def jsonWritesApibuilderApiJsonApiJson: play.api.libs.json.Writes[ApiJson] = { (obj: io.apibuilder.api.json.v0.models.ApiJson) => { - jsObjectApiJson(obj) + io.apibuilder.api.json.v0.models.json.jsObjectApiJson(obj) } } @@ -404,7 +404,7 @@ package io.apibuilder.api.json.v0.models { implicit def jsonWritesApibuilderApiJsonAttribute: play.api.libs.json.Writes[Attribute] = { (obj: io.apibuilder.api.json.v0.models.Attribute) => { - jsObjectAttribute(obj) + io.apibuilder.api.json.v0.models.json.jsObjectAttribute(obj) } } @@ -430,13 +430,13 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderApiJsonBody: play.api.libs.json.Writes[Body] = { (obj: io.apibuilder.api.json.v0.models.Body) => { - jsObjectBody(obj) + io.apibuilder.api.json.v0.models.json.jsObjectBody(obj) } } @@ -465,7 +465,7 @@ package io.apibuilder.api.json.v0.models { implicit def jsonWritesApibuilderApiJsonContact: play.api.libs.json.Writes[Contact] = { (obj: io.apibuilder.api.json.v0.models.Contact) => { - jsObjectContact(obj) + io.apibuilder.api.json.v0.models.json.jsObjectContact(obj) } } @@ -482,7 +482,7 @@ package io.apibuilder.api.json.v0.models { implicit def jsonWritesApibuilderApiJsonDeprecation: play.api.libs.json.Writes[Deprecation] = { (obj: io.apibuilder.api.json.v0.models.Deprecation) => { - jsObjectDeprecation(obj) + io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(obj) } } @@ -513,13 +513,13 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderApiJsonEnum: play.api.libs.json.Writes[Enum] = { (obj: io.apibuilder.api.json.v0.models.Enum) => { - jsObjectEnum(obj) + io.apibuilder.api.json.v0.models.json.jsObjectEnum(obj) } } @@ -550,13 +550,13 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderApiJsonEnumValue: play.api.libs.json.Writes[EnumValue] = { (obj: io.apibuilder.api.json.v0.models.EnumValue) => { - jsObjectEnumValue(obj) + io.apibuilder.api.json.v0.models.json.jsObjectEnumValue(obj) } } @@ -611,13 +611,13 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderApiJsonField: play.api.libs.json.Writes[Field] = { (obj: io.apibuilder.api.json.v0.models.Field) => { - jsObjectField(obj) + io.apibuilder.api.json.v0.models.json.jsObjectField(obj) } } @@ -647,13 +647,13 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderApiJsonHeader: play.api.libs.json.Writes[Header] = { (obj: io.apibuilder.api.json.v0.models.Header) => { - jsObjectHeader(obj) + io.apibuilder.api.json.v0.models.json.jsObjectHeader(obj) } } @@ -669,7 +669,7 @@ package io.apibuilder.api.json.v0.models { implicit def jsonWritesApibuilderApiJsonImport: play.api.libs.json.Writes[Import] = { (obj: io.apibuilder.api.json.v0.models.Import) => { - jsObjectImport(obj) + io.apibuilder.api.json.v0.models.json.jsObjectImport(obj) } } @@ -683,17 +683,17 @@ package io.apibuilder.api.json.v0.models { def jsObjectInfo(obj: io.apibuilder.api.json.v0.models.Info): play.api.libs.json.JsObject = { (obj.contact match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("contact" -> jsObjectContact(x)) + case Some(x) => play.api.libs.json.Json.obj("contact" -> io.apibuilder.api.json.v0.models.json.jsObjectContact(x)) }) ++ (obj.license match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("license" -> jsObjectLicense(x)) + case Some(x) => play.api.libs.json.Json.obj("license" -> io.apibuilder.api.json.v0.models.json.jsObjectLicense(x)) }) } implicit def jsonWritesApibuilderApiJsonInfo: play.api.libs.json.Writes[Info] = { (obj: io.apibuilder.api.json.v0.models.Info) => { - jsObjectInfo(obj) + io.apibuilder.api.json.v0.models.json.jsObjectInfo(obj) } } @@ -726,13 +726,13 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderApiJsonInterface: play.api.libs.json.Writes[Interface] = { (obj: io.apibuilder.api.json.v0.models.Interface) => { - jsObjectInterface(obj) + io.apibuilder.api.json.v0.models.json.jsObjectInterface(obj) } } @@ -754,7 +754,7 @@ package io.apibuilder.api.json.v0.models { implicit def jsonWritesApibuilderApiJsonLicense: play.api.libs.json.Writes[License] = { (obj: io.apibuilder.api.json.v0.models.License) => { - jsObjectLicense(obj) + io.apibuilder.api.json.v0.models.json.jsObjectLicense(obj) } } @@ -795,13 +795,13 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderApiJsonModel: play.api.libs.json.Writes[Model] = { (obj: io.apibuilder.api.json.v0.models.Model) => { - jsObjectModel(obj) + io.apibuilder.api.json.v0.models.json.jsObjectModel(obj) } } @@ -831,7 +831,7 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.body match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("body" -> jsObjectBody(x)) + case Some(x) => play.api.libs.json.Json.obj("body" -> io.apibuilder.api.json.v0.models.json.jsObjectBody(x)) }) ++ (obj.parameters match { case None => play.api.libs.json.Json.obj() @@ -847,13 +847,13 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderApiJsonOperation: play.api.libs.json.Writes[Operation] = { (obj: io.apibuilder.api.json.v0.models.Operation) => { - jsObjectOperation(obj) + io.apibuilder.api.json.v0.models.json.jsObjectOperation(obj) } } @@ -905,13 +905,13 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderApiJsonParameter: play.api.libs.json.Writes[Parameter] = { (obj: io.apibuilder.api.json.v0.models.Parameter) => { - jsObjectParameter(obj) + io.apibuilder.api.json.v0.models.json.jsObjectParameter(obj) } } @@ -947,13 +947,13 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderApiJsonResource: play.api.libs.json.Writes[Resource] = { (obj: io.apibuilder.api.json.v0.models.Resource) => { - jsObjectResource(obj) + io.apibuilder.api.json.v0.models.json.jsObjectResource(obj) } } @@ -980,7 +980,7 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(x)) }) ++ (obj.attributes match { case None => play.api.libs.json.Json.obj() @@ -990,7 +990,7 @@ package io.apibuilder.api.json.v0.models { implicit def jsonWritesApibuilderApiJsonResponse: play.api.libs.json.Writes[Response] = { (obj: io.apibuilder.api.json.v0.models.Response) => { - jsObjectResponse(obj) + io.apibuilder.api.json.v0.models.json.jsObjectResponse(obj) } } @@ -1012,7 +1012,7 @@ package io.apibuilder.api.json.v0.models { implicit def jsonWritesApibuilderApiJsonTemplateDeclaration: play.api.libs.json.Writes[TemplateDeclaration] = { (obj: io.apibuilder.api.json.v0.models.TemplateDeclaration) => { - jsObjectTemplateDeclaration(obj) + io.apibuilder.api.json.v0.models.json.jsObjectTemplateDeclaration(obj) } } @@ -1036,7 +1036,7 @@ package io.apibuilder.api.json.v0.models { implicit def jsonWritesApibuilderApiJsonTemplates: play.api.libs.json.Writes[Templates] = { (obj: io.apibuilder.api.json.v0.models.Templates) => { - jsObjectTemplates(obj) + io.apibuilder.api.json.v0.models.json.jsObjectTemplates(obj) } } @@ -1077,13 +1077,13 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderApiJsonUnion: play.api.libs.json.Writes[Union] = { (obj: io.apibuilder.api.json.v0.models.Union) => { - jsObjectUnion(obj) + io.apibuilder.api.json.v0.models.json.jsObjectUnion(obj) } } @@ -1116,13 +1116,13 @@ package io.apibuilder.api.json.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.api.json.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderApiJsonUnionType: play.api.libs.json.Writes[UnionType] = { (obj: io.apibuilder.api.json.v0.models.UnionType) => { - jsObjectUnionType(obj) + io.apibuilder.api.json.v0.models.json.jsObjectUnionType(obj) } } } diff --git a/generated/app/ApicollectiveApibuilderApiV0Client.scala b/generated/app/ApicollectiveApibuilderApiV0Client.scala index c80ad7b81..69c977781 100644 --- a/generated/app/ApicollectiveApibuilderApiV0Client.scala +++ b/generated/app/ApicollectiveApibuilderApiV0Client.scala @@ -1,6 +1,6 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 + * Service version: 0.16.50 * User agent: apibuilder localhost 9000/apicollective/apibuilder-api/latest/play_2_9_scala_3_client */ package io.apibuilder.api.v0.models { @@ -992,7 +992,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiAppSortBy: play.api.libs.json.Writes[AppSortBy] = { (obj: io.apibuilder.api.v0.models.AppSortBy) => { - jsonWritesApibuilderApiAppSortBy(obj) + io.apibuilder.api.v0.models.json.jsonWritesApibuilderApiAppSortBy(obj) } } @@ -1024,7 +1024,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiOriginalType: play.api.libs.json.Writes[OriginalType] = { (obj: io.apibuilder.api.v0.models.OriginalType) => { - jsonWritesApibuilderApiOriginalType(obj) + io.apibuilder.api.v0.models.json.jsonWritesApibuilderApiOriginalType(obj) } } @@ -1056,7 +1056,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiPublication: play.api.libs.json.Writes[Publication] = { (obj: io.apibuilder.api.v0.models.Publication) => { - jsonWritesApibuilderApiPublication(obj) + io.apibuilder.api.v0.models.json.jsonWritesApibuilderApiPublication(obj) } } @@ -1088,7 +1088,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiSortOrder: play.api.libs.json.Writes[SortOrder] = { (obj: io.apibuilder.api.v0.models.SortOrder) => { - jsonWritesApibuilderApiSortOrder(obj) + io.apibuilder.api.v0.models.json.jsonWritesApibuilderApiSortOrder(obj) } } @@ -1120,7 +1120,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiVisibility: play.api.libs.json.Writes[Visibility] = { (obj: io.apibuilder.api.v0.models.Visibility) => { - jsonWritesApibuilderApiVisibility(obj) + io.apibuilder.api.v0.models.json.jsonWritesApibuilderApiVisibility(obj) } } @@ -1154,7 +1154,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiApplication: play.api.libs.json.Writes[Application] = { (obj: io.apibuilder.api.v0.models.Application) => { - jsObjectApplication(obj) + io.apibuilder.api.v0.models.json.jsObjectApplication(obj) } } @@ -1183,7 +1183,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiApplicationForm: play.api.libs.json.Writes[ApplicationForm] = { (obj: io.apibuilder.api.v0.models.ApplicationForm) => { - jsObjectApplicationForm(obj) + io.apibuilder.api.v0.models.json.jsObjectApplicationForm(obj) } } @@ -1203,7 +1203,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiApplicationMetadata: play.api.libs.json.Writes[ApplicationMetadata] = { (obj: io.apibuilder.api.v0.models.ApplicationMetadata) => { - jsObjectApplicationMetadata(obj) + io.apibuilder.api.v0.models.json.jsObjectApplicationMetadata(obj) } } @@ -1219,7 +1219,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiApplicationMetadataVersion: play.api.libs.json.Writes[ApplicationMetadataVersion] = { (obj: io.apibuilder.api.v0.models.ApplicationMetadataVersion) => { - jsObjectApplicationMetadataVersion(obj) + io.apibuilder.api.v0.models.json.jsObjectApplicationMetadataVersion(obj) } } @@ -1241,7 +1241,7 @@ package io.apibuilder.api.v0.models { def jsonWritesApibuilderApiApplicationSummary: play.api.libs.json.Writes[ApplicationSummary] = { (obj: io.apibuilder.api.v0.models.ApplicationSummary) => { - jsObjectApplicationSummary(obj) + io.apibuilder.api.v0.models.json.jsObjectApplicationSummary(obj) } } @@ -1267,7 +1267,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiAttribute: play.api.libs.json.Writes[Attribute] = { (obj: io.apibuilder.api.v0.models.Attribute) => { - jsObjectAttribute(obj) + io.apibuilder.api.v0.models.json.jsObjectAttribute(obj) } } @@ -1289,7 +1289,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiAttributeForm: play.api.libs.json.Writes[AttributeForm] = { (obj: io.apibuilder.api.v0.models.AttributeForm) => { - jsObjectAttributeForm(obj) + io.apibuilder.api.v0.models.json.jsObjectAttributeForm(obj) } } @@ -1309,7 +1309,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiAttributeSummary: play.api.libs.json.Writes[AttributeSummary] = { (obj: io.apibuilder.api.v0.models.AttributeSummary) => { - jsObjectAttributeSummary(obj) + io.apibuilder.api.v0.models.json.jsObjectAttributeSummary(obj) } } @@ -1325,7 +1325,7 @@ package io.apibuilder.api.v0.models { def jsObjectAttributeValue(obj: io.apibuilder.api.v0.models.AttributeValue): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString), - "attribute" -> jsObjectAttributeSummary(obj.attribute), + "attribute" -> io.apibuilder.api.v0.models.json.jsObjectAttributeSummary(obj.attribute), "value" -> play.api.libs.json.JsString(obj.value), "audit" -> io.apibuilder.common.v0.models.json.jsObjectAudit(obj.audit) ) @@ -1333,7 +1333,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiAttributeValue: play.api.libs.json.Writes[AttributeValue] = { (obj: io.apibuilder.api.v0.models.AttributeValue) => { - jsObjectAttributeValue(obj) + io.apibuilder.api.v0.models.json.jsObjectAttributeValue(obj) } } @@ -1349,7 +1349,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiAttributeValueForm: play.api.libs.json.Writes[AttributeValueForm] = { (obj: io.apibuilder.api.v0.models.AttributeValueForm) => { - jsObjectAttributeValueForm(obj) + io.apibuilder.api.v0.models.json.jsObjectAttributeValueForm(obj) } } @@ -1362,14 +1362,14 @@ package io.apibuilder.api.v0.models { def jsObjectAuthentication(obj: io.apibuilder.api.v0.models.Authentication): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( - "user" -> jsObjectUser(obj.user), - "session" -> jsObjectSession(obj.session) + "user" -> io.apibuilder.api.v0.models.json.jsObjectUser(obj.user), + "session" -> io.apibuilder.api.v0.models.json.jsObjectSession(obj.session) ) } implicit def jsonWritesApibuilderApiAuthentication: play.api.libs.json.Writes[Authentication] = { (obj: io.apibuilder.api.v0.models.Authentication) => { - jsObjectAuthentication(obj) + io.apibuilder.api.v0.models.json.jsObjectAuthentication(obj) } } @@ -1389,7 +1389,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiBatchDownloadApplicationForm: play.api.libs.json.Writes[BatchDownloadApplicationForm] = { (obj: io.apibuilder.api.v0.models.BatchDownloadApplicationForm) => { - jsObjectBatchDownloadApplicationForm(obj) + io.apibuilder.api.v0.models.json.jsObjectBatchDownloadApplicationForm(obj) } } @@ -1405,7 +1405,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiBatchDownloadApplications: play.api.libs.json.Writes[BatchDownloadApplications] = { (obj: io.apibuilder.api.v0.models.BatchDownloadApplications) => { - jsObjectBatchDownloadApplications(obj) + io.apibuilder.api.v0.models.json.jsObjectBatchDownloadApplications(obj) } } @@ -1421,7 +1421,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiBatchDownloadApplicationsForm: play.api.libs.json.Writes[BatchDownloadApplicationsForm] = { (obj: io.apibuilder.api.v0.models.BatchDownloadApplicationsForm) => { - jsObjectBatchDownloadApplicationsForm(obj) + io.apibuilder.api.v0.models.json.jsObjectBatchDownloadApplicationsForm(obj) } } @@ -1444,18 +1444,18 @@ package io.apibuilder.api.v0.models { "guid" -> play.api.libs.json.JsString(obj.guid.toString), "organization" -> io.apibuilder.common.v0.models.json.jsObjectReference(obj.organization), "application" -> io.apibuilder.common.v0.models.json.jsObjectReference(obj.application), - "from_version" -> jsObjectChangeVersion(obj.fromVersion), - "to_version" -> jsObjectChangeVersion(obj.toVersion), - "diff" -> jsObjectDiff(obj.diff), + "from_version" -> io.apibuilder.api.v0.models.json.jsObjectChangeVersion(obj.fromVersion), + "to_version" -> io.apibuilder.api.v0.models.json.jsObjectChangeVersion(obj.toVersion), + "diff" -> io.apibuilder.api.v0.models.json.jsObjectDiff(obj.diff), "changed_at" -> play.api.libs.json.JsString(_root_.org.joda.time.format.ISODateTimeFormat.dateTime.print(obj.changedAt)), - "changed_by" -> jsObjectUserSummary(obj.changedBy), + "changed_by" -> io.apibuilder.api.v0.models.json.jsObjectUserSummary(obj.changedBy), "audit" -> io.apibuilder.common.v0.models.json.jsObjectAudit(obj.audit) ) } implicit def jsonWritesApibuilderApiChange: play.api.libs.json.Writes[Change] = { (obj: io.apibuilder.api.v0.models.Change) => { - jsObjectChange(obj) + io.apibuilder.api.v0.models.json.jsObjectChange(obj) } } @@ -1475,7 +1475,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiChangeVersion: play.api.libs.json.Writes[ChangeVersion] = { (obj: io.apibuilder.api.v0.models.ChangeVersion) => { - jsObjectChangeVersion(obj) + io.apibuilder.api.v0.models.json.jsObjectChangeVersion(obj) } } @@ -1491,7 +1491,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiCleartextToken: play.api.libs.json.Writes[CleartextToken] = { (obj: io.apibuilder.api.v0.models.CleartextToken) => { - jsObjectCleartextToken(obj) + io.apibuilder.api.v0.models.json.jsObjectCleartextToken(obj) } } @@ -1505,7 +1505,7 @@ package io.apibuilder.api.v0.models { def jsObjectCode(obj: io.apibuilder.api.v0.models.Code): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( - "generator" -> jsObjectGeneratorWithService(obj.generator), + "generator" -> io.apibuilder.api.v0.models.json.jsObjectGeneratorWithService(obj.generator), "source" -> play.api.libs.json.JsString(obj.source), "files" -> play.api.libs.json.Json.toJson(obj.files) ) @@ -1513,7 +1513,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiCode: play.api.libs.json.Writes[Code] = { (obj: io.apibuilder.api.v0.models.Code) => { - jsObjectCode(obj) + io.apibuilder.api.v0.models.json.jsObjectCode(obj) } } @@ -1529,7 +1529,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiCodeForm: play.api.libs.json.Writes[CodeForm] = { (obj: io.apibuilder.api.v0.models.CodeForm) => { - jsObjectCodeForm(obj) + io.apibuilder.api.v0.models.json.jsObjectCodeForm(obj) } } @@ -1549,7 +1549,7 @@ package io.apibuilder.api.v0.models { def jsonWritesApibuilderApiDiffBreaking: play.api.libs.json.Writes[DiffBreaking] = { (obj: io.apibuilder.api.v0.models.DiffBreaking) => { - jsObjectDiffBreaking(obj) + io.apibuilder.api.v0.models.json.jsObjectDiffBreaking(obj) } } @@ -1569,7 +1569,7 @@ package io.apibuilder.api.v0.models { def jsonWritesApibuilderApiDiffNonBreaking: play.api.libs.json.Writes[DiffNonBreaking] = { (obj: io.apibuilder.api.v0.models.DiffNonBreaking) => { - jsObjectDiffNonBreaking(obj) + io.apibuilder.api.v0.models.json.jsObjectDiffNonBreaking(obj) } } @@ -1585,7 +1585,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiDomain: play.api.libs.json.Writes[Domain] = { (obj: io.apibuilder.api.v0.models.Domain) => { - jsObjectDomain(obj) + io.apibuilder.api.v0.models.json.jsObjectDomain(obj) } } @@ -1601,7 +1601,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiEmailVerificationConfirmationForm: play.api.libs.json.Writes[EmailVerificationConfirmationForm] = { (obj: io.apibuilder.api.v0.models.EmailVerificationConfirmationForm) => { - jsObjectEmailVerificationConfirmationForm(obj) + io.apibuilder.api.v0.models.json.jsObjectEmailVerificationConfirmationForm(obj) } } @@ -1621,7 +1621,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiError: play.api.libs.json.Writes[Error] = { (obj: io.apibuilder.api.v0.models.Error) => { - jsObjectError(obj) + io.apibuilder.api.v0.models.json.jsObjectError(obj) } } @@ -1641,7 +1641,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiGeneratorForm: play.api.libs.json.Writes[GeneratorForm] = { (obj: io.apibuilder.api.v0.models.GeneratorForm) => { - jsObjectGeneratorForm(obj) + io.apibuilder.api.v0.models.json.jsObjectGeneratorForm(obj) } } @@ -1663,7 +1663,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiGeneratorService: play.api.libs.json.Writes[GeneratorService] = { (obj: io.apibuilder.api.v0.models.GeneratorService) => { - jsObjectGeneratorService(obj) + io.apibuilder.api.v0.models.json.jsObjectGeneratorService(obj) } } @@ -1679,7 +1679,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiGeneratorServiceForm: play.api.libs.json.Writes[GeneratorServiceForm] = { (obj: io.apibuilder.api.v0.models.GeneratorServiceForm) => { - jsObjectGeneratorServiceForm(obj) + io.apibuilder.api.v0.models.json.jsObjectGeneratorServiceForm(obj) } } @@ -1692,14 +1692,14 @@ package io.apibuilder.api.v0.models { def jsObjectGeneratorWithService(obj: io.apibuilder.api.v0.models.GeneratorWithService): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( - "service" -> jsObjectGeneratorService(obj.service), + "service" -> io.apibuilder.api.v0.models.json.jsObjectGeneratorService(obj.service), "generator" -> io.apibuilder.generator.v0.models.json.jsObjectGenerator(obj.generator) ) } implicit def jsonWritesApibuilderApiGeneratorWithService: play.api.libs.json.Writes[GeneratorWithService] = { (obj: io.apibuilder.api.v0.models.GeneratorWithService) => { - jsObjectGeneratorWithService(obj) + io.apibuilder.api.v0.models.json.jsObjectGeneratorWithService(obj) } } @@ -1715,7 +1715,7 @@ package io.apibuilder.api.v0.models { def jsObjectItem(obj: io.apibuilder.api.v0.models.Item): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString), - "detail" -> jsObjectItemDetail(obj.detail), + "detail" -> io.apibuilder.api.v0.models.json.jsObjectItemDetail(obj.detail), "label" -> play.api.libs.json.JsString(obj.label) ) ++ (obj.description match { case None => play.api.libs.json.Json.obj() @@ -1725,7 +1725,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiItem: play.api.libs.json.Writes[Item] = { (obj: io.apibuilder.api.v0.models.Item) => { - jsObjectItem(obj) + io.apibuilder.api.v0.models.json.jsObjectItem(obj) } } @@ -1742,8 +1742,8 @@ package io.apibuilder.api.v0.models { def jsObjectMembership(obj: io.apibuilder.api.v0.models.Membership): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString), - "user" -> jsObjectUser(obj.user), - "organization" -> jsObjectOrganization(obj.organization), + "user" -> io.apibuilder.api.v0.models.json.jsObjectUser(obj.user), + "organization" -> io.apibuilder.api.v0.models.json.jsObjectOrganization(obj.organization), "role" -> play.api.libs.json.JsString(obj.role.toString), "audit" -> io.apibuilder.common.v0.models.json.jsObjectAudit(obj.audit) ) @@ -1751,7 +1751,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiMembership: play.api.libs.json.Writes[Membership] = { (obj: io.apibuilder.api.v0.models.Membership) => { - jsObjectMembership(obj) + io.apibuilder.api.v0.models.json.jsObjectMembership(obj) } } @@ -1768,8 +1768,8 @@ package io.apibuilder.api.v0.models { def jsObjectMembershipRequest(obj: io.apibuilder.api.v0.models.MembershipRequest): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString), - "user" -> jsObjectUser(obj.user), - "organization" -> jsObjectOrganization(obj.organization), + "user" -> io.apibuilder.api.v0.models.json.jsObjectUser(obj.user), + "organization" -> io.apibuilder.api.v0.models.json.jsObjectOrganization(obj.organization), "role" -> play.api.libs.json.JsString(obj.role.toString), "audit" -> io.apibuilder.common.v0.models.json.jsObjectAudit(obj.audit) ) @@ -1777,7 +1777,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiMembershipRequest: play.api.libs.json.Writes[MembershipRequest] = { (obj: io.apibuilder.api.v0.models.MembershipRequest) => { - jsObjectMembershipRequest(obj) + io.apibuilder.api.v0.models.json.jsObjectMembershipRequest(obj) } } @@ -1793,7 +1793,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiMoveForm: play.api.libs.json.Writes[MoveForm] = { (obj: io.apibuilder.api.v0.models.MoveForm) => { - jsObjectMoveForm(obj) + io.apibuilder.api.v0.models.json.jsObjectMoveForm(obj) } } @@ -1823,7 +1823,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiOrganization: play.api.libs.json.Writes[Organization] = { (obj: io.apibuilder.api.v0.models.Organization) => { - jsObjectOrganization(obj) + io.apibuilder.api.v0.models.json.jsObjectOrganization(obj) } } @@ -1854,7 +1854,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiOrganizationForm: play.api.libs.json.Writes[OrganizationForm] = { (obj: io.apibuilder.api.v0.models.OrganizationForm) => { - jsObjectOrganizationForm(obj) + io.apibuilder.api.v0.models.json.jsObjectOrganizationForm(obj) } } @@ -1874,7 +1874,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiOriginal: play.api.libs.json.Writes[Original] = { (obj: io.apibuilder.api.v0.models.Original) => { - jsObjectOriginal(obj) + io.apibuilder.api.v0.models.json.jsObjectOriginal(obj) } } @@ -1896,7 +1896,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiOriginalForm: play.api.libs.json.Writes[OriginalForm] = { (obj: io.apibuilder.api.v0.models.OriginalForm) => { - jsObjectOriginalForm(obj) + io.apibuilder.api.v0.models.json.jsObjectOriginalForm(obj) } } @@ -1916,7 +1916,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiPasswordReset: play.api.libs.json.Writes[PasswordReset] = { (obj: io.apibuilder.api.v0.models.PasswordReset) => { - jsObjectPasswordReset(obj) + io.apibuilder.api.v0.models.json.jsObjectPasswordReset(obj) } } @@ -1932,7 +1932,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiPasswordResetRequest: play.api.libs.json.Writes[PasswordResetRequest] = { (obj: io.apibuilder.api.v0.models.PasswordResetRequest) => { - jsObjectPasswordResetRequest(obj) + io.apibuilder.api.v0.models.json.jsObjectPasswordResetRequest(obj) } } @@ -1952,7 +1952,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiSession: play.api.libs.json.Writes[Session] = { (obj: io.apibuilder.api.v0.models.Session) => { - jsObjectSession(obj) + io.apibuilder.api.v0.models.json.jsObjectSession(obj) } } @@ -1969,8 +1969,8 @@ package io.apibuilder.api.v0.models { def jsObjectSubscription(obj: io.apibuilder.api.v0.models.Subscription): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString), - "organization" -> jsObjectOrganization(obj.organization), - "user" -> jsObjectUser(obj.user), + "organization" -> io.apibuilder.api.v0.models.json.jsObjectOrganization(obj.organization), + "user" -> io.apibuilder.api.v0.models.json.jsObjectUser(obj.user), "publication" -> play.api.libs.json.JsString(obj.publication.toString), "audit" -> io.apibuilder.common.v0.models.json.jsObjectAudit(obj.audit) ) @@ -1978,7 +1978,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiSubscription: play.api.libs.json.Writes[Subscription] = { (obj: io.apibuilder.api.v0.models.Subscription) => { - jsObjectSubscription(obj) + io.apibuilder.api.v0.models.json.jsObjectSubscription(obj) } } @@ -2000,7 +2000,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiSubscriptionForm: play.api.libs.json.Writes[SubscriptionForm] = { (obj: io.apibuilder.api.v0.models.SubscriptionForm) => { - jsObjectSubscriptionForm(obj) + io.apibuilder.api.v0.models.json.jsObjectSubscriptionForm(obj) } } @@ -2017,7 +2017,7 @@ package io.apibuilder.api.v0.models { def jsObjectToken(obj: io.apibuilder.api.v0.models.Token): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString), - "user" -> jsObjectUser(obj.user), + "user" -> io.apibuilder.api.v0.models.json.jsObjectUser(obj.user), "masked_token" -> play.api.libs.json.JsString(obj.maskedToken), "audit" -> io.apibuilder.common.v0.models.json.jsObjectAudit(obj.audit) ) ++ (obj.description match { @@ -2028,7 +2028,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiToken: play.api.libs.json.Writes[Token] = { (obj: io.apibuilder.api.v0.models.Token) => { - jsObjectToken(obj) + io.apibuilder.api.v0.models.json.jsObjectToken(obj) } } @@ -2050,7 +2050,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiTokenForm: play.api.libs.json.Writes[TokenForm] = { (obj: io.apibuilder.api.v0.models.TokenForm) => { - jsObjectTokenForm(obj) + io.apibuilder.api.v0.models.json.jsObjectTokenForm(obj) } } @@ -2078,7 +2078,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiUser: play.api.libs.json.Writes[User] = { (obj: io.apibuilder.api.v0.models.User) => { - jsObjectUser(obj) + io.apibuilder.api.v0.models.json.jsObjectUser(obj) } } @@ -2107,7 +2107,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiUserForm: play.api.libs.json.Writes[UserForm] = { (obj: io.apibuilder.api.v0.models.UserForm) => { - jsObjectUserForm(obj) + io.apibuilder.api.v0.models.json.jsObjectUserForm(obj) } } @@ -2127,7 +2127,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiUserSummary: play.api.libs.json.Writes[UserSummary] = { (obj: io.apibuilder.api.v0.models.UserSummary) => { - jsObjectUserSummary(obj) + io.apibuilder.api.v0.models.json.jsObjectUserSummary(obj) } } @@ -2151,7 +2151,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiUserUpdateForm: play.api.libs.json.Writes[UserUpdateForm] = { (obj: io.apibuilder.api.v0.models.UserUpdateForm) => { - jsObjectUserUpdateForm(obj) + io.apibuilder.api.v0.models.json.jsObjectUserUpdateForm(obj) } } @@ -2171,7 +2171,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiValidation: play.api.libs.json.Writes[Validation] = { (obj: io.apibuilder.api.v0.models.Validation) => { - jsObjectValidation(obj) + io.apibuilder.api.v0.models.json.jsObjectValidation(obj) } } @@ -2197,13 +2197,13 @@ package io.apibuilder.api.v0.models { "audit" -> io.apibuilder.common.v0.models.json.jsObjectAudit(obj.audit) ) ++ (obj.original match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("original" -> jsObjectOriginal(x)) + case Some(x) => play.api.libs.json.Json.obj("original" -> io.apibuilder.api.v0.models.json.jsObjectOriginal(x)) }) } implicit def jsonWritesApibuilderApiVersion: play.api.libs.json.Writes[Version] = { (obj: io.apibuilder.api.v0.models.Version) => { - jsObjectVersion(obj) + io.apibuilder.api.v0.models.json.jsObjectVersion(obj) } } @@ -2216,7 +2216,7 @@ package io.apibuilder.api.v0.models { def jsObjectVersionForm(obj: io.apibuilder.api.v0.models.VersionForm): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( - "original_form" -> jsObjectOriginalForm(obj.originalForm) + "original_form" -> io.apibuilder.api.v0.models.json.jsObjectOriginalForm(obj.originalForm) ) ++ (obj.visibility match { case None => play.api.libs.json.Json.obj() case Some(x) => play.api.libs.json.Json.obj("visibility" -> play.api.libs.json.JsString(x.toString)) @@ -2225,7 +2225,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiVersionForm: play.api.libs.json.Writes[VersionForm] = { (obj: io.apibuilder.api.v0.models.VersionForm) => { - jsObjectVersionForm(obj) + io.apibuilder.api.v0.models.json.jsObjectVersionForm(obj) } } @@ -2242,16 +2242,16 @@ package io.apibuilder.api.v0.models { def jsObjectWatch(obj: io.apibuilder.api.v0.models.Watch): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString), - "user" -> jsObjectUser(obj.user), - "organization" -> jsObjectOrganization(obj.organization), - "application" -> jsObjectApplication(obj.application), + "user" -> io.apibuilder.api.v0.models.json.jsObjectUser(obj.user), + "organization" -> io.apibuilder.api.v0.models.json.jsObjectOrganization(obj.organization), + "application" -> io.apibuilder.api.v0.models.json.jsObjectApplication(obj.application), "audit" -> io.apibuilder.common.v0.models.json.jsObjectAudit(obj.audit) ) } implicit def jsonWritesApibuilderApiWatch: play.api.libs.json.Writes[Watch] = { (obj: io.apibuilder.api.v0.models.Watch) => { - jsObjectWatch(obj) + io.apibuilder.api.v0.models.json.jsObjectWatch(obj) } } @@ -2273,15 +2273,15 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiWatchForm: play.api.libs.json.Writes[WatchForm] = { (obj: io.apibuilder.api.v0.models.WatchForm) => { - jsObjectWatchForm(obj) + io.apibuilder.api.v0.models.json.jsObjectWatchForm(obj) } } implicit def jsonReadsApibuilderApiDiff[T <: io.apibuilder.api.v0.models.Diff]: play.api.libs.json.Reads[T] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "diff_breaking" => jsonReadsApibuilderApiDiffBreaking.reads(js) - case "diff_non_breaking" => jsonReadsApibuilderApiDiffNonBreaking.reads(js) + case "diff_breaking" => io.apibuilder.api.v0.models.json.jsonReadsApibuilderApiDiffBreaking.reads(js) + case "diff_non_breaking" => io.apibuilder.api.v0.models.json.jsonReadsApibuilderApiDiffNonBreaking.reads(js) case other => play.api.libs.json.JsSuccess(io.apibuilder.api.v0.models.DiffUndefinedType(other)) } } @@ -2306,8 +2306,8 @@ package io.apibuilder.api.v0.models { def jsObjectDiff(obj: io.apibuilder.api.v0.models.Diff): play.api.libs.json.JsObject = { obj match { - case x: io.apibuilder.api.v0.models.DiffBreaking => jsObjectDiffBreaking(x) - case x: io.apibuilder.api.v0.models.DiffNonBreaking => jsObjectDiffNonBreaking(x) + case x: io.apibuilder.api.v0.models.DiffBreaking => io.apibuilder.api.v0.models.json.jsObjectDiffBreaking(x) + case x: io.apibuilder.api.v0.models.DiffNonBreaking => io.apibuilder.api.v0.models.json.jsObjectDiffNonBreaking(x) case other => { sys.error(s"The type[${other.getClass.getName}] has no JSON writer") } @@ -2316,7 +2316,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiDiff[T <: io.apibuilder.api.v0.models.Diff]: play.api.libs.json.Writes[T] = { (obj: io.apibuilder.api.v0.models.Diff) => { - jsObjectDiff(obj) + io.apibuilder.api.v0.models.json.jsObjectDiff(obj) } } @@ -2324,7 +2324,7 @@ package io.apibuilder.api.v0.models { implicit def jsonReadsApibuilderApiItemDetail[T <: io.apibuilder.api.v0.models.ItemDetail]: play.api.libs.json.Reads[T] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "application_summary" => jsonReadsApibuilderApiApplicationSummary.reads(js) + case "application_summary" => io.apibuilder.api.v0.models.json.jsonReadsApibuilderApiApplicationSummary.reads(js) case other => play.api.libs.json.JsSuccess(io.apibuilder.api.v0.models.ItemDetailUndefinedType(other)) } } @@ -2349,7 +2349,7 @@ package io.apibuilder.api.v0.models { def jsObjectItemDetail(obj: io.apibuilder.api.v0.models.ItemDetail): play.api.libs.json.JsObject = { obj match { - case x: io.apibuilder.api.v0.models.ApplicationSummary => jsObjectApplicationSummary(x) + case x: io.apibuilder.api.v0.models.ApplicationSummary => io.apibuilder.api.v0.models.json.jsObjectApplicationSummary(x) case other => { sys.error(s"The type[${other.getClass.getName}] has no JSON writer") } @@ -2358,7 +2358,7 @@ package io.apibuilder.api.v0.models { implicit def jsonWritesApibuilderApiItemDetail[T <: io.apibuilder.api.v0.models.ItemDetail]: play.api.libs.json.Writes[T] = { (obj: io.apibuilder.api.v0.models.ItemDetail) => { - jsObjectItemDetail(obj) + io.apibuilder.api.v0.models.json.jsObjectItemDetail(obj) } } } @@ -2520,7 +2520,7 @@ package io.apibuilder.api.v0 { val BaseUrl = "https://api.apibuilder.io" val Namespace = "io.apibuilder.api.v0" val UserAgent = "apibuilder localhost 9000/apicollective/apibuilder-api/latest/play_2_9_scala_3_client" - val Version = "0.16.43" + val Version = "0.16.50" val VersionMajor = 0 } diff --git a/generated/app/ApicollectiveApibuilderCommonV0Client.scala b/generated/app/ApicollectiveApibuilderCommonV0Client.scala index 02bba2970..bbbfda1aa 100644 --- a/generated/app/ApicollectiveApibuilderCommonV0Client.scala +++ b/generated/app/ApicollectiveApibuilderCommonV0Client.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.48 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-common/latest/play_2_9_scala_3_client + * Service version: 0.16.50 + * User agent: apibuilder localhost 9000/apicollective/apibuilder-common/latest/play_2_9_scala_3_client */ package io.apibuilder.common.v0.models { @@ -122,7 +122,7 @@ package io.apibuilder.common.v0.models { implicit def jsonWritesApibuilderCommonMembershipRole: play.api.libs.json.Writes[MembershipRole] = { (obj: io.apibuilder.common.v0.models.MembershipRole) => { - jsonWritesApibuilderCommonMembershipRole(obj) + io.apibuilder.common.v0.models.json.jsonWritesApibuilderCommonMembershipRole(obj) } } @@ -138,15 +138,15 @@ package io.apibuilder.common.v0.models { def jsObjectAudit(obj: io.apibuilder.common.v0.models.Audit): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "created_at" -> play.api.libs.json.JsString(_root_.org.joda.time.format.ISODateTimeFormat.dateTime.print(obj.createdAt)), - "created_by" -> jsObjectReferenceGuid(obj.createdBy), + "created_by" -> io.apibuilder.common.v0.models.json.jsObjectReferenceGuid(obj.createdBy), "updated_at" -> play.api.libs.json.JsString(_root_.org.joda.time.format.ISODateTimeFormat.dateTime.print(obj.updatedAt)), - "updated_by" -> jsObjectReferenceGuid(obj.updatedBy) + "updated_by" -> io.apibuilder.common.v0.models.json.jsObjectReferenceGuid(obj.updatedBy) ) } implicit def jsonWritesApibuilderCommonAudit: play.api.libs.json.Writes[Audit] = { (obj: io.apibuilder.common.v0.models.Audit) => { - jsObjectAudit(obj) + io.apibuilder.common.v0.models.json.jsObjectAudit(obj) } } @@ -162,7 +162,7 @@ package io.apibuilder.common.v0.models { implicit def jsonWritesApibuilderCommonHealthcheck: play.api.libs.json.Writes[Healthcheck] = { (obj: io.apibuilder.common.v0.models.Healthcheck) => { - jsObjectHealthcheck(obj) + io.apibuilder.common.v0.models.json.jsObjectHealthcheck(obj) } } @@ -182,7 +182,7 @@ package io.apibuilder.common.v0.models { implicit def jsonWritesApibuilderCommonReference: play.api.libs.json.Writes[Reference] = { (obj: io.apibuilder.common.v0.models.Reference) => { - jsObjectReference(obj) + io.apibuilder.common.v0.models.json.jsObjectReference(obj) } } @@ -198,7 +198,7 @@ package io.apibuilder.common.v0.models { implicit def jsonWritesApibuilderCommonReferenceGuid: play.api.libs.json.Writes[ReferenceGuid] = { (obj: io.apibuilder.common.v0.models.ReferenceGuid) => { - jsObjectReferenceGuid(obj) + io.apibuilder.common.v0.models.json.jsObjectReferenceGuid(obj) } } } @@ -322,8 +322,8 @@ package io.apibuilder.common.v0 { object Constants { val Namespace = "io.apibuilder.common.v0" - val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-common/latest/play_2_9_scala_3_client" - val Version = "0.16.48" + val UserAgent = "apibuilder localhost 9000/apicollective/apibuilder-common/latest/play_2_9_scala_3_client" + val Version = "0.16.50" val VersionMajor = 0 } @@ -460,4 +460,4 @@ package io.apibuilder.common.v0 { } -} +} \ No newline at end of file diff --git a/generated/app/ApicollectiveApibuilderTaskV0Client.scala b/generated/app/ApicollectiveApibuilderTaskV0Client.scala index 5d47032ad..e16223600 100644 --- a/generated/app/ApicollectiveApibuilderTaskV0Client.scala +++ b/generated/app/ApicollectiveApibuilderTaskV0Client.scala @@ -205,7 +205,7 @@ package io.apibuilder.task.v0.models { implicit def jsonWritesApibuilderTaskTaskType: play.api.libs.json.Writes[TaskType] = { (obj: io.apibuilder.task.v0.models.TaskType) => { - jsonWritesApibuilderTaskTaskType(obj) + io.apibuilder.task.v0.models.json.jsonWritesApibuilderTaskTaskType(obj) } } @@ -225,7 +225,7 @@ package io.apibuilder.task.v0.models { implicit def jsonWritesApibuilderTaskDiffVersionData: play.api.libs.json.Writes[DiffVersionData] = { (obj: io.apibuilder.task.v0.models.DiffVersionData) => { - jsObjectDiffVersionData(obj) + io.apibuilder.task.v0.models.json.jsObjectDiffVersionData(obj) } } @@ -241,7 +241,7 @@ package io.apibuilder.task.v0.models { def jsonWritesApibuilderTaskEmailDataApplicationCreated: play.api.libs.json.Writes[EmailDataApplicationCreated] = { (obj: io.apibuilder.task.v0.models.EmailDataApplicationCreated) => { - jsObjectEmailDataApplicationCreated(obj) + io.apibuilder.task.v0.models.json.jsObjectEmailDataApplicationCreated(obj) } } @@ -257,7 +257,7 @@ package io.apibuilder.task.v0.models { def jsonWritesApibuilderTaskEmailDataEmailVerificationCreated: play.api.libs.json.Writes[EmailDataEmailVerificationCreated] = { (obj: io.apibuilder.task.v0.models.EmailDataEmailVerificationCreated) => { - jsObjectEmailDataEmailVerificationCreated(obj) + io.apibuilder.task.v0.models.json.jsObjectEmailDataEmailVerificationCreated(obj) } } @@ -273,7 +273,7 @@ package io.apibuilder.task.v0.models { def jsonWritesApibuilderTaskEmailDataMembershipCreated: play.api.libs.json.Writes[EmailDataMembershipCreated] = { (obj: io.apibuilder.task.v0.models.EmailDataMembershipCreated) => { - jsObjectEmailDataMembershipCreated(obj) + io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipCreated(obj) } } @@ -295,7 +295,7 @@ package io.apibuilder.task.v0.models { def jsonWritesApibuilderTaskEmailDataMembershipRequestAccepted: play.api.libs.json.Writes[EmailDataMembershipRequestAccepted] = { (obj: io.apibuilder.task.v0.models.EmailDataMembershipRequestAccepted) => { - jsObjectEmailDataMembershipRequestAccepted(obj) + io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipRequestAccepted(obj) } } @@ -311,7 +311,7 @@ package io.apibuilder.task.v0.models { def jsonWritesApibuilderTaskEmailDataMembershipRequestCreated: play.api.libs.json.Writes[EmailDataMembershipRequestCreated] = { (obj: io.apibuilder.task.v0.models.EmailDataMembershipRequestCreated) => { - jsObjectEmailDataMembershipRequestCreated(obj) + io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipRequestCreated(obj) } } @@ -331,7 +331,7 @@ package io.apibuilder.task.v0.models { def jsonWritesApibuilderTaskEmailDataMembershipRequestDeclined: play.api.libs.json.Writes[EmailDataMembershipRequestDeclined] = { (obj: io.apibuilder.task.v0.models.EmailDataMembershipRequestDeclined) => { - jsObjectEmailDataMembershipRequestDeclined(obj) + io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipRequestDeclined(obj) } } @@ -347,20 +347,20 @@ package io.apibuilder.task.v0.models { def jsonWritesApibuilderTaskEmailDataPasswordResetRequestCreated: play.api.libs.json.Writes[EmailDataPasswordResetRequestCreated] = { (obj: io.apibuilder.task.v0.models.EmailDataPasswordResetRequestCreated) => { - jsObjectEmailDataPasswordResetRequestCreated(obj) + io.apibuilder.task.v0.models.json.jsObjectEmailDataPasswordResetRequestCreated(obj) } } implicit def jsonReadsApibuilderTaskEmailData[T <: io.apibuilder.task.v0.models.EmailData]: play.api.libs.json.Reads[T] = (js: play.api.libs.json.JsValue) => { def readDiscriminator(discriminator: String) = { discriminator match { - case "email_data_application_created" => jsonReadsApibuilderTaskEmailDataApplicationCreated.reads(js) - case "email_data_email_verification_created" => jsonReadsApibuilderTaskEmailDataEmailVerificationCreated.reads(js) - case "email_data_membership_created" => jsonReadsApibuilderTaskEmailDataMembershipCreated.reads(js) - case "email_data_membership_request_created" => jsonReadsApibuilderTaskEmailDataMembershipRequestCreated.reads(js) - case "email_data_membership_request_accepted" => jsonReadsApibuilderTaskEmailDataMembershipRequestAccepted.reads(js) - case "email_data_membership_request_declined" => jsonReadsApibuilderTaskEmailDataMembershipRequestDeclined.reads(js) - case "email_data_password_reset_request_created" => jsonReadsApibuilderTaskEmailDataPasswordResetRequestCreated.reads(js) + case "email_data_application_created" => io.apibuilder.task.v0.models.json.jsonReadsApibuilderTaskEmailDataApplicationCreated.reads(js) + case "email_data_email_verification_created" => io.apibuilder.task.v0.models.json.jsonReadsApibuilderTaskEmailDataEmailVerificationCreated.reads(js) + case "email_data_membership_created" => io.apibuilder.task.v0.models.json.jsonReadsApibuilderTaskEmailDataMembershipCreated.reads(js) + case "email_data_membership_request_created" => io.apibuilder.task.v0.models.json.jsonReadsApibuilderTaskEmailDataMembershipRequestCreated.reads(js) + case "email_data_membership_request_accepted" => io.apibuilder.task.v0.models.json.jsonReadsApibuilderTaskEmailDataMembershipRequestAccepted.reads(js) + case "email_data_membership_request_declined" => io.apibuilder.task.v0.models.json.jsonReadsApibuilderTaskEmailDataMembershipRequestDeclined.reads(js) + case "email_data_password_reset_request_created" => io.apibuilder.task.v0.models.json.jsonReadsApibuilderTaskEmailDataPasswordResetRequestCreated.reads(js) case other => play.api.libs.json.JsSuccess(io.apibuilder.task.v0.models.EmailDataUndefinedType(other)) } } @@ -385,13 +385,13 @@ package io.apibuilder.task.v0.models { def jsObjectEmailData(obj: io.apibuilder.task.v0.models.EmailData): play.api.libs.json.JsObject = { obj match { - case x: io.apibuilder.task.v0.models.EmailDataApplicationCreated => jsObjectEmailDataApplicationCreated(x) - case x: io.apibuilder.task.v0.models.EmailDataEmailVerificationCreated => jsObjectEmailDataEmailVerificationCreated(x) - case x: io.apibuilder.task.v0.models.EmailDataMembershipCreated => jsObjectEmailDataMembershipCreated(x) - case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestCreated => jsObjectEmailDataMembershipRequestCreated(x) - case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestAccepted => jsObjectEmailDataMembershipRequestAccepted(x) - case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestDeclined => jsObjectEmailDataMembershipRequestDeclined(x) - case x: io.apibuilder.task.v0.models.EmailDataPasswordResetRequestCreated => jsObjectEmailDataPasswordResetRequestCreated(x) + case x: io.apibuilder.task.v0.models.EmailDataApplicationCreated => io.apibuilder.task.v0.models.json.jsObjectEmailDataApplicationCreated(x) + case x: io.apibuilder.task.v0.models.EmailDataEmailVerificationCreated => io.apibuilder.task.v0.models.json.jsObjectEmailDataEmailVerificationCreated(x) + case x: io.apibuilder.task.v0.models.EmailDataMembershipCreated => io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipCreated(x) + case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestCreated => io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipRequestCreated(x) + case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestAccepted => io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipRequestAccepted(x) + case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestDeclined => io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipRequestDeclined(x) + case x: io.apibuilder.task.v0.models.EmailDataPasswordResetRequestCreated => io.apibuilder.task.v0.models.json.jsObjectEmailDataPasswordResetRequestCreated(x) case other => { sys.error(s"The type[${other.getClass.getName}] has no JSON writer") } @@ -400,7 +400,7 @@ package io.apibuilder.task.v0.models { implicit def jsonWritesApibuilderTaskEmailData[T <: io.apibuilder.task.v0.models.EmailData]: play.api.libs.json.Writes[T] = { (obj: io.apibuilder.task.v0.models.EmailData) => { - jsObjectEmailData(obj) + io.apibuilder.task.v0.models.json.jsObjectEmailData(obj) } } } From 26352f5965d0be9df334c60acb4b2aa4874c9824 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Wed, 3 Jul 2024 11:03:01 -0400 Subject: [PATCH 15/95] wip --- .../ApicollectiveApibuilderSpecV0Client.scala | 115 +++++++++--------- 1 file changed, 58 insertions(+), 57 deletions(-) diff --git a/generated/app/ApicollectiveApibuilderSpecV0Client.scala b/generated/app/ApicollectiveApibuilderSpecV0Client.scala index b981ba554..fa540e645 100644 --- a/generated/app/ApicollectiveApibuilderSpecV0Client.scala +++ b/generated/app/ApicollectiveApibuilderSpecV0Client.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.48 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/play_2_9_scala_3_client + * Service version: 0.16.50 + * User agent: apibuilder localhost 9000/apicollective/apibuilder-spec/latest/play_2_9_scala_3_client */ package io.apibuilder.spec.v0.models { @@ -514,7 +514,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecMethod: play.api.libs.json.Writes[Method] = { (obj: io.apibuilder.spec.v0.models.Method) => { - jsonWritesApibuilderSpecMethod(obj) + io.apibuilder.spec.v0.models.json.jsonWritesApibuilderSpecMethod(obj) } } @@ -546,7 +546,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecParameterLocation: play.api.libs.json.Writes[ParameterLocation] = { (obj: io.apibuilder.spec.v0.models.ParameterLocation) => { - jsonWritesApibuilderSpecParameterLocation(obj) + io.apibuilder.spec.v0.models.json.jsonWritesApibuilderSpecParameterLocation(obj) } } @@ -578,7 +578,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecResponseCodeOption: play.api.libs.json.Writes[ResponseCodeOption] = { (obj: io.apibuilder.spec.v0.models.ResponseCodeOption) => { - jsonWritesApibuilderSpecResponseCodeOption(obj) + io.apibuilder.spec.v0.models.json.jsonWritesApibuilderSpecResponseCodeOption(obj) } } @@ -599,13 +599,13 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderSpecAnnotation: play.api.libs.json.Writes[Annotation] = { (obj: io.apibuilder.spec.v0.models.Annotation) => { - jsObjectAnnotation(obj) + io.apibuilder.spec.v0.models.json.jsObjectAnnotation(obj) } } @@ -621,7 +621,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecApidoc: play.api.libs.json.Writes[Apidoc] = { (obj: io.apibuilder.spec.v0.models.Apidoc) => { - jsObjectApidoc(obj) + io.apibuilder.spec.v0.models.json.jsObjectApidoc(obj) } } @@ -637,7 +637,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecApplication: play.api.libs.json.Writes[Application] = { (obj: io.apibuilder.spec.v0.models.Application) => { - jsObjectApplication(obj) + io.apibuilder.spec.v0.models.json.jsObjectApplication(obj) } } @@ -660,13 +660,13 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderSpecAttribute: play.api.libs.json.Writes[Attribute] = { (obj: io.apibuilder.spec.v0.models.Attribute) => { - jsObjectAttribute(obj) + io.apibuilder.spec.v0.models.json.jsObjectAttribute(obj) } } @@ -689,13 +689,13 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderSpecBody: play.api.libs.json.Writes[Body] = { (obj: io.apibuilder.spec.v0.models.Body) => { - jsObjectBody(obj) + io.apibuilder.spec.v0.models.json.jsObjectBody(obj) } } @@ -724,7 +724,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecContact: play.api.libs.json.Writes[Contact] = { (obj: io.apibuilder.spec.v0.models.Contact) => { - jsObjectContact(obj) + io.apibuilder.spec.v0.models.json.jsObjectContact(obj) } } @@ -741,7 +741,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecDeprecation: play.api.libs.json.Writes[Deprecation] = { (obj: io.apibuilder.spec.v0.models.Deprecation) => { - jsObjectDeprecation(obj) + io.apibuilder.spec.v0.models.json.jsObjectDeprecation(obj) } } @@ -768,13 +768,13 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderSpecEnum: play.api.libs.json.Writes[Enum] = { (obj: io.apibuilder.spec.v0.models.Enum) => { - jsObjectEnum(obj) + io.apibuilder.spec.v0.models.json.jsObjectEnum(obj) } } @@ -798,7 +798,7 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) ++ (obj.value match { case None => play.api.libs.json.Json.obj() @@ -808,7 +808,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecEnumValue: play.api.libs.json.Writes[EnumValue] = { (obj: io.apibuilder.spec.v0.models.EnumValue) => { - jsObjectEnumValue(obj) + io.apibuilder.spec.v0.models.json.jsObjectEnumValue(obj) } } @@ -841,7 +841,7 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) ++ (obj.default match { case None => play.api.libs.json.Json.obj() @@ -863,7 +863,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecField: play.api.libs.json.Writes[Field] = { (obj: io.apibuilder.spec.v0.models.Field) => { - jsObjectField(obj) + io.apibuilder.spec.v0.models.json.jsObjectField(obj) } } @@ -891,7 +891,7 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) ++ (obj.default match { case None => play.api.libs.json.Json.obj() @@ -901,7 +901,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecHeader: play.api.libs.json.Writes[Header] = { (obj: io.apibuilder.spec.v0.models.Header) => { - jsObjectHeader(obj) + io.apibuilder.spec.v0.models.json.jsObjectHeader(obj) } } @@ -924,8 +924,8 @@ package io.apibuilder.spec.v0.models { play.api.libs.json.Json.obj( "uri" -> play.api.libs.json.JsString(obj.uri), "namespace" -> play.api.libs.json.JsString(obj.namespace), - "organization" -> jsObjectOrganization(obj.organization), - "application" -> jsObjectApplication(obj.application), + "organization" -> io.apibuilder.spec.v0.models.json.jsObjectOrganization(obj.organization), + "application" -> io.apibuilder.spec.v0.models.json.jsObjectApplication(obj.application), "version" -> play.api.libs.json.JsString(obj.version), "enums" -> play.api.libs.json.Json.toJson(obj.enums), "interfaces" -> play.api.libs.json.Json.toJson(obj.interfaces), @@ -937,7 +937,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecImport: play.api.libs.json.Writes[Import] = { (obj: io.apibuilder.spec.v0.models.Import) => { - jsObjectImport(obj) + io.apibuilder.spec.v0.models.json.jsObjectImport(obj) } } @@ -951,17 +951,17 @@ package io.apibuilder.spec.v0.models { def jsObjectInfo(obj: io.apibuilder.spec.v0.models.Info): play.api.libs.json.JsObject = { (obj.license match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("license" -> jsObjectLicense(x)) + case Some(x) => play.api.libs.json.Json.obj("license" -> io.apibuilder.spec.v0.models.json.jsObjectLicense(x)) }) ++ (obj.contact match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("contact" -> jsObjectContact(x)) + case Some(x) => play.api.libs.json.Json.obj("contact" -> io.apibuilder.spec.v0.models.json.jsObjectContact(x)) }) } implicit def jsonWritesApibuilderSpecInfo: play.api.libs.json.Writes[Info] = { (obj: io.apibuilder.spec.v0.models.Info) => { - jsObjectInfo(obj) + io.apibuilder.spec.v0.models.json.jsObjectInfo(obj) } } @@ -988,13 +988,13 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderSpecInterface: play.api.libs.json.Writes[Interface] = { (obj: io.apibuilder.spec.v0.models.Interface) => { - jsObjectInterface(obj) + io.apibuilder.spec.v0.models.json.jsObjectInterface(obj) } } @@ -1016,7 +1016,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecLicense: play.api.libs.json.Writes[License] = { (obj: io.apibuilder.spec.v0.models.License) => { - jsObjectLicense(obj) + io.apibuilder.spec.v0.models.json.jsObjectLicense(obj) } } @@ -1045,13 +1045,13 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderSpecModel: play.api.libs.json.Writes[Model] = { (obj: io.apibuilder.spec.v0.models.Model) => { - jsObjectModel(obj) + io.apibuilder.spec.v0.models.json.jsObjectModel(obj) } } @@ -1081,17 +1081,17 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) ++ (obj.body match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("body" -> jsObjectBody(x)) + case Some(x) => play.api.libs.json.Json.obj("body" -> io.apibuilder.spec.v0.models.json.jsObjectBody(x)) }) } implicit def jsonWritesApibuilderSpecOperation: play.api.libs.json.Writes[Operation] = { (obj: io.apibuilder.spec.v0.models.Operation) => { - jsObjectOperation(obj) + io.apibuilder.spec.v0.models.json.jsObjectOperation(obj) } } @@ -1107,7 +1107,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecOrganization: play.api.libs.json.Writes[Organization] = { (obj: io.apibuilder.spec.v0.models.Organization) => { - jsObjectOrganization(obj) + io.apibuilder.spec.v0.models.json.jsObjectOrganization(obj) } } @@ -1139,7 +1139,7 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) ++ (obj.default match { case None => play.api.libs.json.Json.obj() @@ -1165,7 +1165,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecParameter: play.api.libs.json.Writes[Parameter] = { (obj: io.apibuilder.spec.v0.models.Parameter) => { - jsObjectParameter(obj) + io.apibuilder.spec.v0.models.json.jsObjectParameter(obj) } } @@ -1197,13 +1197,13 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderSpecResource: play.api.libs.json.Writes[Resource] = { (obj: io.apibuilder.spec.v0.models.Resource) => { - jsObjectResource(obj) + io.apibuilder.spec.v0.models.json.jsObjectResource(obj) } } @@ -1220,7 +1220,7 @@ package io.apibuilder.spec.v0.models { def jsObjectResponse(obj: io.apibuilder.spec.v0.models.Response): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( - "code" -> jsObjectResponseCode(obj.code), + "code" -> io.apibuilder.spec.v0.models.json.jsObjectResponseCode(obj.code), "type" -> play.api.libs.json.JsString(obj.`type`) ) ++ (obj.headers match { case None => play.api.libs.json.Json.obj() @@ -1232,7 +1232,7 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) ++ (obj.attributes match { case None => play.api.libs.json.Json.obj() @@ -1242,7 +1242,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecResponse: play.api.libs.json.Writes[Response] = { (obj: io.apibuilder.spec.v0.models.Response) => { - jsObjectResponse(obj) + io.apibuilder.spec.v0.models.json.jsObjectResponse(obj) } } @@ -1272,11 +1272,11 @@ package io.apibuilder.spec.v0.models { def jsObjectService(obj: io.apibuilder.spec.v0.models.Service): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "name" -> play.api.libs.json.JsString(obj.name), - "organization" -> jsObjectOrganization(obj.organization), - "application" -> jsObjectApplication(obj.application), + "organization" -> io.apibuilder.spec.v0.models.json.jsObjectOrganization(obj.organization), + "application" -> io.apibuilder.spec.v0.models.json.jsObjectApplication(obj.application), "namespace" -> play.api.libs.json.JsString(obj.namespace), "version" -> play.api.libs.json.JsString(obj.version), - "info" -> jsObjectInfo(obj.info), + "info" -> io.apibuilder.spec.v0.models.json.jsObjectInfo(obj.info), "headers" -> play.api.libs.json.Json.toJson(obj.headers), "imports" -> play.api.libs.json.Json.toJson(obj.imports), "enums" -> play.api.libs.json.Json.toJson(obj.enums), @@ -1288,7 +1288,7 @@ package io.apibuilder.spec.v0.models { "annotations" -> play.api.libs.json.Json.toJson(obj.annotations) ) ++ (obj.apidoc match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("apidoc" -> jsObjectApidoc(x)) + case Some(x) => play.api.libs.json.Json.obj("apidoc" -> io.apibuilder.spec.v0.models.json.jsObjectApidoc(x)) }) ++ (obj.baseUrl match { case None => play.api.libs.json.Json.obj() @@ -1302,7 +1302,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecService: play.api.libs.json.Writes[Service] = { (obj: io.apibuilder.spec.v0.models.Service) => { - jsObjectService(obj) + io.apibuilder.spec.v0.models.json.jsObjectService(obj) } } @@ -1336,13 +1336,13 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) } implicit def jsonWritesApibuilderSpecUnion: play.api.libs.json.Writes[Union] = { (obj: io.apibuilder.spec.v0.models.Union) => { - jsObjectUnion(obj) + io.apibuilder.spec.v0.models.json.jsObjectUnion(obj) } } @@ -1367,7 +1367,7 @@ package io.apibuilder.spec.v0.models { }) ++ (obj.deprecation match { case None => play.api.libs.json.Json.obj() - case Some(x) => play.api.libs.json.Json.obj("deprecation" -> jsObjectDeprecation(x)) + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) }) ++ (obj.default match { case None => play.api.libs.json.Json.obj() @@ -1381,7 +1381,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecUnionType: play.api.libs.json.Writes[UnionType] = { (obj: io.apibuilder.spec.v0.models.UnionType) => { - jsObjectUnionType(obj) + io.apibuilder.spec.v0.models.json.jsObjectUnionType(obj) } } @@ -1391,6 +1391,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonReadsApibuilderSpecResponseCode[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[T] = ??? + implicit def jsonReadsApibuilderSpecResponseCodeSeq[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[Seq[T]] = { case a: play.api.libs.json.JsArray => { val all: Seq[play.api.libs.json.JsResult[io.apibuilder.spec.v0.models.ResponseCode]] = a.value.map(jsonReadsApibuilderSpecResponseCode.reads).toSeq @@ -1413,7 +1414,7 @@ package io.apibuilder.spec.v0.models { implicit def jsonWritesApibuilderSpecResponseCode[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Writes[T] = { (obj: io.apibuilder.spec.v0.models.ResponseCode) => { - jsObjectResponseCode(obj) + io.apibuilder.spec.v0.models.json.jsObjectResponseCode(obj) } } } @@ -1555,8 +1556,8 @@ package io.apibuilder.spec.v0 { object Constants { val Namespace = "io.apibuilder.spec.v0" - val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/play_2_9_scala_3_client" - val Version = "0.16.48" + val UserAgent = "apibuilder localhost 9000/apicollective/apibuilder-spec/latest/play_2_9_scala_3_client" + val Version = "0.16.50" val VersionMajor = 0 } From 351d9f766cf72edcc41fb33287b2e78bee46aa14 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Wed, 3 Jul 2024 14:34:08 -0400 Subject: [PATCH 16/95] wip --- .../app/ApicollectiveApibuilderSpecV0Client.scala | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/generated/app/ApicollectiveApibuilderSpecV0Client.scala b/generated/app/ApicollectiveApibuilderSpecV0Client.scala index fa540e645..7e6c305df 100644 --- a/generated/app/ApicollectiveApibuilderSpecV0Client.scala +++ b/generated/app/ApicollectiveApibuilderSpecV0Client.scala @@ -457,6 +457,8 @@ package io.apibuilder.spec.v0.models { package io.apibuilder.spec.v0.models { + import play.api.libs.json.{JsError, JsResult, JsValue} + package object json { import play.api.libs.json.__ import play.api.libs.json.JsString @@ -1389,7 +1391,16 @@ package io.apibuilder.spec.v0.models { (__ \ "value").read[Int].map { x => ResponseCodeInt(value = x) } } - implicit def jsonReadsApibuilderSpecResponseCode[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[T] = ??? + implicit def jsonReadsApibuilderSpecResponseCode[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[T] = new play.api.libs.json.Reads[T] { + def reads(json: JsValue): JsResult[T] = { + val all: Seq[JsResult[T]] = Seq( + jsonReadsApibuilderSpecResponseCodeInt.reads(json).map(_.asInstanceOf[T]) + ) + all.find(_.isSuccess).getOrElse { + all.head + } + } + } implicit def jsonReadsApibuilderSpecResponseCodeSeq[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[Seq[T]] = { @@ -1694,4 +1705,4 @@ package io.apibuilder.spec.v0 { } -} +} \ No newline at end of file From 8d6565940af1f99cc9ee38f82e0211629fcc0593 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Wed, 3 Jul 2024 14:34:46 -0400 Subject: [PATCH 17/95] wip --- generated/app/ApicollectiveApibuilderSpecV0Client.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generated/app/ApicollectiveApibuilderSpecV0Client.scala b/generated/app/ApicollectiveApibuilderSpecV0Client.scala index 7e6c305df..6f467b1a3 100644 --- a/generated/app/ApicollectiveApibuilderSpecV0Client.scala +++ b/generated/app/ApicollectiveApibuilderSpecV0Client.scala @@ -1396,7 +1396,7 @@ package io.apibuilder.spec.v0.models { val all: Seq[JsResult[T]] = Seq( jsonReadsApibuilderSpecResponseCodeInt.reads(json).map(_.asInstanceOf[T]) ) - all.find(_.isSuccess).getOrElse { + all.view.find(_.isSuccess).getOrElse { all.head } } From 888661a4e8d021f7eac3231c7d265fa20eff7b47 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Wed, 3 Jul 2024 14:41:08 -0400 Subject: [PATCH 18/95] wip --- .../ApicollectiveApibuilderSpecV0Client.scala | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/generated/app/ApicollectiveApibuilderSpecV0Client.scala b/generated/app/ApicollectiveApibuilderSpecV0Client.scala index 6f467b1a3..3c6bdb89b 100644 --- a/generated/app/ApicollectiveApibuilderSpecV0Client.scala +++ b/generated/app/ApicollectiveApibuilderSpecV0Client.scala @@ -457,8 +457,6 @@ package io.apibuilder.spec.v0.models { package io.apibuilder.spec.v0.models { - import play.api.libs.json.{JsError, JsResult, JsValue} - package object json { import play.api.libs.json.__ import play.api.libs.json.JsString @@ -1391,16 +1389,17 @@ package io.apibuilder.spec.v0.models { (__ \ "value").read[Int].map { x => ResponseCodeInt(value = x) } } - implicit def jsonReadsApibuilderSpecResponseCode[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[T] = new play.api.libs.json.Reads[T] { - def reads(json: JsValue): JsResult[T] = { - val all: Seq[JsResult[T]] = Seq( - jsonReadsApibuilderSpecResponseCodeInt.reads(json).map(_.asInstanceOf[T]) - ) - all.view.find(_.isSuccess).getOrElse { - all.head + implicit def jsonReadsApibuilderSpecResponseCode[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[T] = (json: play.api.libs.json.JsValue) => { + val all: Seq[play.api.libs.json.JsResult[T]] = Seq( + jsonReadsApibuilderSpecResponseCodeInt.reads(json).map(_.asInstanceOf[T]), + jsonReadsApibuilderSpecResponseCodeOption.reads(json).map(_.asInstanceOf[T]) + + ) + all.view.find(_.isSuccess).getOrElse { + all.head + } } - } - } + implicit def jsonReadsApibuilderSpecResponseCodeSeq[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[Seq[T]] = { From 0e07bb21b3b8a80245adc8bbd6c42f45548a13cf Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Wed, 3 Jul 2024 14:44:24 -0400 Subject: [PATCH 19/95] wip --- generated/app/ApicollectiveApibuilderSpecV0Client.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/generated/app/ApicollectiveApibuilderSpecV0Client.scala b/generated/app/ApicollectiveApibuilderSpecV0Client.scala index 3c6bdb89b..e8b8268f8 100644 --- a/generated/app/ApicollectiveApibuilderSpecV0Client.scala +++ b/generated/app/ApicollectiveApibuilderSpecV0Client.scala @@ -1391,9 +1391,8 @@ package io.apibuilder.spec.v0.models { implicit def jsonReadsApibuilderSpecResponseCode[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[T] = (json: play.api.libs.json.JsValue) => { val all: Seq[play.api.libs.json.JsResult[T]] = Seq( - jsonReadsApibuilderSpecResponseCodeInt.reads(json).map(_.asInstanceOf[T]), - jsonReadsApibuilderSpecResponseCodeOption.reads(json).map(_.asInstanceOf[T]) - + jsonReadsApibuilderSpecResponseCodeInt.reads(json).map(_.asInstanceOf[T]), + jsonReadsApibuilderSpecResponseCodeOption.reads(json).map(_.asInstanceOf[T]) ) all.view.find(_.isSuccess).getOrElse { all.head From 6d8256565f04ebe51a5a63c49dc90739950745a2 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Wed, 3 Jul 2024 14:44:54 -0400 Subject: [PATCH 20/95] wip --- .../ApicollectiveApibuilderSpecV0Client.scala | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/generated/app/ApicollectiveApibuilderSpecV0Client.scala b/generated/app/ApicollectiveApibuilderSpecV0Client.scala index e8b8268f8..932a1cecf 100644 --- a/generated/app/ApicollectiveApibuilderSpecV0Client.scala +++ b/generated/app/ApicollectiveApibuilderSpecV0Client.scala @@ -1390,16 +1390,13 @@ package io.apibuilder.spec.v0.models { } implicit def jsonReadsApibuilderSpecResponseCode[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[T] = (json: play.api.libs.json.JsValue) => { - val all: Seq[play.api.libs.json.JsResult[T]] = Seq( - jsonReadsApibuilderSpecResponseCodeInt.reads(json).map(_.asInstanceOf[T]), - jsonReadsApibuilderSpecResponseCodeOption.reads(json).map(_.asInstanceOf[T]) - ) - all.view.find(_.isSuccess).getOrElse { - all.head - } - } - - + val default = jsonReadsApibuilderSpecResponseCodeInt.reads(json).map(_.asInstanceOf[T]) + val all: Seq[play.api.libs.json.JsResult[T]] = Seq( + default, + jsonReadsApibuilderSpecResponseCodeOption.reads(json).map(_.asInstanceOf[T]) + ) + all.view.find(_.isSuccess).getOrElse(default) + } implicit def jsonReadsApibuilderSpecResponseCodeSeq[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[Seq[T]] = { case a: play.api.libs.json.JsArray => { From 2de4a9656e710482f99becddde84f2bef0d62539 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Wed, 3 Jul 2024 14:48:08 -0400 Subject: [PATCH 21/95] wip --- generated/app/ApicollectiveApibuilderSpecV0Client.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generated/app/ApicollectiveApibuilderSpecV0Client.scala b/generated/app/ApicollectiveApibuilderSpecV0Client.scala index 932a1cecf..804cf4ef7 100644 --- a/generated/app/ApicollectiveApibuilderSpecV0Client.scala +++ b/generated/app/ApicollectiveApibuilderSpecV0Client.scala @@ -1398,6 +1398,8 @@ package io.apibuilder.spec.v0.models { all.view.find(_.isSuccess).getOrElse(default) } + + implicit def jsonReadsApibuilderSpecResponseCodeSeq[T <: io.apibuilder.spec.v0.models.ResponseCode]: play.api.libs.json.Reads[Seq[T]] = { case a: play.api.libs.json.JsArray => { val all: Seq[play.api.libs.json.JsResult[io.apibuilder.spec.v0.models.ResponseCode]] = a.value.map(jsonReadsApibuilderSpecResponseCode.reads).toSeq From a71d3648f0b50c1ec91bbe1c47815409c605a48d Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Thu, 4 Jul 2024 10:27:05 -0400 Subject: [PATCH 22/95] wip --- lib/src/test/scala/helpers/ValidatedTestHelpers.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/test/scala/helpers/ValidatedTestHelpers.scala b/lib/src/test/scala/helpers/ValidatedTestHelpers.scala index 90697e64d..e30d6ebbf 100644 --- a/lib/src/test/scala/helpers/ValidatedTestHelpers.scala +++ b/lib/src/test/scala/helpers/ValidatedTestHelpers.scala @@ -5,10 +5,10 @@ import cats.data.ValidatedNec trait ValidatedTestHelpers { - def expectValid[T](r: ValidatedNec[?, T]): T = { - r match { - case Valid(o) => o - case Invalid(errors) => sys.error(s"Expected valid but was invalid: ${errors.toNonEmptyList}") + def expectValid[S, T](value: ValidatedNec[S, T]): T = { + value match { + case Invalid(e) => sys.error(s"Expected valid but got: ${e.toNonEmptyList.toList.mkString(", ")}") + case Valid(v) => v } } From e566075ddfbedb4000da29885ec3318786905071 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Thu, 4 Jul 2024 10:28:55 -0400 Subject: [PATCH 23/95] wip --- build.sbt | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.sbt b/build.sbt index f5a6004d9..36b15a313 100644 --- a/build.sbt +++ b/build.sbt @@ -24,7 +24,6 @@ lazy val resolversSettings = Seq( val playJsonVersion = "2.10.6" -/* val avroVersion = "1.11.1" lazy val avro = project @@ -61,7 +60,6 @@ lazy val swagger = project "--add-opens=java.base/sun.security.ssl=ALL-UNNAMED" ) ) - */ val circeVersion = "0.14.9" lazy val core = project From ab1374b72e14a7a90063ad1050c5e6f2c7347de2 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Thu, 4 Jul 2024 10:33:51 -0400 Subject: [PATCH 24/95] wip --- build.sbt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index 36b15a313..fec3f1d28 100644 --- a/build.sbt +++ b/build.sbt @@ -35,7 +35,7 @@ lazy val avro = project libraryDependencies ++= Seq( "org.apache.avro" % "avro" % avroVersion, "org.apache.avro" % "avro-compiler" % avroVersion, - "com.typesafe.play" %% "play-json" % playJsonVersion, + ("com.typesafe.play" %% "play-json" % playJsonVersion).cross(CrossVersion.for3Use2_13), "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test ), Test / javaOptions ++= Seq( @@ -52,7 +52,7 @@ lazy val swagger = project scalacOptions ++= allScalacOptions, libraryDependencies ++= Seq( "io.swagger" % "swagger-parser" % "1.0.61", - "com.typesafe.play" %% "play-json" % playJsonVersion, + ("com.typesafe.play" %% "play-json" % playJsonVersion).cross(CrossVersion.for3Use2_13), "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test ), Test / javaOptions ++= Seq( @@ -69,7 +69,7 @@ lazy val core = project .settings(commonSettings*) .settings( libraryDependencies ++= Seq( - "com.typesafe.play" %% "play-json" % playJsonVersion, + ("com.typesafe.play" %% "play-json" % playJsonVersion).cross(CrossVersion.for3Use2_13), "io.circe" %% "circe-core" % circeVersion, "io.circe" %% "circe-generic" % circeVersion, "io.circe" %% "circe-parser" % circeVersion @@ -109,8 +109,8 @@ lazy val api = project "com.google.inject" % "guice" % "5.1.0", "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0", "org.projectlombok" % "lombok" % "1.18.32" % "provided", - "com.typesafe.play" %% "play-json" % playJsonVersion, - "com.typesafe.play" %% "play-json-joda" % playJsonVersion, + ("com.typesafe.play" %% "play-json" % playJsonVersion).cross(CrossVersion.for3Use2_13), + ("com.typesafe.play" %% "play-json-joda" % playJsonVersion).cross(CrossVersion.for3Use2_13), "org.postgresql" % "postgresql" % "42.7.3", "org.mindrot" % "jbcrypt" % "0.4", "com.sendgrid" % "sendgrid-java" % "4.10.2", @@ -145,8 +145,8 @@ lazy val app = project "com.google.inject" % "guice" % "5.1.0", "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0", "org.projectlombok" % "lombok" % "1.18.28" % "provided", - "com.typesafe.play" %% "play-json" % playJsonVersion, - "com.typesafe.play" %% "play-json-joda" % playJsonVersion, + ("com.typesafe.play" %% "play-json" % playJsonVersion).cross(CrossVersion.for3Use2_13), + ("com.typesafe.play" %% "play-json-joda" % playJsonVersion).cross(CrossVersion.for3Use2_13), "org.apache.commons" % "commons-compress" % "1.26.2", "com.github.tototoshi" %% "scala-csv" % "1.4.0", "com.vladsch.flexmark" % "flexmark-all" % "0.64.8", @@ -178,7 +178,7 @@ lazy val commonSettings: Seq[Setting[_]] = Seq( name ~= ("apibuilder-" + _), organization := "io.apibuilder", libraryDependencies ++= Seq( - "com.typesafe.play" %% "play-json-joda" % playJsonVersion, + ("com.typesafe.play" %% "play-json-joda" % playJsonVersion).cross(CrossVersion.for3Use2_13), "org.atteo" % "evo-inflector" % "1.3", "org.typelevel" %% "cats-core" % "2.12.0", //"org.slf4j" % "slf4j-api" % "2.0.13", From 88004106e8e704616364bcf8ee83e97fa71ff62a Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Thu, 4 Jul 2024 10:35:01 -0400 Subject: [PATCH 25/95] wip --- build.sbt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index fec3f1d28..ca891d478 100644 --- a/build.sbt +++ b/build.sbt @@ -180,8 +180,7 @@ lazy val commonSettings: Seq[Setting[_]] = Seq( libraryDependencies ++= Seq( ("com.typesafe.play" %% "play-json-joda" % playJsonVersion).cross(CrossVersion.for3Use2_13), "org.atteo" % "evo-inflector" % "1.3", - "org.typelevel" %% "cats-core" % "2.12.0", - //"org.slf4j" % "slf4j-api" % "2.0.13", + ("org.typelevel" %% "cats-core" % "2.12.0").cross(CrossVersion.for3Use2_13), "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test ), scalacOptions ++= allScalacOptions, From ee4cd33ddc1ff9f847ed321564aa9ea09b0c2656 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Thu, 4 Jul 2024 10:38:46 -0400 Subject: [PATCH 26/95] wip --- build.sbt | 10 +++++----- project/plugins.sbt | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index ca891d478..47fe6a7be 100644 --- a/build.sbt +++ b/build.sbt @@ -11,17 +11,17 @@ lazy val allScalacOptions = Seq( "-Xfatal-warnings" ) -lazy val lib = project - .in(file("lib")) - .settings(commonSettings*) - .settings(resolversSettings) - lazy val resolversSettings = Seq( resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/", resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases", resolvers += "jitpack" at "https://jitpack.io", ) +lazy val lib = project + .in(file("lib")) + .settings(commonSettings*) + .settings(resolversSettings) + val playJsonVersion = "2.10.6" val avroVersion = "1.11.1" diff --git a/project/plugins.sbt b/project/plugins.sbt index 9bab3c9be..2954a8aaf 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -12,3 +12,5 @@ addSbtPlugin("com.typesafe.play" % "sbt-twirl" % "1.6.8") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1") addSbtPlugin("com.github.sbt" % "sbt-javaagent" % "0.1.8") + +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") From afce9006b3c049d2c65c118396696e8bab95755e Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Thu, 4 Jul 2024 10:38:48 -0400 Subject: [PATCH 27/95] wip --- .scalafmt.conf | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .scalafmt.conf diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 000000000..45c747752 --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,9 @@ +version = 3.5.9 +runner.dialect=scala213 +maxColumn = 120 +continuationIndent.callSite = 2 +continuationIndent.defnSite = 2 +continuationIndent.ctorSite = 2 +continuationIndent.extendSite = 2 +align.preset = none +project.excludePaths = [ "glob:**/generated/**" ] From 33f3bb23c892c45fdaaac048846b9bacd02bb924 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Thu, 4 Jul 2024 10:39:44 -0400 Subject: [PATCH 28/95] wip --- build.sbt | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.sbt b/build.sbt index 47fe6a7be..643d73b92 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,3 @@ -import play.sbt.PlayScala._ - name := "apibuilder" organization := "io.apibuilder" From a97dbbcd97620de04c3783e76e3c41aec5898eef Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Thu, 4 Jul 2024 10:45:36 -0400 Subject: [PATCH 29/95] wip --- build.sbt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index 643d73b92..d204a9ced 100644 --- a/build.sbt +++ b/build.sbt @@ -5,8 +5,7 @@ organization := "io.apibuilder" ThisBuild / scalaVersion := "3.4.2" lazy val allScalacOptions = Seq( - "-feature", - "-Xfatal-warnings" + "-feature" ) lazy val resolversSettings = Seq( @@ -33,7 +32,7 @@ lazy val avro = project libraryDependencies ++= Seq( "org.apache.avro" % "avro" % avroVersion, "org.apache.avro" % "avro-compiler" % avroVersion, - ("com.typesafe.play" %% "play-json" % playJsonVersion).cross(CrossVersion.for3Use2_13), + "com.typesafe.play" %% "play-json" % playJsonVersion, "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test ), Test / javaOptions ++= Seq( @@ -108,7 +107,7 @@ lazy val api = project "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0", "org.projectlombok" % "lombok" % "1.18.32" % "provided", ("com.typesafe.play" %% "play-json" % playJsonVersion).cross(CrossVersion.for3Use2_13), - ("com.typesafe.play" %% "play-json-joda" % playJsonVersion).cross(CrossVersion.for3Use2_13), + "com.typesafe.play" %% "play-json-joda" % playJsonVersion, "org.postgresql" % "postgresql" % "42.7.3", "org.mindrot" % "jbcrypt" % "0.4", "com.sendgrid" % "sendgrid-java" % "4.10.2", @@ -144,7 +143,7 @@ lazy val app = project "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0", "org.projectlombok" % "lombok" % "1.18.28" % "provided", ("com.typesafe.play" %% "play-json" % playJsonVersion).cross(CrossVersion.for3Use2_13), - ("com.typesafe.play" %% "play-json-joda" % playJsonVersion).cross(CrossVersion.for3Use2_13), + "com.typesafe.play" %% "play-json-joda" % playJsonVersion, "org.apache.commons" % "commons-compress" % "1.26.2", "com.github.tototoshi" %% "scala-csv" % "1.4.0", "com.vladsch.flexmark" % "flexmark-all" % "0.64.8", @@ -176,8 +175,8 @@ lazy val commonSettings: Seq[Setting[_]] = Seq( name ~= ("apibuilder-" + _), organization := "io.apibuilder", libraryDependencies ++= Seq( - ("com.typesafe.play" %% "play-json-joda" % playJsonVersion).cross(CrossVersion.for3Use2_13), "org.atteo" % "evo-inflector" % "1.3", + "com.typesafe.play" %% "play-json-joda" % playJsonVersion, ("org.typelevel" %% "cats-core" % "2.12.0").cross(CrossVersion.for3Use2_13), "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test ), From e0bdc1aa0ebcb19724dae3f3a09b8666ec4ac4b7 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Thu, 4 Jul 2024 10:48:35 -0400 Subject: [PATCH 30/95] wip --- build.sbt | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/build.sbt b/build.sbt index d204a9ced..d4e086524 100644 --- a/build.sbt +++ b/build.sbt @@ -32,7 +32,6 @@ lazy val avro = project libraryDependencies ++= Seq( "org.apache.avro" % "avro" % avroVersion, "org.apache.avro" % "avro-compiler" % avroVersion, - "com.typesafe.play" %% "play-json" % playJsonVersion, "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test ), Test / javaOptions ++= Seq( @@ -49,7 +48,6 @@ lazy val swagger = project scalacOptions ++= allScalacOptions, libraryDependencies ++= Seq( "io.swagger" % "swagger-parser" % "1.0.61", - ("com.typesafe.play" %% "play-json" % playJsonVersion).cross(CrossVersion.for3Use2_13), "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test ), Test / javaOptions ++= Seq( @@ -66,7 +64,6 @@ lazy val core = project .settings(commonSettings*) .settings( libraryDependencies ++= Seq( - ("com.typesafe.play" %% "play-json" % playJsonVersion).cross(CrossVersion.for3Use2_13), "io.circe" %% "circe-core" % circeVersion, "io.circe" %% "circe-generic" % circeVersion, "io.circe" %% "circe-parser" % circeVersion @@ -80,7 +77,11 @@ lazy val generated = project .settings( scalacOptions ++= Seq("-deprecation:false"), libraryDependencies ++= Seq( - ws + ws, + "joda-time" % "joda-time" % "2.12.7", + "org.playframework.anorm" %% "anorm-postgres" % "2.7.0", + "org.postgresql" % "postgresql" % "42.7.3", + "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test, ) ) @@ -106,8 +107,6 @@ lazy val api = project "com.google.inject" % "guice" % "5.1.0", "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0", "org.projectlombok" % "lombok" % "1.18.32" % "provided", - ("com.typesafe.play" %% "play-json" % playJsonVersion).cross(CrossVersion.for3Use2_13), - "com.typesafe.play" %% "play-json-joda" % playJsonVersion, "org.postgresql" % "postgresql" % "42.7.3", "org.mindrot" % "jbcrypt" % "0.4", "com.sendgrid" % "sendgrid-java" % "4.10.2", @@ -142,8 +141,6 @@ lazy val app = project "com.google.inject" % "guice" % "5.1.0", "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0", "org.projectlombok" % "lombok" % "1.18.28" % "provided", - ("com.typesafe.play" %% "play-json" % playJsonVersion).cross(CrossVersion.for3Use2_13), - "com.typesafe.play" %% "play-json-joda" % playJsonVersion, "org.apache.commons" % "commons-compress" % "1.26.2", "com.github.tototoshi" %% "scala-csv" % "1.4.0", "com.vladsch.flexmark" % "flexmark-all" % "0.64.8", @@ -176,7 +173,6 @@ lazy val commonSettings: Seq[Setting[_]] = Seq( organization := "io.apibuilder", libraryDependencies ++= Seq( "org.atteo" % "evo-inflector" % "1.3", - "com.typesafe.play" %% "play-json-joda" % playJsonVersion, ("org.typelevel" %% "cats-core" % "2.12.0").cross(CrossVersion.for3Use2_13), "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test ), From 1e585cf1a359053e99ff03f4ff15d86cd73520f9 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Thu, 4 Jul 2024 10:57:32 -0400 Subject: [PATCH 31/95] wip --- .apibuilder/config | 1 + ...collectiveApibuilderApiV0Conversions.scala | 5 - .../ApicollectiveApibuilderApiV0Parsers.scala | 5 - ...lectiveApibuilderCommonV0Conversions.scala | 4 +- ...icollectiveApibuilderCommonV0Parsers.scala | 4 +- ...tiveApibuilderGeneratorV0Conversions.scala | 4 +- ...llectiveApibuilderGeneratorV0Parsers.scala | 4 +- ...ollectiveApibuilderSpecV0Conversions.scala | 4 +- ...ApicollectiveApibuilderSpecV0Parsers.scala | 4 +- build.sbt | 31 +- ...icollectiveApibuilderApiJsonV0Models.scala | 7 +- ...llectiveApibuilderCommonV0MockClient.scala | 4 +- ...ctiveApibuilderGeneratorV0MockClient.scala | 4 +- ...collectiveApibuilderSpecV0MockClient.scala | 4 +- ...collectiveApibuilderTaskV0MockClient.scala | 4 +- .../ApicollectiveApibuilderSpecV0Models.scala | 1416 +++++++++++++++++ 16 files changed, 1453 insertions(+), 52 deletions(-) create mode 100644 lib/src/main/scala/generated/ApicollectiveApibuilderSpecV0Models.scala diff --git a/.apibuilder/config b/.apibuilder/config index 37a7be97a..34cfbbb37 100644 --- a/.apibuilder/config +++ b/.apibuilder/config @@ -13,6 +13,7 @@ code: apibuilder-spec: version: latest generators: + play_2_x_standalone_json: lib/src/main/scala/generated play_2_9_scala_3_client: generated/app play_2_8_mock_client: generated/app anorm_2_8_parsers: api/app/generated diff --git a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala index 73685c684..1fd8c1788 100644 --- a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala @@ -1,12 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io -<<<<<<< HEAD - * Service version: 0.16.43 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-api/latest/anorm_2_8_parsers -======= * Service version: 0.16.50 * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/anorm_2_8_parsers ->>>>>>> main */ package io.apibuilder.api.v0.anorm.conversions { diff --git a/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala index 408f36357..ca3d6d7b5 100644 --- a/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala +++ b/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala @@ -1,12 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io -<<<<<<< HEAD - * Service version: 0.16.43 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-api/latest/anorm_2_8_parsers -======= * Service version: 0.16.50 * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/anorm_2_8_parsers ->>>>>>> main */ import anorm._ diff --git a/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala index 40053ac0c..cde824918 100644 --- a/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-common/latest/anorm_2_8_parsers + * Service version: 0.16.50 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-common/latest/anorm_2_8_parsers */ package io.apibuilder.common.v0.anorm.conversions { diff --git a/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala index bae233dd6..a6688b2c0 100644 --- a/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala +++ b/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-common/latest/anorm_2_8_parsers + * Service version: 0.16.50 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-common/latest/anorm_2_8_parsers */ import anorm._ diff --git a/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala index b709545cc..0d3d16d73 100644 --- a/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-generator/latest/anorm_2_8_parsers + * Service version: 0.16.50 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-generator/latest/anorm_2_8_parsers */ package io.apibuilder.generator.v0.anorm.conversions { diff --git a/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala index 04e2e3b34..1e50faf18 100644 --- a/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala +++ b/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-generator/latest/anorm_2_8_parsers + * Service version: 0.16.50 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-generator/latest/anorm_2_8_parsers */ import anorm._ diff --git a/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala index 6133e9860..af192fdb9 100644 --- a/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/anorm_2_8_parsers + * Service version: 0.16.50 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/anorm_2_8_parsers */ package io.apibuilder.spec.v0.anorm.conversions { diff --git a/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala index f286ed5a5..e925ac26b 100644 --- a/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala +++ b/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/anorm_2_8_parsers + * Service version: 0.16.50 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/anorm_2_8_parsers */ import anorm._ diff --git a/build.sbt b/build.sbt index d4e086524..9706923cd 100644 --- a/build.sbt +++ b/build.sbt @@ -1,9 +1,12 @@ name := "apibuilder" - organization := "io.apibuilder" ThisBuild / scalaVersion := "3.4.2" +val playJsonVersion = "2.10.6" + +val avroVersion = "1.11.1" + lazy val allScalacOptions = Seq( "-feature" ) @@ -18,15 +21,17 @@ lazy val lib = project .in(file("lib")) .settings(commonSettings*) .settings(resolversSettings) - -val playJsonVersion = "2.10.6" - -val avroVersion = "1.11.1" + .settings( + libraryDependencies ++= Seq( + "com.typesafe.play" %% "play-json" % playJsonVersion, + "joda-time" % "joda-time" % "2.12.7", + ) + ) lazy val avro = project .in(file("avro")) - .dependsOn(generated, lib % "compile->compile;test->test") - .aggregate(generated, lib) + .dependsOn(lib % "compile->compile;test->test") + .aggregate(lib) .settings( scalacOptions ++= allScalacOptions, libraryDependencies ++= Seq( @@ -42,8 +47,8 @@ lazy val avro = project lazy val swagger = project .in(file("swagger")) - .dependsOn(generated, lib % "compile->compile;test->test") - .aggregate(generated, lib) + .dependsOn(lib % "compile->compile;test->test") + .aggregate(lib) .settings( scalacOptions ++= allScalacOptions, libraryDependencies ++= Seq( @@ -59,16 +64,10 @@ lazy val swagger = project val circeVersion = "0.14.9" lazy val core = project .in(file("core")) + .enablePlugins(PlayScala) .dependsOn(generated, lib) .aggregate(generated, lib) .settings(commonSettings*) - .settings( - libraryDependencies ++= Seq( - "io.circe" %% "circe-core" % circeVersion, - "io.circe" %% "circe-generic" % circeVersion, - "io.circe" %% "circe-parser" % circeVersion - ) - ) lazy val generated = project .in(file("generated")) diff --git a/core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala b/core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala index 4b14531f5..82263dd9b 100644 --- a/core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala +++ b/core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala @@ -1,12 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io -<<<<<<< HEAD * Service version: 0.16.50 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-api-json/latest/play_2_x_scala_3_json -======= - * Service version: 0.16.48 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api-json/latest/play_2_x_json ->>>>>>> main + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api-json/latest/play_2_x_scala_3_json */ package io.apibuilder.api.json.v0.models { diff --git a/generated/app/ApicollectiveApibuilderCommonV0MockClient.scala b/generated/app/ApicollectiveApibuilderCommonV0MockClient.scala index 537b52348..377774515 100644 --- a/generated/app/ApicollectiveApibuilderCommonV0MockClient.scala +++ b/generated/app/ApicollectiveApibuilderCommonV0MockClient.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-common/latest/play_2_8_mock_client + * Service version: 0.16.50 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-common/latest/play_2_8_mock_client */ package io.apibuilder.common.v0.mock { diff --git a/generated/app/ApicollectiveApibuilderGeneratorV0MockClient.scala b/generated/app/ApicollectiveApibuilderGeneratorV0MockClient.scala index 6d8a37e64..08841f71d 100644 --- a/generated/app/ApicollectiveApibuilderGeneratorV0MockClient.scala +++ b/generated/app/ApicollectiveApibuilderGeneratorV0MockClient.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-generator/latest/play_2_8_mock_client + * Service version: 0.16.50 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-generator/latest/play_2_8_mock_client */ package io.apibuilder.generator.v0.mock { diff --git a/generated/app/ApicollectiveApibuilderSpecV0MockClient.scala b/generated/app/ApicollectiveApibuilderSpecV0MockClient.scala index 489ef22c4..464e0983e 100644 --- a/generated/app/ApicollectiveApibuilderSpecV0MockClient.scala +++ b/generated/app/ApicollectiveApibuilderSpecV0MockClient.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/play_2_8_mock_client + * Service version: 0.16.50 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/play_2_8_mock_client */ package io.apibuilder.spec.v0.mock { diff --git a/generated/app/ApicollectiveApibuilderTaskV0MockClient.scala b/generated/app/ApicollectiveApibuilderTaskV0MockClient.scala index b47ce8414..c8af7adc1 100644 --- a/generated/app/ApicollectiveApibuilderTaskV0MockClient.scala +++ b/generated/app/ApicollectiveApibuilderTaskV0MockClient.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.43 - * apibuilder app.apibuilder.io/apicollective/apibuilder-task/latest/play_2_8_mock_client + * Service version: 0.16.50 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-task/latest/play_2_8_mock_client */ package io.apibuilder.task.v0.mock { diff --git a/lib/src/main/scala/generated/ApicollectiveApibuilderSpecV0Models.scala b/lib/src/main/scala/generated/ApicollectiveApibuilderSpecV0Models.scala new file mode 100644 index 000000000..36564f7fb --- /dev/null +++ b/lib/src/main/scala/generated/ApicollectiveApibuilderSpecV0Models.scala @@ -0,0 +1,1416 @@ +/** + * Generated by API Builder - https://www.apibuilder.io + * Service version: 0.16.50 + * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/play_2_x_standalone_json + */ +package io.apibuilder.spec.v0.models { + + sealed trait ResponseCode extends _root_.scala.Product with _root_.scala.Serializable + /** + * Used to indicate an API concern for a field that is specific to the field's + * usage but not necessarily its data type. For example, you might use annotations + * to mark that certain fields contain PII or PCI data and thus should not be + * stored once processing is complete. Annotations communicate meaning to consumers + * of an API and may also be used within an implementation or tooling; for example, + * using static analysis tools to detect logging of sensitive data. + */ + + final case class Annotation( + name: String, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None + ) + + final case class Apidoc( + version: String + ) + + /** + * @param key Unique key identifying this application + */ + + final case class Application( + key: String + ) + + /** + * Represents an additional attribute that is attached to one of the objects in + * apibuilder. The main use case is to capture additional metadata that doesn't + * necessarily define the API but aids in code generation. Examples would be hints + * for certain code generators about classes to extend, interfaces to implement, + * annotations to add, names to assign to certain methods, etc. The specific + * attributes will be applicable only in the context of the specific code + * generators usings them. + */ + + final case class Attribute( + name: String, + value: _root_.play.api.libs.json.JsObject, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None + ) + + final case class Body( + `type`: String, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None, + attributes: Seq[io.apibuilder.spec.v0.models.Attribute] = Nil + ) + + /** + * Describes the primary contact for this service + */ + + final case class Contact( + name: _root_.scala.Option[String] = None, + url: _root_.scala.Option[String] = None, + email: _root_.scala.Option[String] = None + ) + + /** + * Indicates that this particular element is considered deprecated in the API. See + * the description for details + */ + + final case class Deprecation( + description: _root_.scala.Option[String] = None + ) + + final case class Enum( + name: String, + plural: String, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None, + values: Seq[io.apibuilder.spec.v0.models.EnumValue], + attributes: Seq[io.apibuilder.spec.v0.models.Attribute] = Nil + ) + + /** + * @param value The actual string representation of this value. If not specified, defaults to + * 'name' + */ + + final case class EnumValue( + name: String, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None, + attributes: Seq[io.apibuilder.spec.v0.models.Attribute] = Nil, + value: _root_.scala.Option[String] = None + ) + + final case class Field( + name: String, + `type`: String, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None, + default: _root_.scala.Option[String] = None, + required: Boolean, + minimum: _root_.scala.Option[Long] = None, + maximum: _root_.scala.Option[Long] = None, + example: _root_.scala.Option[String] = None, + attributes: Seq[io.apibuilder.spec.v0.models.Attribute] = Nil, + annotations: Seq[String] = Nil + ) + + final case class Header( + name: String, + `type`: String, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None, + required: Boolean, + default: _root_.scala.Option[String] = None, + attributes: Seq[io.apibuilder.spec.v0.models.Attribute] = Nil + ) + + /** + * An import is used to declare a dependency on another application. This allows + * you to reference the models and or enums from that application in your own app. + * + * @param uri Full URI to the service.json file of the service we are importing + * @param namespace the fully qualified namespace that we have imported + * @param version The version of the service that we are importing + * @param enums Enums made available by this import + * @param interfaces Interfaces made available by this import + * @param unions Unions made available by this import + * @param models Models made available by this import + * @param annotations Annotations made available by this import + */ + + final case class Import( + uri: String, + namespace: String, + organization: io.apibuilder.spec.v0.models.Organization, + application: io.apibuilder.spec.v0.models.Application, + version: String, + enums: Seq[String] = Nil, + interfaces: Seq[String] = Nil, + unions: Seq[String] = Nil, + models: Seq[String] = Nil, + annotations: Seq[io.apibuilder.spec.v0.models.Annotation] = Nil + ) + + /** + * General metadata about this service + */ + + final case class Info( + license: _root_.scala.Option[io.apibuilder.spec.v0.models.License] = None, + contact: _root_.scala.Option[io.apibuilder.spec.v0.models.Contact] = None + ) + + final case class Interface( + name: String, + plural: String, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None, + fields: Seq[io.apibuilder.spec.v0.models.Field], + attributes: Seq[io.apibuilder.spec.v0.models.Attribute] = Nil + ) + + /** + * Describes the software license contact for this service + */ + + final case class License( + name: String, + url: _root_.scala.Option[String] = None + ) + + final case class Model( + name: String, + plural: String, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None, + fields: Seq[io.apibuilder.spec.v0.models.Field], + attributes: Seq[io.apibuilder.spec.v0.models.Attribute] = Nil, + interfaces: Seq[String] = Nil + ) + + /** + * @param path The full path to this operation, relative to the service's base url. + */ + + final case class Operation( + method: io.apibuilder.spec.v0.models.Method, + path: String, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None, + body: _root_.scala.Option[io.apibuilder.spec.v0.models.Body] = None, + parameters: Seq[io.apibuilder.spec.v0.models.Parameter] = Nil, + responses: Seq[io.apibuilder.spec.v0.models.Response] = Nil, + attributes: Seq[io.apibuilder.spec.v0.models.Attribute] = Nil + ) + + /** + * @param key Unique key identifying the organization that owns this service + */ + + final case class Organization( + key: String + ) + + final case class Parameter( + name: String, + `type`: String, + location: io.apibuilder.spec.v0.models.ParameterLocation, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None, + required: Boolean, + default: _root_.scala.Option[String] = None, + minimum: _root_.scala.Option[Long] = None, + maximum: _root_.scala.Option[Long] = None, + example: _root_.scala.Option[String] = None, + attributes: _root_.scala.Option[Seq[io.apibuilder.spec.v0.models.Attribute]] = None + ) + + /** + * @param `type` The type of this resource will map to a defined model, enum, or union type + * @param path The path to this specific resource. This was added in 2016 to help us + * differentiate between the resource path and the operation path which can be + * helpful when, for example, generating method names for operations. This field is + * optional as some of our input formats (e.g. swagger) do not explicitly + * differentiate resoure paths. + */ + + final case class Resource( + `type`: String, + plural: String, + path: _root_.scala.Option[String] = None, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None, + operations: Seq[io.apibuilder.spec.v0.models.Operation], + attributes: Seq[io.apibuilder.spec.v0.models.Attribute] = Nil + ) + + final case class Response( + code: io.apibuilder.spec.v0.models.ResponseCode, + `type`: String, + headers: _root_.scala.Option[Seq[io.apibuilder.spec.v0.models.Header]] = None, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None, + attributes: _root_.scala.Option[Seq[io.apibuilder.spec.v0.models.Attribute]] = None + ) + + /** + * @param apidoc Documents that this is an apibuilder document, noting the specific version used. + * Internally the version is then used for backwards compatibility when applicable + * as new features are added to apibuilder. Note naming refers to the original name + * of this project, 'apidoc', and is left here to avoid a breaking change for + * preexisting services. + * @param namespace Fully qualified namespace for this service + */ + + final case class Service( + @deprecated("This field is no longer used in API Builder and may be removed in the future.") apidoc: _root_.scala.Option[io.apibuilder.spec.v0.models.Apidoc] = None, + name: String, + organization: io.apibuilder.spec.v0.models.Organization, + application: io.apibuilder.spec.v0.models.Application, + namespace: String, + version: String, + baseUrl: _root_.scala.Option[String] = None, + description: _root_.scala.Option[String] = None, + info: io.apibuilder.spec.v0.models.Info, + headers: Seq[io.apibuilder.spec.v0.models.Header] = Nil, + imports: Seq[io.apibuilder.spec.v0.models.Import] = Nil, + enums: Seq[io.apibuilder.spec.v0.models.Enum] = Nil, + interfaces: Seq[io.apibuilder.spec.v0.models.Interface] = Nil, + unions: Seq[io.apibuilder.spec.v0.models.Union] = Nil, + models: Seq[io.apibuilder.spec.v0.models.Model] = Nil, + resources: Seq[io.apibuilder.spec.v0.models.Resource] = Nil, + attributes: Seq[io.apibuilder.spec.v0.models.Attribute] = Nil, + annotations: Seq[io.apibuilder.spec.v0.models.Annotation] = Nil + ) + + /** + * @param discriminator If a type discriminator is provided, serialization of these union types will + * always contain a field named with the value of the discriminator that will + * contain the name of the type. This provides a simpler (for many use cases) JSON + * serialization/deserialization mechanism. When specified, apibuilder itself will + * verify that none of the types in the union type itself contain a field with the + * same name as the discriminator + * @param types The names of the types that make up this union type + */ + + final case class Union( + name: String, + plural: String, + discriminator: _root_.scala.Option[String] = None, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None, + types: Seq[io.apibuilder.spec.v0.models.UnionType], + attributes: Seq[io.apibuilder.spec.v0.models.Attribute] = Nil, + interfaces: Seq[String] = Nil + ) + + /** + * Metadata about one of the types that is part of a union type + * + * @param `type` The name of a type (a primitive, model name, or enum name) that makes up this + * union type + * @param default If true, indicates that this type should be used as the default when + * deserializing union types. This field is only used by union types that require a + * discriminator and sets the default value for that discriminator during + * deserialization. + * @param discriminatorValue The discriminator value defines the string to use in the discriminator field to + * identify this type. If not specified, the discriminator value will default to + * the name of the type itself. + */ + + final case class UnionType( + `type`: String, + description: _root_.scala.Option[String] = None, + deprecation: _root_.scala.Option[io.apibuilder.spec.v0.models.Deprecation] = None, + attributes: Seq[io.apibuilder.spec.v0.models.Attribute] = Nil, + default: _root_.scala.Option[Boolean] = None, + discriminatorValue: _root_.scala.Option[String] = None + ) + + /** + * Provides future compatibility in clients - in the future, when a type is added + * to the union ResponseCode, it will need to be handled in the client code. This + * implementation will deserialize these future types as an instance of this class. + * + * @param description Information about the type that we received that is undefined in this version of + * the client. + */ + + final case class ResponseCodeUndefinedType( + description: String + ) extends ResponseCode + + /** + * Wrapper class to support the union types containing the datatype[integer] + */ + + final case class ResponseCodeInt( + value: Int + ) extends ResponseCode + + sealed trait Method extends _root_.scala.Product with _root_.scala.Serializable + + object Method { + + case object Get extends Method { override def toString = "GET" } + case object Post extends Method { override def toString = "POST" } + case object Put extends Method { override def toString = "PUT" } + case object Patch extends Method { override def toString = "PATCH" } + case object Delete extends Method { override def toString = "DELETE" } + case object Head extends Method { override def toString = "HEAD" } + case object Connect extends Method { override def toString = "CONNECT" } + case object Options extends Method { override def toString = "OPTIONS" } + case object Trace extends Method { override def toString = "TRACE" } + /** + * UNDEFINED captures values that are sent either in error or + * that were added by the server after this library was + * generated. We want to make it easy and obvious for users of + * this library to handle this case gracefully. + * + * We use all CAPS for the variable name to avoid collisions + * with the camel cased values above. + */ + final case class UNDEFINED(override val toString: String) extends Method + + /** + * all returns a list of all the valid, known values. We use + * lower case to avoid collisions with the camel cased values + * above. + */ + val all: scala.List[Method] = scala.List(Get, Post, Put, Patch, Delete, Head, Connect, Options, Trace) + + private + val byName: Map[String, Method] = all.map(x => x.toString.toLowerCase -> x).toMap + + def apply(value: String): Method = fromString(value).getOrElse(UNDEFINED(value)) + + def fromString(value: String): _root_.scala.Option[Method] = byName.get(value.toLowerCase) + + } + + sealed trait ParameterLocation extends _root_.scala.Product with _root_.scala.Serializable + + object ParameterLocation { + + case object Path extends ParameterLocation { override def toString = "Path" } + case object Query extends ParameterLocation { override def toString = "Query" } + case object Form extends ParameterLocation { override def toString = "Form" } + case object Header extends ParameterLocation { override def toString = "Header" } + /** + * UNDEFINED captures values that are sent either in error or + * that were added by the server after this library was + * generated. We want to make it easy and obvious for users of + * this library to handle this case gracefully. + * + * We use all CAPS for the variable name to avoid collisions + * with the camel cased values above. + */ + final case class UNDEFINED(override val toString: String) extends ParameterLocation + + /** + * all returns a list of all the valid, known values. We use + * lower case to avoid collisions with the camel cased values + * above. + */ + val all: scala.List[ParameterLocation] = scala.List(Path, Query, Form, Header) + + private + val byName: Map[String, ParameterLocation] = all.map(x => x.toString.toLowerCase -> x).toMap + + def apply(value: String): ParameterLocation = fromString(value).getOrElse(UNDEFINED(value)) + + def fromString(value: String): _root_.scala.Option[ParameterLocation] = byName.get(value.toLowerCase) + + } + + sealed trait ResponseCodeOption extends ResponseCode + + object ResponseCodeOption { + + case object Default extends ResponseCodeOption { override def toString = "Default" } + /** + * UNDEFINED captures values that are sent either in error or + * that were added by the server after this library was + * generated. We want to make it easy and obvious for users of + * this library to handle this case gracefully. + * + * We use all CAPS for the variable name to avoid collisions + * with the camel cased values above. + */ + final case class UNDEFINED(override val toString: String) extends ResponseCodeOption + + /** + * all returns a list of all the valid, known values. We use + * lower case to avoid collisions with the camel cased values + * above. + */ + val all: scala.List[ResponseCodeOption] = scala.List(Default) + + private + val byName: Map[String, ResponseCodeOption] = all.map(x => x.toString.toLowerCase -> x).toMap + + def apply(value: String): ResponseCodeOption = fromString(value).getOrElse(UNDEFINED(value)) + + def fromString(value: String): _root_.scala.Option[ResponseCodeOption] = byName.get(value.toLowerCase) + + } + +} + +package io.apibuilder.spec.v0.models { + + package object json { + import play.api.libs.json.__ + import play.api.libs.json.JsString + import play.api.libs.json.Writes + import play.api.libs.functional.syntax._ + import io.apibuilder.spec.v0.models.json._ + + private[v0] implicit val jsonReadsUUID: play.api.libs.json.Reads[_root_.java.util.UUID] = __.read[String].map { str => + _root_.java.util.UUID.fromString(str) + } + + private[v0] implicit val jsonWritesUUID: play.api.libs.json.Writes[_root_.java.util.UUID] = (x: _root_.java.util.UUID) => play.api.libs.json.JsString(x.toString) + + private[v0] implicit val jsonReadsJodaDateTime: play.api.libs.json.Reads[_root_.org.joda.time.DateTime] = __.read[String].map { str => + _root_.org.joda.time.format.ISODateTimeFormat.dateTimeParser.parseDateTime(str) + } + + private[v0] implicit val jsonWritesJodaDateTime: play.api.libs.json.Writes[_root_.org.joda.time.DateTime] = (x: _root_.org.joda.time.DateTime) => { + play.api.libs.json.JsString(_root_.org.joda.time.format.ISODateTimeFormat.dateTime.print(x)) + } + + private[v0] implicit val jsonReadsJodaLocalDate: play.api.libs.json.Reads[_root_.org.joda.time.LocalDate] = __.read[String].map { str => + _root_.org.joda.time.format.ISODateTimeFormat.dateTimeParser.parseLocalDate(str) + } + + private[v0] implicit val jsonWritesJodaLocalDate: play.api.libs.json.Writes[_root_.org.joda.time.LocalDate] = (x: _root_.org.joda.time.LocalDate) => { + play.api.libs.json.JsString(_root_.org.joda.time.format.ISODateTimeFormat.date.print(x)) + } + + implicit val jsonReadsApibuilderSpecMethod: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Method] = new play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Method] { + def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[io.apibuilder.spec.v0.models.Method] = { + js match { + case v: play.api.libs.json.JsString => play.api.libs.json.JsSuccess(io.apibuilder.spec.v0.models.Method(v.value)) + case _ => { + (js \ "value").validate[String] match { + case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(io.apibuilder.spec.v0.models.Method(v)) + case err: play.api.libs.json.JsError => + (js \ "method").validate[String] match { + case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(io.apibuilder.spec.v0.models.Method(v)) + case err: play.api.libs.json.JsError => err + } + } + } + } + } + } + + def jsonWritesApibuilderSpecMethod(obj: io.apibuilder.spec.v0.models.Method) = { + play.api.libs.json.JsString(obj.toString) + } + + def jsObjectMethod(obj: io.apibuilder.spec.v0.models.Method) = { + play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsString(obj.toString)) + } + + implicit def jsonWritesApibuilderSpecMethod: play.api.libs.json.Writes[Method] = { + (obj: io.apibuilder.spec.v0.models.Method) => { + io.apibuilder.spec.v0.models.json.jsonWritesApibuilderSpecMethod(obj) + } + } + + implicit val jsonReadsApibuilderSpecParameterLocation: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.ParameterLocation] = new play.api.libs.json.Reads[io.apibuilder.spec.v0.models.ParameterLocation] { + def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[io.apibuilder.spec.v0.models.ParameterLocation] = { + js match { + case v: play.api.libs.json.JsString => play.api.libs.json.JsSuccess(io.apibuilder.spec.v0.models.ParameterLocation(v.value)) + case _ => { + (js \ "value").validate[String] match { + case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(io.apibuilder.spec.v0.models.ParameterLocation(v)) + case err: play.api.libs.json.JsError => + (js \ "parameter_location").validate[String] match { + case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(io.apibuilder.spec.v0.models.ParameterLocation(v)) + case err: play.api.libs.json.JsError => err + } + } + } + } + } + } + + def jsonWritesApibuilderSpecParameterLocation(obj: io.apibuilder.spec.v0.models.ParameterLocation) = { + play.api.libs.json.JsString(obj.toString) + } + + def jsObjectParameterLocation(obj: io.apibuilder.spec.v0.models.ParameterLocation) = { + play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsString(obj.toString)) + } + + implicit def jsonWritesApibuilderSpecParameterLocation: play.api.libs.json.Writes[ParameterLocation] = { + (obj: io.apibuilder.spec.v0.models.ParameterLocation) => { + io.apibuilder.spec.v0.models.json.jsonWritesApibuilderSpecParameterLocation(obj) + } + } + + implicit val jsonReadsApibuilderSpecResponseCodeOption: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.ResponseCodeOption] = new play.api.libs.json.Reads[io.apibuilder.spec.v0.models.ResponseCodeOption] { + def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[io.apibuilder.spec.v0.models.ResponseCodeOption] = { + js match { + case v: play.api.libs.json.JsString => play.api.libs.json.JsSuccess(io.apibuilder.spec.v0.models.ResponseCodeOption(v.value)) + case _ => { + (js \ "value").validate[String] match { + case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(io.apibuilder.spec.v0.models.ResponseCodeOption(v)) + case err: play.api.libs.json.JsError => + (js \ "response_code_option").validate[String] match { + case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(io.apibuilder.spec.v0.models.ResponseCodeOption(v)) + case err: play.api.libs.json.JsError => err + } + } + } + } + } + } + + def jsonWritesApibuilderSpecResponseCodeOption(obj: io.apibuilder.spec.v0.models.ResponseCodeOption) = { + play.api.libs.json.JsString(obj.toString) + } + + def jsObjectResponseCodeOption(obj: io.apibuilder.spec.v0.models.ResponseCodeOption) = { + play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsString(obj.toString)) + } + + implicit def jsonWritesApibuilderSpecResponseCodeOption: play.api.libs.json.Writes[ResponseCodeOption] = { + (obj: io.apibuilder.spec.v0.models.ResponseCodeOption) => { + io.apibuilder.spec.v0.models.json.jsonWritesApibuilderSpecResponseCodeOption(obj) + } + } + + implicit def jsonReadsApibuilderSpecAnnotation: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Annotation] = { + for { + name <- (__ \ "name").read[String] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + } yield Annotation(name, description, deprecation) + } + + def jsObjectAnnotation(obj: io.apibuilder.spec.v0.models.Annotation): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "name" -> play.api.libs.json.JsString(obj.name) + ) ++ (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) + } + + implicit def jsonWritesApibuilderSpecAnnotation: play.api.libs.json.Writes[Annotation] = { + (obj: io.apibuilder.spec.v0.models.Annotation) => { + io.apibuilder.spec.v0.models.json.jsObjectAnnotation(obj) + } + } + + implicit def jsonReadsApibuilderSpecApidoc: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Apidoc] = { + (__ \ "version").read[String].map { x => Apidoc(version = x) } + } + + def jsObjectApidoc(obj: io.apibuilder.spec.v0.models.Apidoc): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "version" -> play.api.libs.json.JsString(obj.version) + ) + } + + implicit def jsonWritesApibuilderSpecApidoc: play.api.libs.json.Writes[Apidoc] = { + (obj: io.apibuilder.spec.v0.models.Apidoc) => { + io.apibuilder.spec.v0.models.json.jsObjectApidoc(obj) + } + } + + implicit def jsonReadsApibuilderSpecApplication: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Application] = { + (__ \ "key").read[String].map { x => Application(key = x) } + } + + def jsObjectApplication(obj: io.apibuilder.spec.v0.models.Application): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "key" -> play.api.libs.json.JsString(obj.key) + ) + } + + implicit def jsonWritesApibuilderSpecApplication: play.api.libs.json.Writes[Application] = { + (obj: io.apibuilder.spec.v0.models.Application) => { + io.apibuilder.spec.v0.models.json.jsObjectApplication(obj) + } + } + + implicit def jsonReadsApibuilderSpecAttribute: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Attribute] = { + for { + name <- (__ \ "name").read[String] + value <- (__ \ "value").read[_root_.play.api.libs.json.JsObject] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + } yield Attribute(name, value, description, deprecation) + } + + def jsObjectAttribute(obj: io.apibuilder.spec.v0.models.Attribute): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "name" -> play.api.libs.json.JsString(obj.name), + "value" -> obj.value + ) ++ (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) + } + + implicit def jsonWritesApibuilderSpecAttribute: play.api.libs.json.Writes[Attribute] = { + (obj: io.apibuilder.spec.v0.models.Attribute) => { + io.apibuilder.spec.v0.models.json.jsObjectAttribute(obj) + } + } + + implicit def jsonReadsApibuilderSpecBody: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Body] = { + for { + `type` <- (__ \ "type").read[String] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + attributes <- (__ \ "attributes").read[Seq[io.apibuilder.spec.v0.models.Attribute]] + } yield Body(`type`, description, deprecation, attributes) + } + + def jsObjectBody(obj: io.apibuilder.spec.v0.models.Body): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "type" -> play.api.libs.json.JsString(obj.`type`), + "attributes" -> play.api.libs.json.Json.toJson(obj.attributes) + ) ++ (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) + } + + implicit def jsonWritesApibuilderSpecBody: play.api.libs.json.Writes[Body] = { + (obj: io.apibuilder.spec.v0.models.Body) => { + io.apibuilder.spec.v0.models.json.jsObjectBody(obj) + } + } + + implicit def jsonReadsApibuilderSpecContact: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Contact] = { + for { + name <- (__ \ "name").readNullable[String] + url <- (__ \ "url").readNullable[String] + email <- (__ \ "email").readNullable[String] + } yield Contact(name, url, email) + } + + def jsObjectContact(obj: io.apibuilder.spec.v0.models.Contact): play.api.libs.json.JsObject = { + (obj.name match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("name" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.url match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("url" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.email match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("email" -> play.api.libs.json.JsString(x)) + }) + } + + implicit def jsonWritesApibuilderSpecContact: play.api.libs.json.Writes[Contact] = { + (obj: io.apibuilder.spec.v0.models.Contact) => { + io.apibuilder.spec.v0.models.json.jsObjectContact(obj) + } + } + + implicit def jsonReadsApibuilderSpecDeprecation: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Deprecation] = { + (__ \ "description").readNullable[String].map { x => Deprecation(description = x) } + } + + def jsObjectDeprecation(obj: io.apibuilder.spec.v0.models.Deprecation): play.api.libs.json.JsObject = { + (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) + } + + implicit def jsonWritesApibuilderSpecDeprecation: play.api.libs.json.Writes[Deprecation] = { + (obj: io.apibuilder.spec.v0.models.Deprecation) => { + io.apibuilder.spec.v0.models.json.jsObjectDeprecation(obj) + } + } + + implicit def jsonReadsApibuilderSpecEnum: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Enum] = { + for { + name <- (__ \ "name").read[String] + plural <- (__ \ "plural").read[String] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + values <- (__ \ "values").read[Seq[io.apibuilder.spec.v0.models.EnumValue]] + attributes <- (__ \ "attributes").read[Seq[io.apibuilder.spec.v0.models.Attribute]] + } yield Enum(name, plural, description, deprecation, values, attributes) + } + + def jsObjectEnum(obj: io.apibuilder.spec.v0.models.Enum): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "name" -> play.api.libs.json.JsString(obj.name), + "plural" -> play.api.libs.json.JsString(obj.plural), + "values" -> play.api.libs.json.Json.toJson(obj.values), + "attributes" -> play.api.libs.json.Json.toJson(obj.attributes) + ) ++ (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) + } + + implicit def jsonWritesApibuilderSpecEnum: play.api.libs.json.Writes[Enum] = { + (obj: io.apibuilder.spec.v0.models.Enum) => { + io.apibuilder.spec.v0.models.json.jsObjectEnum(obj) + } + } + + implicit def jsonReadsApibuilderSpecEnumValue: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.EnumValue] = { + for { + name <- (__ \ "name").read[String] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + attributes <- (__ \ "attributes").read[Seq[io.apibuilder.spec.v0.models.Attribute]] + value <- (__ \ "value").readNullable[String] + } yield EnumValue(name, description, deprecation, attributes, value) + } + + def jsObjectEnumValue(obj: io.apibuilder.spec.v0.models.EnumValue): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "name" -> play.api.libs.json.JsString(obj.name), + "attributes" -> play.api.libs.json.Json.toJson(obj.attributes) + ) ++ (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) ++ + (obj.value match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsString(x)) + }) + } + + implicit def jsonWritesApibuilderSpecEnumValue: play.api.libs.json.Writes[EnumValue] = { + (obj: io.apibuilder.spec.v0.models.EnumValue) => { + io.apibuilder.spec.v0.models.json.jsObjectEnumValue(obj) + } + } + + implicit def jsonReadsApibuilderSpecField: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Field] = { + for { + name <- (__ \ "name").read[String] + `type` <- (__ \ "type").read[String] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + default <- (__ \ "default").readNullable[String] + required <- (__ \ "required").read[Boolean] + minimum <- (__ \ "minimum").readNullable[Long] + maximum <- (__ \ "maximum").readNullable[Long] + example <- (__ \ "example").readNullable[String] + attributes <- (__ \ "attributes").read[Seq[io.apibuilder.spec.v0.models.Attribute]] + annotations <- (__ \ "annotations").readWithDefault[Seq[String]](Nil) + } yield Field(name, `type`, description, deprecation, default, required, minimum, maximum, example, attributes, annotations) + } + + def jsObjectField(obj: io.apibuilder.spec.v0.models.Field): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "name" -> play.api.libs.json.JsString(obj.name), + "type" -> play.api.libs.json.JsString(obj.`type`), + "required" -> play.api.libs.json.JsBoolean(obj.required), + "attributes" -> play.api.libs.json.Json.toJson(obj.attributes), + "annotations" -> play.api.libs.json.Json.toJson(obj.annotations) + ) ++ (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) ++ + (obj.default match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("default" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.minimum match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("minimum" -> play.api.libs.json.JsNumber(x)) + }) ++ + (obj.maximum match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("maximum" -> play.api.libs.json.JsNumber(x)) + }) ++ + (obj.example match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("example" -> play.api.libs.json.JsString(x)) + }) + } + + implicit def jsonWritesApibuilderSpecField: play.api.libs.json.Writes[Field] = { + (obj: io.apibuilder.spec.v0.models.Field) => { + io.apibuilder.spec.v0.models.json.jsObjectField(obj) + } + } + + implicit def jsonReadsApibuilderSpecHeader: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Header] = { + for { + name <- (__ \ "name").read[String] + `type` <- (__ \ "type").read[String] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + required <- (__ \ "required").read[Boolean] + default <- (__ \ "default").readNullable[String] + attributes <- (__ \ "attributes").read[Seq[io.apibuilder.spec.v0.models.Attribute]] + } yield Header(name, `type`, description, deprecation, required, default, attributes) + } + + def jsObjectHeader(obj: io.apibuilder.spec.v0.models.Header): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "name" -> play.api.libs.json.JsString(obj.name), + "type" -> play.api.libs.json.JsString(obj.`type`), + "required" -> play.api.libs.json.JsBoolean(obj.required), + "attributes" -> play.api.libs.json.Json.toJson(obj.attributes) + ) ++ (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) ++ + (obj.default match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("default" -> play.api.libs.json.JsString(x)) + }) + } + + implicit def jsonWritesApibuilderSpecHeader: play.api.libs.json.Writes[Header] = { + (obj: io.apibuilder.spec.v0.models.Header) => { + io.apibuilder.spec.v0.models.json.jsObjectHeader(obj) + } + } + + implicit def jsonReadsApibuilderSpecImport: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Import] = { + for { + uri <- (__ \ "uri").read[String] + namespace <- (__ \ "namespace").read[String] + organization <- (__ \ "organization").read[io.apibuilder.spec.v0.models.Organization] + application <- (__ \ "application").read[io.apibuilder.spec.v0.models.Application] + version <- (__ \ "version").read[String] + enums <- (__ \ "enums").read[Seq[String]] + interfaces <- (__ \ "interfaces").readWithDefault[Seq[String]](Nil) + unions <- (__ \ "unions").read[Seq[String]] + models <- (__ \ "models").read[Seq[String]] + annotations <- (__ \ "annotations").readWithDefault[Seq[io.apibuilder.spec.v0.models.Annotation]](Nil) + } yield Import(uri, namespace, organization, application, version, enums, interfaces, unions, models, annotations) + } + + def jsObjectImport(obj: io.apibuilder.spec.v0.models.Import): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "uri" -> play.api.libs.json.JsString(obj.uri), + "namespace" -> play.api.libs.json.JsString(obj.namespace), + "organization" -> io.apibuilder.spec.v0.models.json.jsObjectOrganization(obj.organization), + "application" -> io.apibuilder.spec.v0.models.json.jsObjectApplication(obj.application), + "version" -> play.api.libs.json.JsString(obj.version), + "enums" -> play.api.libs.json.Json.toJson(obj.enums), + "interfaces" -> play.api.libs.json.Json.toJson(obj.interfaces), + "unions" -> play.api.libs.json.Json.toJson(obj.unions), + "models" -> play.api.libs.json.Json.toJson(obj.models), + "annotations" -> play.api.libs.json.Json.toJson(obj.annotations) + ) + } + + implicit def jsonWritesApibuilderSpecImport: play.api.libs.json.Writes[Import] = { + (obj: io.apibuilder.spec.v0.models.Import) => { + io.apibuilder.spec.v0.models.json.jsObjectImport(obj) + } + } + + implicit def jsonReadsApibuilderSpecInfo: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Info] = { + for { + license <- (__ \ "license").readNullable[io.apibuilder.spec.v0.models.License] + contact <- (__ \ "contact").readNullable[io.apibuilder.spec.v0.models.Contact] + } yield Info(license, contact) + } + + def jsObjectInfo(obj: io.apibuilder.spec.v0.models.Info): play.api.libs.json.JsObject = { + (obj.license match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("license" -> io.apibuilder.spec.v0.models.json.jsObjectLicense(x)) + }) ++ + (obj.contact match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("contact" -> io.apibuilder.spec.v0.models.json.jsObjectContact(x)) + }) + } + + implicit def jsonWritesApibuilderSpecInfo: play.api.libs.json.Writes[Info] = { + (obj: io.apibuilder.spec.v0.models.Info) => { + io.apibuilder.spec.v0.models.json.jsObjectInfo(obj) + } + } + + implicit def jsonReadsApibuilderSpecInterface: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Interface] = { + for { + name <- (__ \ "name").read[String] + plural <- (__ \ "plural").read[String] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + fields <- (__ \ "fields").read[Seq[io.apibuilder.spec.v0.models.Field]] + attributes <- (__ \ "attributes").read[Seq[io.apibuilder.spec.v0.models.Attribute]] + } yield Interface(name, plural, description, deprecation, fields, attributes) + } + + def jsObjectInterface(obj: io.apibuilder.spec.v0.models.Interface): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "name" -> play.api.libs.json.JsString(obj.name), + "plural" -> play.api.libs.json.JsString(obj.plural), + "fields" -> play.api.libs.json.Json.toJson(obj.fields), + "attributes" -> play.api.libs.json.Json.toJson(obj.attributes) + ) ++ (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) + } + + implicit def jsonWritesApibuilderSpecInterface: play.api.libs.json.Writes[Interface] = { + (obj: io.apibuilder.spec.v0.models.Interface) => { + io.apibuilder.spec.v0.models.json.jsObjectInterface(obj) + } + } + + implicit def jsonReadsApibuilderSpecLicense: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.License] = { + for { + name <- (__ \ "name").read[String] + url <- (__ \ "url").readNullable[String] + } yield License(name, url) + } + + def jsObjectLicense(obj: io.apibuilder.spec.v0.models.License): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "name" -> play.api.libs.json.JsString(obj.name) + ) ++ (obj.url match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("url" -> play.api.libs.json.JsString(x)) + }) + } + + implicit def jsonWritesApibuilderSpecLicense: play.api.libs.json.Writes[License] = { + (obj: io.apibuilder.spec.v0.models.License) => { + io.apibuilder.spec.v0.models.json.jsObjectLicense(obj) + } + } + + implicit def jsonReadsApibuilderSpecModel: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Model] = { + for { + name <- (__ \ "name").read[String] + plural <- (__ \ "plural").read[String] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + fields <- (__ \ "fields").read[Seq[io.apibuilder.spec.v0.models.Field]] + attributes <- (__ \ "attributes").read[Seq[io.apibuilder.spec.v0.models.Attribute]] + interfaces <- (__ \ "interfaces").readWithDefault[Seq[String]](Nil) + } yield Model(name, plural, description, deprecation, fields, attributes, interfaces) + } + + def jsObjectModel(obj: io.apibuilder.spec.v0.models.Model): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "name" -> play.api.libs.json.JsString(obj.name), + "plural" -> play.api.libs.json.JsString(obj.plural), + "fields" -> play.api.libs.json.Json.toJson(obj.fields), + "attributes" -> play.api.libs.json.Json.toJson(obj.attributes), + "interfaces" -> play.api.libs.json.Json.toJson(obj.interfaces) + ) ++ (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) + } + + implicit def jsonWritesApibuilderSpecModel: play.api.libs.json.Writes[Model] = { + (obj: io.apibuilder.spec.v0.models.Model) => { + io.apibuilder.spec.v0.models.json.jsObjectModel(obj) + } + } + + implicit def jsonReadsApibuilderSpecOperation: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Operation] = { + for { + method <- (__ \ "method").read[io.apibuilder.spec.v0.models.Method] + path <- (__ \ "path").read[String] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + body <- (__ \ "body").readNullable[io.apibuilder.spec.v0.models.Body] + parameters <- (__ \ "parameters").read[Seq[io.apibuilder.spec.v0.models.Parameter]] + responses <- (__ \ "responses").read[Seq[io.apibuilder.spec.v0.models.Response]] + attributes <- (__ \ "attributes").read[Seq[io.apibuilder.spec.v0.models.Attribute]] + } yield Operation(method, path, description, deprecation, body, parameters, responses, attributes) + } + + def jsObjectOperation(obj: io.apibuilder.spec.v0.models.Operation): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "method" -> play.api.libs.json.JsString(obj.method.toString), + "path" -> play.api.libs.json.JsString(obj.path), + "parameters" -> play.api.libs.json.Json.toJson(obj.parameters), + "responses" -> play.api.libs.json.Json.toJson(obj.responses), + "attributes" -> play.api.libs.json.Json.toJson(obj.attributes) + ) ++ (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) ++ + (obj.body match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("body" -> io.apibuilder.spec.v0.models.json.jsObjectBody(x)) + }) + } + + implicit def jsonWritesApibuilderSpecOperation: play.api.libs.json.Writes[Operation] = { + (obj: io.apibuilder.spec.v0.models.Operation) => { + io.apibuilder.spec.v0.models.json.jsObjectOperation(obj) + } + } + + implicit def jsonReadsApibuilderSpecOrganization: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Organization] = { + (__ \ "key").read[String].map { x => Organization(key = x) } + } + + def jsObjectOrganization(obj: io.apibuilder.spec.v0.models.Organization): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "key" -> play.api.libs.json.JsString(obj.key) + ) + } + + implicit def jsonWritesApibuilderSpecOrganization: play.api.libs.json.Writes[Organization] = { + (obj: io.apibuilder.spec.v0.models.Organization) => { + io.apibuilder.spec.v0.models.json.jsObjectOrganization(obj) + } + } + + implicit def jsonReadsApibuilderSpecParameter: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Parameter] = { + for { + name <- (__ \ "name").read[String] + `type` <- (__ \ "type").read[String] + location <- (__ \ "location").read[io.apibuilder.spec.v0.models.ParameterLocation] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + required <- (__ \ "required").read[Boolean] + default <- (__ \ "default").readNullable[String] + minimum <- (__ \ "minimum").readNullable[Long] + maximum <- (__ \ "maximum").readNullable[Long] + example <- (__ \ "example").readNullable[String] + attributes <- (__ \ "attributes").readNullable[Seq[io.apibuilder.spec.v0.models.Attribute]] + } yield Parameter(name, `type`, location, description, deprecation, required, default, minimum, maximum, example, attributes) + } + + def jsObjectParameter(obj: io.apibuilder.spec.v0.models.Parameter): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "name" -> play.api.libs.json.JsString(obj.name), + "type" -> play.api.libs.json.JsString(obj.`type`), + "location" -> play.api.libs.json.JsString(obj.location.toString), + "required" -> play.api.libs.json.JsBoolean(obj.required) + ) ++ (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) ++ + (obj.default match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("default" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.minimum match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("minimum" -> play.api.libs.json.JsNumber(x)) + }) ++ + (obj.maximum match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("maximum" -> play.api.libs.json.JsNumber(x)) + }) ++ + (obj.example match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("example" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.attributes match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("attributes" -> play.api.libs.json.Json.toJson(x)) + }) + } + + implicit def jsonWritesApibuilderSpecParameter: play.api.libs.json.Writes[Parameter] = { + (obj: io.apibuilder.spec.v0.models.Parameter) => { + io.apibuilder.spec.v0.models.json.jsObjectParameter(obj) + } + } + + implicit def jsonReadsApibuilderSpecResource: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Resource] = { + for { + `type` <- (__ \ "type").read[String] + plural <- (__ \ "plural").read[String] + path <- (__ \ "path").readNullable[String] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + operations <- (__ \ "operations").read[Seq[io.apibuilder.spec.v0.models.Operation]] + attributes <- (__ \ "attributes").read[Seq[io.apibuilder.spec.v0.models.Attribute]] + } yield Resource(`type`, plural, path, description, deprecation, operations, attributes) + } + + def jsObjectResource(obj: io.apibuilder.spec.v0.models.Resource): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "type" -> play.api.libs.json.JsString(obj.`type`), + "plural" -> play.api.libs.json.JsString(obj.plural), + "operations" -> play.api.libs.json.Json.toJson(obj.operations), + "attributes" -> play.api.libs.json.Json.toJson(obj.attributes) + ) ++ (obj.path match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("path" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) + } + + implicit def jsonWritesApibuilderSpecResource: play.api.libs.json.Writes[Resource] = { + (obj: io.apibuilder.spec.v0.models.Resource) => { + io.apibuilder.spec.v0.models.json.jsObjectResource(obj) + } + } + + implicit def jsonReadsApibuilderSpecResponse: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Response] = { + for { + code <- (__ \ "code").read[io.apibuilder.spec.v0.models.ResponseCode] + `type` <- (__ \ "type").read[String] + headers <- (__ \ "headers").readNullable[Seq[io.apibuilder.spec.v0.models.Header]] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + attributes <- (__ \ "attributes").readNullable[Seq[io.apibuilder.spec.v0.models.Attribute]] + } yield Response(code, `type`, headers, description, deprecation, attributes) + } + + def jsObjectResponse(obj: io.apibuilder.spec.v0.models.Response): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "code" -> io.apibuilder.spec.v0.models.json.jsObjectResponseCode(obj.code), + "type" -> play.api.libs.json.JsString(obj.`type`) + ) ++ (obj.headers match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("headers" -> play.api.libs.json.Json.toJson(x)) + }) ++ + (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) ++ + (obj.attributes match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("attributes" -> play.api.libs.json.Json.toJson(x)) + }) + } + + implicit def jsonWritesApibuilderSpecResponse: play.api.libs.json.Writes[Response] = { + (obj: io.apibuilder.spec.v0.models.Response) => { + io.apibuilder.spec.v0.models.json.jsObjectResponse(obj) + } + } + + implicit def jsonReadsApibuilderSpecService: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Service] = { + for { + apidoc <- (__ \ "apidoc").readNullable[io.apibuilder.spec.v0.models.Apidoc] + name <- (__ \ "name").read[String] + organization <- (__ \ "organization").read[io.apibuilder.spec.v0.models.Organization] + application <- (__ \ "application").read[io.apibuilder.spec.v0.models.Application] + namespace <- (__ \ "namespace").read[String] + version <- (__ \ "version").read[String] + baseUrl <- (__ \ "base_url").readNullable[String] + description <- (__ \ "description").readNullable[String] + info <- (__ \ "info").read[io.apibuilder.spec.v0.models.Info] + headers <- (__ \ "headers").read[Seq[io.apibuilder.spec.v0.models.Header]] + imports <- (__ \ "imports").read[Seq[io.apibuilder.spec.v0.models.Import]] + enums <- (__ \ "enums").read[Seq[io.apibuilder.spec.v0.models.Enum]] + interfaces <- (__ \ "interfaces").readWithDefault[Seq[io.apibuilder.spec.v0.models.Interface]](Nil) + unions <- (__ \ "unions").read[Seq[io.apibuilder.spec.v0.models.Union]] + models <- (__ \ "models").read[Seq[io.apibuilder.spec.v0.models.Model]] + resources <- (__ \ "resources").read[Seq[io.apibuilder.spec.v0.models.Resource]] + attributes <- (__ \ "attributes").read[Seq[io.apibuilder.spec.v0.models.Attribute]] + annotations <- (__ \ "annotations").readWithDefault[Seq[io.apibuilder.spec.v0.models.Annotation]](Nil) + } yield Service(apidoc, name, organization, application, namespace, version, baseUrl, description, info, headers, imports, enums, interfaces, unions, models, resources, attributes, annotations) + } + + def jsObjectService(obj: io.apibuilder.spec.v0.models.Service): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "name" -> play.api.libs.json.JsString(obj.name), + "organization" -> io.apibuilder.spec.v0.models.json.jsObjectOrganization(obj.organization), + "application" -> io.apibuilder.spec.v0.models.json.jsObjectApplication(obj.application), + "namespace" -> play.api.libs.json.JsString(obj.namespace), + "version" -> play.api.libs.json.JsString(obj.version), + "info" -> io.apibuilder.spec.v0.models.json.jsObjectInfo(obj.info), + "headers" -> play.api.libs.json.Json.toJson(obj.headers), + "imports" -> play.api.libs.json.Json.toJson(obj.imports), + "enums" -> play.api.libs.json.Json.toJson(obj.enums), + "interfaces" -> play.api.libs.json.Json.toJson(obj.interfaces), + "unions" -> play.api.libs.json.Json.toJson(obj.unions), + "models" -> play.api.libs.json.Json.toJson(obj.models), + "resources" -> play.api.libs.json.Json.toJson(obj.resources), + "attributes" -> play.api.libs.json.Json.toJson(obj.attributes), + "annotations" -> play.api.libs.json.Json.toJson(obj.annotations) + ) ++ (obj.apidoc match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("apidoc" -> io.apibuilder.spec.v0.models.json.jsObjectApidoc(x)) + }) ++ + (obj.baseUrl match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("base_url" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) + } + + implicit def jsonWritesApibuilderSpecService: play.api.libs.json.Writes[Service] = { + (obj: io.apibuilder.spec.v0.models.Service) => { + io.apibuilder.spec.v0.models.json.jsObjectService(obj) + } + } + + implicit def jsonReadsApibuilderSpecUnion: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.Union] = { + for { + name <- (__ \ "name").read[String] + plural <- (__ \ "plural").read[String] + discriminator <- (__ \ "discriminator").readNullable[String] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + types <- (__ \ "types").read[Seq[io.apibuilder.spec.v0.models.UnionType]] + attributes <- (__ \ "attributes").read[Seq[io.apibuilder.spec.v0.models.Attribute]] + interfaces <- (__ \ "interfaces").readWithDefault[Seq[String]](Nil) + } yield Union(name, plural, discriminator, description, deprecation, types, attributes, interfaces) + } + + def jsObjectUnion(obj: io.apibuilder.spec.v0.models.Union): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "name" -> play.api.libs.json.JsString(obj.name), + "plural" -> play.api.libs.json.JsString(obj.plural), + "types" -> play.api.libs.json.Json.toJson(obj.types), + "attributes" -> play.api.libs.json.Json.toJson(obj.attributes), + "interfaces" -> play.api.libs.json.Json.toJson(obj.interfaces) + ) ++ (obj.discriminator match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("discriminator" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) + } + + implicit def jsonWritesApibuilderSpecUnion: play.api.libs.json.Writes[Union] = { + (obj: io.apibuilder.spec.v0.models.Union) => { + io.apibuilder.spec.v0.models.json.jsObjectUnion(obj) + } + } + + implicit def jsonReadsApibuilderSpecUnionType: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.UnionType] = { + for { + `type` <- (__ \ "type").read[String] + description <- (__ \ "description").readNullable[String] + deprecation <- (__ \ "deprecation").readNullable[io.apibuilder.spec.v0.models.Deprecation] + attributes <- (__ \ "attributes").read[Seq[io.apibuilder.spec.v0.models.Attribute]] + default <- (__ \ "default").readNullable[Boolean] + discriminatorValue <- (__ \ "discriminator_value").readNullable[String] + } yield UnionType(`type`, description, deprecation, attributes, default, discriminatorValue) + } + + def jsObjectUnionType(obj: io.apibuilder.spec.v0.models.UnionType): play.api.libs.json.JsObject = { + play.api.libs.json.Json.obj( + "type" -> play.api.libs.json.JsString(obj.`type`), + "attributes" -> play.api.libs.json.Json.toJson(obj.attributes) + ) ++ (obj.description match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x)) + }) ++ + (obj.deprecation match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("deprecation" -> io.apibuilder.spec.v0.models.json.jsObjectDeprecation(x)) + }) ++ + (obj.default match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("default" -> play.api.libs.json.JsBoolean(x)) + }) ++ + (obj.discriminatorValue match { + case None => play.api.libs.json.Json.obj() + case Some(x) => play.api.libs.json.Json.obj("discriminator_value" -> play.api.libs.json.JsString(x)) + }) + } + + implicit def jsonWritesApibuilderSpecUnionType: play.api.libs.json.Writes[UnionType] = { + (obj: io.apibuilder.spec.v0.models.UnionType) => { + io.apibuilder.spec.v0.models.json.jsObjectUnionType(obj) + } + } + + implicit def jsonReadsApibuilderSpecResponseCodeInt: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.ResponseCodeInt] = { + (__ \ "value").read[Int].map { x => ResponseCodeInt(value = x) } + } + + implicit def jsonReadsApibuilderSpecResponseCode: play.api.libs.json.Reads[io.apibuilder.spec.v0.models.ResponseCode] = { + ( + (__ \ "integer").read(jsonReadsApibuilderSpecResponseCodeInt).asInstanceOf[play.api.libs.json.Reads[ResponseCode]] + orElse + (__ \ "response_code_option").read(jsonReadsApibuilderSpecResponseCodeOption).asInstanceOf[play.api.libs.json.Reads[ResponseCode]] + orElse + play.api.libs.json.Reads(jsValue => play.api.libs.json.JsSuccess(ResponseCodeUndefinedType(jsValue.toString))).asInstanceOf[play.api.libs.json.Reads[ResponseCode]] + ) + } + + def jsObjectResponseCode(obj: io.apibuilder.spec.v0.models.ResponseCode): play.api.libs.json.JsObject = { + obj match { + case x: io.apibuilder.spec.v0.models.ResponseCodeInt => play.api.libs.json.Json.obj("integer" -> play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsNumber(x.value))) + case x: io.apibuilder.spec.v0.models.ResponseCodeOption => play.api.libs.json.Json.obj("response_code_option" -> play.api.libs.json.JsString(x.toString)) + case x: io.apibuilder.spec.v0.models.ResponseCodeUndefinedType => sys.error(s"The type[io.apibuilder.spec.v0.models.ResponseCodeUndefinedType] should never be serialized") + } + } + implicit def jsonWritesApibuilderSpecResponseCode: play.api.libs.json.Writes[ResponseCode] = { + (obj: io.apibuilder.spec.v0.models.ResponseCode) => { + io.apibuilder.spec.v0.models.json.jsObjectResponseCode(obj) + } + } + } +} + From 047e21062aa5076b31dc1996b639f6bee60fd726 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Thu, 4 Jul 2024 10:58:47 -0400 Subject: [PATCH 32/95] wip --- .../io/apibuilder/swagger/translators/Model.scala | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/swagger/src/main/scala/io/apibuilder/swagger/translators/Model.scala b/swagger/src/main/scala/io/apibuilder/swagger/translators/Model.scala index da388d1fd..cd4da6476 100644 --- a/swagger/src/main/scala/io/apibuilder/swagger/translators/Model.scala +++ b/swagger/src/main/scala/io/apibuilder/swagger/translators/Model.scala @@ -7,13 +7,13 @@ import lib.Text import io.apibuilder.swagger.{SwaggerData, Util} object Model { - val Placeholder: apidoc.Model = apidoc.Model( - name = "placeholder", - plural = "placeholders", - fields = Seq( - apidoc.Field(name = "placeholder", `type` = "string", required=false) - ) - ) + val Placeholder: apidoc.Model = apidoc.Model( + name = "placeholder", + plural = "placeholders", + fields = Seq( + apidoc.Field(name = "placeholder", `type` = "string", required=false) + ) + ) def apply( resolver: Resolver, From fda16c0464e57434fb4b2d6f307732a8e1204635 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Thu, 4 Jul 2024 11:17:51 -0400 Subject: [PATCH 33/95] wip --- build.sbt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index 9706923cd..228a863da 100644 --- a/build.sbt +++ b/build.sbt @@ -92,7 +92,7 @@ lazy val api = project .settings(commonSettings*) .settings( scalacOptions ++= allScalacOptions, - PlayKeys.fileWatchService := play.dev.filewatch.FileWatchService.jdk7(play.sbt.run.toLoggerProxy(sLog.value)), +// PlayKeys.fileWatchService := play.dev.filewatch.FileWatchService.jdk7(play.sbt.run.toLoggerProxy(sLog.value)), testOptions += Tests.Argument("-oF"), javaAgents += "com.datadoghq" % "dd-java-agent" % "1.8.0", routesImport += "io.apibuilder.api.v0.Bindables.Core._", @@ -105,13 +105,12 @@ lazy val api = project ws, "com.google.inject" % "guice" % "5.1.0", "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0", - "org.projectlombok" % "lombok" % "1.18.32" % "provided", - "org.postgresql" % "postgresql" % "42.7.3", - "org.mindrot" % "jbcrypt" % "0.4", +// "org.projectlombok" % "lombok" % "1.18.32" % "provided", + ("com.github.mbryzek" % "lib-cipher" % "0.0.2").cross(CrossVersion.for3Use2_13), "com.sendgrid" % "sendgrid-java" % "4.10.2", - "com.github.mbryzek" % "lib-query" % "0.0.1", + "com.github.mbryzek" % "lib-query" % "0.0.2", "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test, - "com.github.tomakehurst" % "wiremock-standalone" % "3.0.1" % Test +// "com.github.tomakehurst" % "wiremock-standalone" % "3.0.1" % Test ), bashScriptExtraDefines ++= Seq( """addJava "--add-opens=java.base/java.lang=ALL-UNNAMED"""" From 836401fdf61b4e65a95dd82f38b6ba441d805dd7 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Thu, 4 Jul 2024 11:18:49 -0400 Subject: [PATCH 34/95] wip --- api/app/db/UserPasswordsDao.scala | 74 +------------------------------ 1 file changed, 1 insertion(+), 73 deletions(-) diff --git a/api/app/db/UserPasswordsDao.scala b/api/app/db/UserPasswordsDao.scala index 3ec29ab59..c02a94bf4 100644 --- a/api/app/db/UserPasswordsDao.scala +++ b/api/app/db/UserPasswordsDao.scala @@ -10,80 +10,8 @@ import java.util.UUID import java.sql.Connection import io.flow.postgresql.Query -import org.mindrot.jbcrypt.BCrypt -import org.apache.commons.codec.binary.Base64 -private[db] case class HashedPassword(hash: String) - -sealed trait PasswordAlgorithm { - - /** - * Uniquely identifies this password algorithm - */ - def key: String - - /** - * Hashes the provided String, returning the hashed value - */ - def hash(password: String): HashedPassword - - /** - * Check if a cleartext password is valid - */ - def check(candidate: String, hashed: String): Boolean - -} - -case class BcryptPasswordAlgorithm(override val key: String) extends PasswordAlgorithm { - - private val LogRounds = 13 - - override def hash(password: String): HashedPassword = { - val salt = BCrypt.gensalt(LogRounds) - HashedPassword(BCrypt.hashpw(password, salt)) - } - - override def check(candidate: String, hashed: String): Boolean = { - BCrypt.checkpw(candidate, hashed) - } - -} - -/** - * Used only when fetching unknown keys from DB but will fail if you try to hash - */ -private[db] case class UnknownPasswordAlgorithm(override val key: String) extends PasswordAlgorithm { - - override def hash(password: String): HashedPassword = { - sys.error("Unsupported operation for UnknownPasswordAlgorithm") - } - - override def check(candidate: String, hashed: String) = false - -} - -object PasswordAlgorithm { - - private[db] val All = Seq( - BcryptPasswordAlgorithm("bcrypt"), - UnknownPasswordAlgorithm("unknown") - ) - - val Latest: PasswordAlgorithm = fromString("bcrypt").getOrElse { - sys.error("Could not find latest algorithm") - } - - private[db] val Unknown: PasswordAlgorithm = fromString("unknown").getOrElse { - sys.error("Could not find unknown algorithm") - } - - def fromString(value: String): Option[PasswordAlgorithm] = { - All.find(_.key == value) - } - -} - -case class UserPassword(guid: UUID, userGuid: UUID, algorithm: PasswordAlgorithm, hash: String) +case class UserPassword(guid: UUID, userGuid: UUID, hashed: HashedValue) @Singleton class UserPasswordsDao @Inject() ( From 032bb72b0934a13facfa733c6d75183bbb474941 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 08:04:52 -0400 Subject: [PATCH 35/95] wip --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 228a863da..7c710473c 100644 --- a/build.sbt +++ b/build.sbt @@ -171,7 +171,7 @@ lazy val commonSettings: Seq[Setting[_]] = Seq( organization := "io.apibuilder", libraryDependencies ++= Seq( "org.atteo" % "evo-inflector" % "1.3", - ("org.typelevel" %% "cats-core" % "2.12.0").cross(CrossVersion.for3Use2_13), + "org.typelevel" %% "cats-core" % "2.12.0", "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test ), scalacOptions ++= allScalacOptions, From 8ef372ce4e3187b87118340062213d13adf5f2a8 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 08:06:46 -0400 Subject: [PATCH 36/95] wip --- api/app/db/ItemsDao.scala | 2 +- api/app/processor/PurgeDeletedProcessor.scala | 6 +++--- dao/spec/psql-apibuilder.json | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/api/app/db/ItemsDao.scala b/api/app/db/ItemsDao.scala index d5b8ca980..26c57f41e 100644 --- a/api/app/db/ItemsDao.scala +++ b/api/app/db/ItemsDao.scala @@ -76,7 +76,7 @@ class ItemsDao @Inject() ( "detail" -> Json.toJson(detail).toString, "label" -> label.trim, "description" -> description.map(_.trim).map(Text.truncate(_)), - "content" -> content.trim.toLowerCase + "content" -> content.trim.toLowerCase ).execute() } } diff --git a/api/app/processor/PurgeDeletedProcessor.scala b/api/app/processor/PurgeDeletedProcessor.scala index 35717c430..bf38ebd22 100644 --- a/api/app/processor/PurgeDeletedProcessor.scala +++ b/api/app/processor/PurgeDeletedProcessor.scala @@ -58,7 +58,7 @@ class PurgeDeletedProcessor @Inject()( } @tailrec - private def deleteAll(table: Table)(f: DbRow[_] => Any): Unit = { + private def deleteAll(table: Table)(f: DbRow[?] => Any): Unit = { val all = nextDeletedRows(table) if (all.nonEmpty) { all.foreach { row => @@ -73,7 +73,7 @@ class PurgeDeletedProcessor @Inject()( private val Limit = 1000 private case class DbRow[T](pkey: T, deletedAt: DateTime) - private def nextDeletedRows(table: Table): Seq[DbRow[_]] = { + private def nextDeletedRows(table: Table): Seq[DbRow[?]] = { db.withConnection { c => Query( s"select ${table.pkey.name}::text as pkey, deleted_at from ${table.qualified}" @@ -83,7 +83,7 @@ class PurgeDeletedProcessor @Inject()( } } - private def parser(primaryKey: PrimaryKey): RowParser[DbRow[_]] = { + private def parser(primaryKey: PrimaryKey): RowParser[DbRow[?]] = { import PrimaryKey._ SqlParser.get[String]("pkey") ~ SqlParser.get[DateTime]("deleted_at") map { diff --git a/dao/spec/psql-apibuilder.json b/dao/spec/psql-apibuilder.json index 225c61fbf..f2628fc33 100644 --- a/dao/spec/psql-apibuilder.json +++ b/dao/spec/psql-apibuilder.json @@ -1,5 +1,8 @@ { "name": "psql-apibuilder", + "attributes": [ + { "name": "scala", "value": { "version": "3.4" } } + ], "models": { "generator_invocation": { From 186b899edf43923b1b97f0f07bca0220d7798106 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 08:09:48 -0400 Subject: [PATCH 37/95] wip --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 7c710473c..544236b5d 100644 --- a/build.sbt +++ b/build.sbt @@ -91,8 +91,9 @@ lazy val api = project .enablePlugins(PlayScala, JavaAgent) .settings(commonSettings*) .settings( + scalacOptions ++= Seq("-deprecation:false"), scalacOptions ++= allScalacOptions, -// PlayKeys.fileWatchService := play.dev.filewatch.FileWatchService.jdk7(play.sbt.run.toLoggerProxy(sLog.value)), + PlayKeys.fileWatchService := play.dev.filewatch.FileWatchService.jdk7(play.sbt.run.toLoggerProxy(sLog.value)), testOptions += Tests.Argument("-oF"), javaAgents += "com.datadoghq" % "dd-java-agent" % "1.8.0", routesImport += "io.apibuilder.api.v0.Bindables.Core._", From 77a4db57daf79ff311153772647439eaaea27dcb Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 08:10:23 -0400 Subject: [PATCH 38/95] wip --- .../GeneratorApibuilderSessionsDao.scala | 238 ------------------ 1 file changed, 238 deletions(-) delete mode 100644 api/app/db/generated/GeneratorApibuilderSessionsDao.scala diff --git a/api/app/db/generated/GeneratorApibuilderSessionsDao.scala b/api/app/db/generated/GeneratorApibuilderSessionsDao.scala deleted file mode 100644 index 63217b04a..000000000 --- a/api/app/db/generated/GeneratorApibuilderSessionsDao.scala +++ /dev/null @@ -1,238 +0,0 @@ -package db.generated - -import anorm._ -import db.DbHelpers -import io.flow.postgresql.{OrderBy, Query} -import java.sql.Connection -import java.util.UUID -import javax.inject.{Inject, Singleton} -import org.joda.time.DateTime -import play.api.db.{Database, NamedDatabase} - -case class Session( - id: String, - userGuid: UUID, - expiresAt: DateTime, - createdAt: DateTime, - createdByGuid: UUID, - updatedAt: DateTime, - updatedByGuid: UUID, - deletedAt: Option[DateTime], - deletedByGuid: Option[UUID] -) { - - lazy val form: SessionForm = SessionForm( - id = id, - userGuid = userGuid, - expiresAt = expiresAt, - createdAt = createdAt, - createdByGuid = createdByGuid, - updatedAt = updatedAt, - updatedByGuid = updatedByGuid, - deletedAt = deletedAt, - deletedByGuid = deletedByGuid - ) - -} - -case class SessionForm( - id: String, - userGuid: UUID, - expiresAt: DateTime, - createdAt: DateTime, - createdByGuid: UUID, - updatedAt: DateTime, - updatedByGuid: UUID, - deletedAt: Option[DateTime], - deletedByGuid: Option[UUID] -) - -@Singleton -class SessionsDao @Inject() ( - @NamedDatabase("default") db: Database -) { - - private val dbHelpers = DbHelpers(db, "sessions") - - private val BaseQuery = Query(""" - | select sessions.id, - | sessions.user_guid, - | sessions.expires_at, - | sessions.created_at, - | sessions.created_by_guid, - | sessions.updated_at, - | sessions.updated_by_guid, - | sessions.deleted_at, - | sessions.deleted_by_guid, - | sessions.hash_code - | from sessions - """.stripMargin) - - private val InsertQuery = Query(""" - | insert into sessions - | (id, user_guid, expires_at, created_at, created_by_guid, updated_at, updated_by_guid, deleted_at, deleted_by_guid, hash_code) - | values - | ({id}, {user_guid}::uuid, {expires_at}::timestamptz, {created_at}::timestamptz, {created_by_guid}::uuid, {updated_at}::timestamptz, {updated_by_guid}::uuid, {deleted_at}::timestamptz, {deleted_by_guid}::uuid, {hash_code}::bigint) - """.stripMargin) - - private val UpdateQuery = Query(""" - | update sessions - | set user_guid = {user_guid}::uuid, - | expires_at = {expires_at}::timestamptz, - | created_at = {created_at}::timestamptz, - | created_by_guid = {created_by_guid}::uuid, - | updated_at = {updated_at}::timestamptz, - | updated_by_guid = {updated_by_guid}::uuid, - | deleted_at = {deleted_at}::timestamptz, - | deleted_by_guid = {deleted_by_guid}::uuid, - | hash_code = {hash_code}::bigint - | where id = {id} - | and (sessions.hash_code is null or sessions.hash_code != {hash_code}::bigint) - """.stripMargin) - - private def bindQuery(query: Query, form: SessionForm): Query = { - query. - bind("user_guid", form.userGuid). - bind("expires_at", form.expiresAt). - bind("created_at", form.createdAt). - bind("created_by_guid", form.createdByGuid). - bind("updated_at", form.updatedAt). - bind("updated_by_guid", form.updatedByGuid). - bind("deleted_at", form.deletedAt). - bind("deleted_by_guid", form.deletedByGuid). - bind("hash_code", form.hashCode()) - } - - def insert(updatedBy: UUID, form: SessionForm) { - db.withConnection { implicit c => - insert(c, updatedBy, form) - } - } - - def insert(implicit c: Connection, updatedBy: UUID, form: SessionForm) { - bindQuery(InsertQuery, form). - bind("id", form.id). - anormSql.execute() - } - - def updateIfChangedById(updatedBy: UUID, id: String, form: SessionForm) { - if (!findById(id).map(_.form).contains(form)) { - updateById(updatedBy, id, form) - } - } - - def updateById(updatedBy: UUID, id: String, form: SessionForm) { - db.withConnection { implicit c => - updateById(c, updatedBy, id, form) - } - } - - def updateById(implicit c: Connection, updatedBy: UUID, id: String, form: SessionForm) { - bindQuery(UpdateQuery, form). - bind("id", id). - anormSql.execute() - } - - def update(updatedBy: UUID, existing: Session, form: SessionForm) { - db.withConnection { implicit c => - update(c, updatedBy, existing, form) - } - } - - def update(implicit c: Connection, updatedBy: UUID, existing: Session, form: SessionForm) { - updateById(c, updatedBy, existing.id, form) - } - - def delete(deletedBy: UUID, session: Session) { - dbHelpers.delete(deletedBy, session.id) - } - - def deleteById(deletedBy: UUID, id: String) { - db.withConnection { implicit c => - deleteById(c, deletedBy, id) - } - } - - def deleteById(c: java.sql.Connection, deletedBy: UUID, id: String) { - dbHelpers.delete(c, deletedBy, id) - } - - def findById(id: String): Option[Session] = { - db.withConnection { implicit c => - findByIdWithConnection(c, id) - } - } - - def findByIdWithConnection(c: java.sql.Connection, id: String): Option[Session] = { - findAllWithConnection(c, ids = Some(Seq(id)), limit = 1).headOption - } - - def findAll( - ids: Option[Seq[String]] = None, - userGuid: Option[UUID] = None, - limit: Long, - offset: Long = 0, - orderBy: OrderBy = OrderBy("sessions.id") - ) ( - implicit customQueryModifier: Query => Query = { q => q } - ): Seq[Session] = { - db.withConnection { implicit c => - findAllWithConnection( - c, - ids = ids, - userGuid = userGuid, - limit = limit, - offset = offset, - orderBy = orderBy - )(customQueryModifier) - } - } - - def findAllWithConnection( - c: java.sql.Connection, - ids: Option[Seq[String]] = None, - userGuid: Option[UUID] = None, - limit: Long, - offset: Long = 0, - orderBy: OrderBy = OrderBy("sessions.id") - ) ( - implicit customQueryModifier: Query => Query = { q => q } - ): Seq[Session] = { - customQueryModifier(BaseQuery). - optionalIn("sessions.id", ids). - equals("sessions.user_guid", userGuid). - limit(limit). - offset(offset). - orderBy(orderBy.sql). - as(SessionsDao.parser().*)(c) - } - -} - -object SessionsDao { - - def parser(): RowParser[Session] = { - SqlParser.str("id") ~ - SqlParser.get[UUID]("user_guid") ~ - SqlParser.get[DateTime]("expires_at") ~ - SqlParser.get[DateTime]("created_at") ~ - SqlParser.get[UUID]("created_by_guid") ~ - SqlParser.get[DateTime]("updated_at") ~ - SqlParser.get[UUID]("updated_by_guid") ~ - SqlParser.get[DateTime]("deleted_at").? ~ - SqlParser.get[UUID]("deleted_by_guid").? map { - case id ~ userGuid ~ expiresAt ~ createdAt ~ createdByGuid ~ updatedAt ~ updatedByGuid ~ deletedAt ~ deletedByGuid => Session( - id = id, - userGuid = userGuid, - expiresAt = expiresAt, - createdAt = createdAt, - createdByGuid = createdByGuid, - updatedAt = updatedAt, - updatedByGuid = updatedByGuid, - deletedAt = deletedAt, - deletedByGuid = deletedByGuid - ) - } - } - -} \ No newline at end of file From 9dcfde6b6894b022f1f58a2455afc51ab4de37c9 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 08:12:05 -0400 Subject: [PATCH 39/95] wip --- api/app/db/ItemsDao.scala | 2 +- build.sbt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/app/db/ItemsDao.scala b/api/app/db/ItemsDao.scala index 26c57f41e..71010516d 100644 --- a/api/app/db/ItemsDao.scala +++ b/api/app/db/ItemsDao.scala @@ -76,7 +76,7 @@ class ItemsDao @Inject() ( "detail" -> Json.toJson(detail).toString, "label" -> label.trim, "description" -> description.map(_.trim).map(Text.truncate(_)), - "content" -> content.trim.toLowerCase + "content" -> content.trim.toLowerCase, ).execute() } } diff --git a/build.sbt b/build.sbt index 544236b5d..4290f2bd2 100644 --- a/build.sbt +++ b/build.sbt @@ -106,12 +106,12 @@ lazy val api = project ws, "com.google.inject" % "guice" % "5.1.0", "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0", -// "org.projectlombok" % "lombok" % "1.18.32" % "provided", + "org.projectlombok" % "lombok" % "1.18.32" % "provided", ("com.github.mbryzek" % "lib-cipher" % "0.0.2").cross(CrossVersion.for3Use2_13), "com.sendgrid" % "sendgrid-java" % "4.10.2", "com.github.mbryzek" % "lib-query" % "0.0.2", "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test, -// "com.github.tomakehurst" % "wiremock-standalone" % "3.0.1" % Test + "com.github.tomakehurst" % "wiremock-standalone" % "3.0.1" % Test ), bashScriptExtraDefines ++= Seq( """addJava "--add-opens=java.base/java.lang=ALL-UNNAMED"""" From 09ff18164eded480bc8f6416820258b7d9a49def Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 08:14:45 -0400 Subject: [PATCH 40/95] wip --- .../ApicollectiveApibuilderApiV0Parsers.scala | 12 +- ...icollectiveApibuilderCommonV0Parsers.scala | 4 +- ...llectiveApibuilderGeneratorV0Parsers.scala | 4 +- ...ApicollectiveApibuilderSpecV0Parsers.scala | 8 +- .../ApicollectiveApibuilderTaskV0Client.scala | 130 ++++++++++++------ 5 files changed, 105 insertions(+), 53 deletions(-) diff --git a/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala index ca3d6d7b5..eabc875a0 100644 --- a/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala +++ b/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/anorm_2_8_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-api/latest/anorm_2_8_parsers */ import anorm._ @@ -19,7 +19,7 @@ package io.apibuilder.api.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.AppSortBy] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "app_sort_by", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.AppSortBy] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { + SqlParser.str(prefixOpt.getOrElse("") + name).map { case value => io.apibuilder.api.v0.models.AppSortBy(value) } } @@ -31,7 +31,7 @@ package io.apibuilder.api.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.OriginalType] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "original_type", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.OriginalType] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { + SqlParser.str(prefixOpt.getOrElse("") + name).map { case value => io.apibuilder.api.v0.models.OriginalType(value) } } @@ -43,7 +43,7 @@ package io.apibuilder.api.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Publication] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "publication", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.Publication] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { + SqlParser.str(prefixOpt.getOrElse("") + name).map { case value => io.apibuilder.api.v0.models.Publication(value) } } @@ -55,7 +55,7 @@ package io.apibuilder.api.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.SortOrder] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "sort_order", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.SortOrder] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { + SqlParser.str(prefixOpt.getOrElse("") + name).map { case value => io.apibuilder.api.v0.models.SortOrder(value) } } @@ -67,7 +67,7 @@ package io.apibuilder.api.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Visibility] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "visibility", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.Visibility] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { + SqlParser.str(prefixOpt.getOrElse("") + name).map { case value => io.apibuilder.api.v0.models.Visibility(value) } } diff --git a/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala index a6688b2c0..022d57c21 100644 --- a/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala +++ b/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-common/latest/anorm_2_8_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-common/latest/anorm_2_8_parsers */ import anorm._ @@ -16,7 +16,7 @@ package io.apibuilder.common.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.common.v0.models.MembershipRole] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "membership_role", prefixOpt: Option[String] = None): RowParser[io.apibuilder.common.v0.models.MembershipRole] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { + SqlParser.str(prefixOpt.getOrElse("") + name).map { case value => io.apibuilder.common.v0.models.MembershipRole(value) } } diff --git a/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala index 1e50faf18..843113dbb 100644 --- a/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala +++ b/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-generator/latest/anorm_2_8_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-generator/latest/anorm_2_8_parsers */ import anorm._ @@ -17,7 +17,7 @@ package io.apibuilder.generator.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.generator.v0.models.FileFlag] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "file_flag", prefixOpt: Option[String] = None): RowParser[io.apibuilder.generator.v0.models.FileFlag] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { + SqlParser.str(prefixOpt.getOrElse("") + name).map { case value => io.apibuilder.generator.v0.models.FileFlag(value) } } diff --git a/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala index e925ac26b..6468db2ec 100644 --- a/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala +++ b/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/anorm_2_8_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-spec/latest/anorm_2_8_parsers */ import anorm._ @@ -16,7 +16,7 @@ package io.apibuilder.spec.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Method] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "method", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.Method] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { + SqlParser.str(prefixOpt.getOrElse("") + name).map { case value => io.apibuilder.spec.v0.models.Method(value) } } @@ -28,7 +28,7 @@ package io.apibuilder.spec.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.ParameterLocation] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "parameter_location", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.ParameterLocation] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { + SqlParser.str(prefixOpt.getOrElse("") + name).map { case value => io.apibuilder.spec.v0.models.ParameterLocation(value) } } @@ -40,7 +40,7 @@ package io.apibuilder.spec.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.ResponseCodeOption] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "response_code_option", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.ResponseCodeOption] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { + SqlParser.str(prefixOpt.getOrElse("") + name).map { case value => io.apibuilder.spec.v0.models.ResponseCodeOption(value) } } diff --git a/generated/app/ApicollectiveApibuilderTaskV0Client.scala b/generated/app/ApicollectiveApibuilderTaskV0Client.scala index 18ab90a76..e16223600 100644 --- a/generated/app/ApicollectiveApibuilderTaskV0Client.scala +++ b/generated/app/ApicollectiveApibuilderTaskV0Client.scala @@ -1,11 +1,41 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-task/latest/play_2_9_scala_3_client + * User agent: apibuilder localhost 9000/apicollective/apibuilder-task/latest/play_2_9_scala_3_client */ package io.apibuilder.task.v0.models { - sealed trait EmailData extends _root_.scala.Product with _root_.scala.Serializable + sealed trait EmailData extends _root_.scala.Product with _root_.scala.Serializable { + def emailDataDiscriminator: EmailDataDiscriminator + + } + + /** + * Defines the valid discriminator values for the type EmailData + */ + sealed trait EmailDataDiscriminator extends _root_.scala.Product with _root_.scala.Serializable + + object EmailDataDiscriminator { + + case object EmailDataApplicationCreated extends EmailDataDiscriminator { override def toString = "email_data_application_created" } + case object EmailDataEmailVerificationCreated extends EmailDataDiscriminator { override def toString = "email_data_email_verification_created" } + case object EmailDataMembershipCreated extends EmailDataDiscriminator { override def toString = "email_data_membership_created" } + case object EmailDataMembershipRequestCreated extends EmailDataDiscriminator { override def toString = "email_data_membership_request_created" } + case object EmailDataMembershipRequestAccepted extends EmailDataDiscriminator { override def toString = "email_data_membership_request_accepted" } + case object EmailDataMembershipRequestDeclined extends EmailDataDiscriminator { override def toString = "email_data_membership_request_declined" } + case object EmailDataPasswordResetRequestCreated extends EmailDataDiscriminator { override def toString = "email_data_password_reset_request_created" } + + final case class UNDEFINED(override val toString: String) extends EmailDataDiscriminator + + val all: scala.List[EmailDataDiscriminator] = scala.List(EmailDataApplicationCreated, EmailDataEmailVerificationCreated, EmailDataMembershipCreated, EmailDataMembershipRequestCreated, EmailDataMembershipRequestAccepted, EmailDataMembershipRequestDeclined, EmailDataPasswordResetRequestCreated) + + private val byName: Map[String, EmailDataDiscriminator] = all.map(x => x.toString.toLowerCase -> x).toMap + + def apply(value: String): EmailDataDiscriminator = fromString(value).getOrElse(UNDEFINED(value)) + + def fromString(value: String): _root_.scala.Option[EmailDataDiscriminator] = byName.get(value.toLowerCase) + + } final case class DiffVersionData( oldVersionGuid: _root_.java.util.UUID, newVersionGuid: _root_.java.util.UUID @@ -13,34 +43,48 @@ package io.apibuilder.task.v0.models { final case class EmailDataApplicationCreated( applicationGuid: _root_.java.util.UUID - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.EmailDataApplicationCreated + } final case class EmailDataEmailVerificationCreated( guid: _root_.java.util.UUID - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.EmailDataEmailVerificationCreated + } final case class EmailDataMembershipCreated( guid: _root_.java.util.UUID - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.EmailDataMembershipCreated + } final case class EmailDataMembershipRequestAccepted( organizationGuid: _root_.java.util.UUID, userGuid: _root_.java.util.UUID, role: io.apibuilder.common.v0.models.MembershipRole - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.EmailDataMembershipRequestAccepted + } final case class EmailDataMembershipRequestCreated( guid: _root_.java.util.UUID - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.EmailDataMembershipRequestCreated + } final case class EmailDataMembershipRequestDeclined( organizationGuid: _root_.java.util.UUID, userGuid: _root_.java.util.UUID - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.EmailDataMembershipRequestDeclined + } final case class EmailDataPasswordResetRequestCreated( guid: _root_.java.util.UUID - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.EmailDataPasswordResetRequestCreated + } /** * Provides future compatibility in clients - in the future, when a type is added @@ -53,7 +97,9 @@ package io.apibuilder.task.v0.models { final case class EmailDataUndefinedType( description: String - ) extends EmailData + ) extends EmailData { + override val emailDataDiscriminator: EmailDataDiscriminator = EmailDataDiscriminator.UNDEFINED(description) + } sealed trait TaskType extends _root_.scala.Product with _root_.scala.Serializable object TaskType { @@ -190,7 +236,7 @@ package io.apibuilder.task.v0.models { def jsObjectEmailDataApplicationCreated(obj: io.apibuilder.task.v0.models.EmailDataApplicationCreated): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "application_guid" -> play.api.libs.json.JsString(obj.applicationGuid.toString) - ) + ) ++ play.api.libs.json.Json.obj("discriminator" -> "email_data_application_created") } def jsonWritesApibuilderTaskEmailDataApplicationCreated: play.api.libs.json.Writes[EmailDataApplicationCreated] = { @@ -206,7 +252,7 @@ package io.apibuilder.task.v0.models { def jsObjectEmailDataEmailVerificationCreated(obj: io.apibuilder.task.v0.models.EmailDataEmailVerificationCreated): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString) - ) + ) ++ play.api.libs.json.Json.obj("discriminator" -> "email_data_email_verification_created") } def jsonWritesApibuilderTaskEmailDataEmailVerificationCreated: play.api.libs.json.Writes[EmailDataEmailVerificationCreated] = { @@ -222,7 +268,7 @@ package io.apibuilder.task.v0.models { def jsObjectEmailDataMembershipCreated(obj: io.apibuilder.task.v0.models.EmailDataMembershipCreated): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString) - ) + ) ++ play.api.libs.json.Json.obj("discriminator" -> "email_data_membership_created") } def jsonWritesApibuilderTaskEmailDataMembershipCreated: play.api.libs.json.Writes[EmailDataMembershipCreated] = { @@ -244,7 +290,7 @@ package io.apibuilder.task.v0.models { "organization_guid" -> play.api.libs.json.JsString(obj.organizationGuid.toString), "user_guid" -> play.api.libs.json.JsString(obj.userGuid.toString), "role" -> play.api.libs.json.JsString(obj.role.toString) - ) + ) ++ play.api.libs.json.Json.obj("discriminator" -> "email_data_membership_request_accepted") } def jsonWritesApibuilderTaskEmailDataMembershipRequestAccepted: play.api.libs.json.Writes[EmailDataMembershipRequestAccepted] = { @@ -260,7 +306,7 @@ package io.apibuilder.task.v0.models { def jsObjectEmailDataMembershipRequestCreated(obj: io.apibuilder.task.v0.models.EmailDataMembershipRequestCreated): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString) - ) + ) ++ play.api.libs.json.Json.obj("discriminator" -> "email_data_membership_request_created") } def jsonWritesApibuilderTaskEmailDataMembershipRequestCreated: play.api.libs.json.Writes[EmailDataMembershipRequestCreated] = { @@ -280,7 +326,7 @@ package io.apibuilder.task.v0.models { play.api.libs.json.Json.obj( "organization_guid" -> play.api.libs.json.JsString(obj.organizationGuid.toString), "user_guid" -> play.api.libs.json.JsString(obj.userGuid.toString) - ) + ) ++ play.api.libs.json.Json.obj("discriminator" -> "email_data_membership_request_declined") } def jsonWritesApibuilderTaskEmailDataMembershipRequestDeclined: play.api.libs.json.Writes[EmailDataMembershipRequestDeclined] = { @@ -296,7 +342,7 @@ package io.apibuilder.task.v0.models { def jsObjectEmailDataPasswordResetRequestCreated(obj: io.apibuilder.task.v0.models.EmailDataPasswordResetRequestCreated): play.api.libs.json.JsObject = { play.api.libs.json.Json.obj( "guid" -> play.api.libs.json.JsString(obj.guid.toString) - ) + ) ++ play.api.libs.json.Json.obj("discriminator" -> "email_data_password_reset_request_created") } def jsonWritesApibuilderTaskEmailDataPasswordResetRequestCreated: play.api.libs.json.Writes[EmailDataPasswordResetRequestCreated] = { @@ -305,22 +351,26 @@ package io.apibuilder.task.v0.models { } } - implicit def jsonReadsApibuilderTaskEmailData[T <: io.apibuilder.task.v0.models.EmailData]: play.api.libs.json.Reads[T] = (json: play.api.libs.json.JsValue) => { - val default = jsonReadsApibuilderTaskEmailDataApplicationCreated.reads(json).map(_.asInstanceOf[T]) - val all: Seq[play.api.libs.json.JsResult[T]] = Seq( - default, - jsonReadsApibuilderTaskEmailDataEmailVerificationCreated.reads(json).map(_.asInstanceOf[T]), - jsonReadsApibuilderTaskEmailDataMembershipCreated.reads(json).map(_.asInstanceOf[T]), - jsonReadsApibuilderTaskEmailDataMembershipRequestCreated.reads(json).map(_.asInstanceOf[T]), - jsonReadsApibuilderTaskEmailDataMembershipRequestAccepted.reads(json).map(_.asInstanceOf[T]), - jsonReadsApibuilderTaskEmailDataMembershipRequestDeclined.reads(json).map(_.asInstanceOf[T]), - jsonReadsApibuilderTaskEmailDataPasswordResetRequestCreated.reads(json).map(_.asInstanceOf[T]) - ) - all.view.find(_.isSuccess).getOrElse(default) + implicit def jsonReadsApibuilderTaskEmailData[T <: io.apibuilder.task.v0.models.EmailData]: play.api.libs.json.Reads[T] = (js: play.api.libs.json.JsValue) => { + def readDiscriminator(discriminator: String) = { + discriminator match { + case "email_data_application_created" => io.apibuilder.task.v0.models.json.jsonReadsApibuilderTaskEmailDataApplicationCreated.reads(js) + case "email_data_email_verification_created" => io.apibuilder.task.v0.models.json.jsonReadsApibuilderTaskEmailDataEmailVerificationCreated.reads(js) + case "email_data_membership_created" => io.apibuilder.task.v0.models.json.jsonReadsApibuilderTaskEmailDataMembershipCreated.reads(js) + case "email_data_membership_request_created" => io.apibuilder.task.v0.models.json.jsonReadsApibuilderTaskEmailDataMembershipRequestCreated.reads(js) + case "email_data_membership_request_accepted" => io.apibuilder.task.v0.models.json.jsonReadsApibuilderTaskEmailDataMembershipRequestAccepted.reads(js) + case "email_data_membership_request_declined" => io.apibuilder.task.v0.models.json.jsonReadsApibuilderTaskEmailDataMembershipRequestDeclined.reads(js) + case "email_data_password_reset_request_created" => io.apibuilder.task.v0.models.json.jsonReadsApibuilderTaskEmailDataPasswordResetRequestCreated.reads(js) + case other => play.api.libs.json.JsSuccess(io.apibuilder.task.v0.models.EmailDataUndefinedType(other)) + } + } + (js \ "discriminator").validate[String] match { + case e: play.api.libs.json.JsError => e + case s: play.api.libs.json.JsSuccess[String] => readDiscriminator(s.value).map(_.asInstanceOf[T]) + } } - implicit def jsonReadsApibuilderTaskEmailDataSeq[T <: io.apibuilder.task.v0.models.EmailData]: play.api.libs.json.Reads[Seq[T]] = { case a: play.api.libs.json.JsArray => { val all: Seq[play.api.libs.json.JsResult[io.apibuilder.task.v0.models.EmailData]] = a.value.map(jsonReadsApibuilderTaskEmailData.reads).toSeq @@ -335,14 +385,16 @@ package io.apibuilder.task.v0.models { def jsObjectEmailData(obj: io.apibuilder.task.v0.models.EmailData): play.api.libs.json.JsObject = { obj match { - case x: io.apibuilder.task.v0.models.EmailDataApplicationCreated => play.api.libs.json.Json.obj("email_data_application_created" -> io.apibuilder.task.v0.models.json.jsObjectEmailDataApplicationCreated(x)) - case x: io.apibuilder.task.v0.models.EmailDataEmailVerificationCreated => play.api.libs.json.Json.obj("email_data_email_verification_created" -> io.apibuilder.task.v0.models.json.jsObjectEmailDataEmailVerificationCreated(x)) - case x: io.apibuilder.task.v0.models.EmailDataMembershipCreated => play.api.libs.json.Json.obj("email_data_membership_created" -> io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipCreated(x)) - case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestCreated => play.api.libs.json.Json.obj("email_data_membership_request_created" -> io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipRequestCreated(x)) - case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestAccepted => play.api.libs.json.Json.obj("email_data_membership_request_accepted" -> io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipRequestAccepted(x)) - case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestDeclined => play.api.libs.json.Json.obj("email_data_membership_request_declined" -> io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipRequestDeclined(x)) - case x: io.apibuilder.task.v0.models.EmailDataPasswordResetRequestCreated => play.api.libs.json.Json.obj("email_data_password_reset_request_created" -> io.apibuilder.task.v0.models.json.jsObjectEmailDataPasswordResetRequestCreated(x)) - case x: io.apibuilder.task.v0.models.EmailDataUndefinedType => sys.error(s"The type[io.apibuilder.task.v0.models.EmailDataUndefinedType] should never be serialized") + case x: io.apibuilder.task.v0.models.EmailDataApplicationCreated => io.apibuilder.task.v0.models.json.jsObjectEmailDataApplicationCreated(x) + case x: io.apibuilder.task.v0.models.EmailDataEmailVerificationCreated => io.apibuilder.task.v0.models.json.jsObjectEmailDataEmailVerificationCreated(x) + case x: io.apibuilder.task.v0.models.EmailDataMembershipCreated => io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipCreated(x) + case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestCreated => io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipRequestCreated(x) + case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestAccepted => io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipRequestAccepted(x) + case x: io.apibuilder.task.v0.models.EmailDataMembershipRequestDeclined => io.apibuilder.task.v0.models.json.jsObjectEmailDataMembershipRequestDeclined(x) + case x: io.apibuilder.task.v0.models.EmailDataPasswordResetRequestCreated => io.apibuilder.task.v0.models.json.jsObjectEmailDataPasswordResetRequestCreated(x) + case other => { + sys.error(s"The type[${other.getClass.getName}] has no JSON writer") + } } } @@ -472,7 +524,7 @@ package io.apibuilder.task.v0 { object Constants { val Namespace = "io.apibuilder.task.v0" - val UserAgent = "apibuilder app.apibuilder.io/apicollective/apibuilder-task/latest/play_2_9_scala_3_client" + val UserAgent = "apibuilder localhost 9000/apicollective/apibuilder-task/latest/play_2_9_scala_3_client" val Version = "0.16.50" val VersionMajor = 0 From 5f1b3fc7f18bb7e3be39dd4ff7e070fd1dfb81de Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 08:31:16 -0400 Subject: [PATCH 41/95] wip --- .apibuilder/config | 8 +-- ...collectiveApibuilderApiV0Conversions.scala | 72 +------------------ .../ApicollectiveApibuilderApiV0Parsers.scala | 12 ++-- ...lectiveApibuilderCommonV0Conversions.scala | 18 +---- ...icollectiveApibuilderCommonV0Parsers.scala | 4 +- ...tiveApibuilderGeneratorV0Conversions.scala | 21 +----- ...llectiveApibuilderGeneratorV0Parsers.scala | 4 +- ...ollectiveApibuilderSpecV0Conversions.scala | 41 +---------- ...ApicollectiveApibuilderSpecV0Parsers.scala | 8 +-- 9 files changed, 22 insertions(+), 166 deletions(-) diff --git a/.apibuilder/config b/.apibuilder/config index 34cfbbb37..4c44d2a65 100644 --- a/.apibuilder/config +++ b/.apibuilder/config @@ -5,7 +5,7 @@ code: generators: play_2_9_scala_3_client: generated/app play_2_x_routes: api/conf/routes - anorm_2_8_parsers: api/app/generated + anorm_2_8_scala_3_parsers: api/app/generated apibuilder-api-json: version: latest generators: @@ -16,19 +16,19 @@ code: play_2_x_standalone_json: lib/src/main/scala/generated play_2_9_scala_3_client: generated/app play_2_8_mock_client: generated/app - anorm_2_8_parsers: api/app/generated + anorm_2_8_scala_3_parsers: api/app/generated apibuilder-common: version: latest generators: play_2_9_scala_3_client: generated/app play_2_8_mock_client: generated/app - anorm_2_8_parsers: api/app/generated + anorm_2_8_scala_3_parsers: api/app/generated apibuilder-generator: version: latest generators: play_2_9_scala_3_client: generated/app play_2_8_mock_client: generated/app - anorm_2_8_parsers: api/app/generated + anorm_2_8_scala_3_parsers: api/app/generated apibuilder-task: version: latest generators: diff --git a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala index 1fd8c1788..41be6a838 100644 --- a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-api/latest/anorm_2_8_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-api/latest/anorm_2_8_scala_3_parsers */ package io.apibuilder.api.v0.anorm.conversions { @@ -54,150 +54,80 @@ package io.apibuilder.api.v0.anorm.conversions { object Types { import io.apibuilder.api.v0.models.json._ implicit val columnToSeqApibuilderApiAppSortBy: Column[Seq[_root_.io.apibuilder.api.v0.models.AppSortBy]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.AppSortBy]] } - implicit val columnToMapApibuilderApiAppSortBy: Column[Map[String, _root_.io.apibuilder.api.v0.models.AppSortBy]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.AppSortBy]] } implicit val columnToSeqApibuilderApiOriginalType: Column[Seq[_root_.io.apibuilder.api.v0.models.OriginalType]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.OriginalType]] } - implicit val columnToMapApibuilderApiOriginalType: Column[Map[String, _root_.io.apibuilder.api.v0.models.OriginalType]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.OriginalType]] } implicit val columnToSeqApibuilderApiPublication: Column[Seq[_root_.io.apibuilder.api.v0.models.Publication]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Publication]] } - implicit val columnToMapApibuilderApiPublication: Column[Map[String, _root_.io.apibuilder.api.v0.models.Publication]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Publication]] } implicit val columnToSeqApibuilderApiSortOrder: Column[Seq[_root_.io.apibuilder.api.v0.models.SortOrder]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.SortOrder]] } - implicit val columnToMapApibuilderApiSortOrder: Column[Map[String, _root_.io.apibuilder.api.v0.models.SortOrder]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.SortOrder]] } implicit val columnToSeqApibuilderApiVisibility: Column[Seq[_root_.io.apibuilder.api.v0.models.Visibility]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Visibility]] } - implicit val columnToMapApibuilderApiVisibility: Column[Map[String, _root_.io.apibuilder.api.v0.models.Visibility]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Visibility]] } implicit val columnToSeqApibuilderApiApplication: Column[Seq[_root_.io.apibuilder.api.v0.models.Application]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Application]] } - implicit val columnToMapApibuilderApiApplication: Column[Map[String, _root_.io.apibuilder.api.v0.models.Application]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Application]] } implicit val columnToSeqApibuilderApiApplicationForm: Column[Seq[_root_.io.apibuilder.api.v0.models.ApplicationForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.ApplicationForm]] } - implicit val columnToMapApibuilderApiApplicationForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.ApplicationForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.ApplicationForm]] } implicit val columnToSeqApibuilderApiApplicationMetadata: Column[Seq[_root_.io.apibuilder.api.v0.models.ApplicationMetadata]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.ApplicationMetadata]] } - implicit val columnToMapApibuilderApiApplicationMetadata: Column[Map[String, _root_.io.apibuilder.api.v0.models.ApplicationMetadata]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.ApplicationMetadata]] } implicit val columnToSeqApibuilderApiApplicationMetadataVersion: Column[Seq[_root_.io.apibuilder.api.v0.models.ApplicationMetadataVersion]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.ApplicationMetadataVersion]] } - implicit val columnToMapApibuilderApiApplicationMetadataVersion: Column[Map[String, _root_.io.apibuilder.api.v0.models.ApplicationMetadataVersion]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.ApplicationMetadataVersion]] } implicit val columnToSeqApibuilderApiApplicationSummary: Column[Seq[_root_.io.apibuilder.api.v0.models.ApplicationSummary]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.ApplicationSummary]] } - implicit val columnToMapApibuilderApiApplicationSummary: Column[Map[String, _root_.io.apibuilder.api.v0.models.ApplicationSummary]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.ApplicationSummary]] } implicit val columnToSeqApibuilderApiAttribute: Column[Seq[_root_.io.apibuilder.api.v0.models.Attribute]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Attribute]] } - implicit val columnToMapApibuilderApiAttribute: Column[Map[String, _root_.io.apibuilder.api.v0.models.Attribute]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Attribute]] } implicit val columnToSeqApibuilderApiAttributeForm: Column[Seq[_root_.io.apibuilder.api.v0.models.AttributeForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.AttributeForm]] } - implicit val columnToMapApibuilderApiAttributeForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.AttributeForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.AttributeForm]] } implicit val columnToSeqApibuilderApiAttributeSummary: Column[Seq[_root_.io.apibuilder.api.v0.models.AttributeSummary]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.AttributeSummary]] } - implicit val columnToMapApibuilderApiAttributeSummary: Column[Map[String, _root_.io.apibuilder.api.v0.models.AttributeSummary]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.AttributeSummary]] } implicit val columnToSeqApibuilderApiAttributeValue: Column[Seq[_root_.io.apibuilder.api.v0.models.AttributeValue]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.AttributeValue]] } - implicit val columnToMapApibuilderApiAttributeValue: Column[Map[String, _root_.io.apibuilder.api.v0.models.AttributeValue]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.AttributeValue]] } implicit val columnToSeqApibuilderApiAttributeValueForm: Column[Seq[_root_.io.apibuilder.api.v0.models.AttributeValueForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.AttributeValueForm]] } - implicit val columnToMapApibuilderApiAttributeValueForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.AttributeValueForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.AttributeValueForm]] } implicit val columnToSeqApibuilderApiAuthentication: Column[Seq[_root_.io.apibuilder.api.v0.models.Authentication]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Authentication]] } - implicit val columnToMapApibuilderApiAuthentication: Column[Map[String, _root_.io.apibuilder.api.v0.models.Authentication]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Authentication]] } implicit val columnToSeqApibuilderApiBatchDownloadApplicationForm: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationForm]] } - implicit val columnToMapApibuilderApiBatchDownloadApplicationForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplicationForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplicationForm]] } implicit val columnToSeqApibuilderApiBatchDownloadApplications: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplications]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplications]] } - implicit val columnToMapApibuilderApiBatchDownloadApplications: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplications]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplications]] } implicit val columnToSeqApibuilderApiBatchDownloadApplicationsForm: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationsForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationsForm]] } - implicit val columnToMapApibuilderApiBatchDownloadApplicationsForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplicationsForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.BatchDownloadApplicationsForm]] } implicit val columnToSeqApibuilderApiChange: Column[Seq[_root_.io.apibuilder.api.v0.models.Change]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Change]] } - implicit val columnToMapApibuilderApiChange: Column[Map[String, _root_.io.apibuilder.api.v0.models.Change]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Change]] } implicit val columnToSeqApibuilderApiChangeVersion: Column[Seq[_root_.io.apibuilder.api.v0.models.ChangeVersion]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.ChangeVersion]] } - implicit val columnToMapApibuilderApiChangeVersion: Column[Map[String, _root_.io.apibuilder.api.v0.models.ChangeVersion]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.ChangeVersion]] } implicit val columnToSeqApibuilderApiCleartextToken: Column[Seq[_root_.io.apibuilder.api.v0.models.CleartextToken]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.CleartextToken]] } - implicit val columnToMapApibuilderApiCleartextToken: Column[Map[String, _root_.io.apibuilder.api.v0.models.CleartextToken]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.CleartextToken]] } implicit val columnToSeqApibuilderApiCode: Column[Seq[_root_.io.apibuilder.api.v0.models.Code]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Code]] } - implicit val columnToMapApibuilderApiCode: Column[Map[String, _root_.io.apibuilder.api.v0.models.Code]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Code]] } implicit val columnToSeqApibuilderApiCodeForm: Column[Seq[_root_.io.apibuilder.api.v0.models.CodeForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.CodeForm]] } - implicit val columnToMapApibuilderApiCodeForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.CodeForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.CodeForm]] } implicit val columnToSeqApibuilderApiDiffBreaking: Column[Seq[_root_.io.apibuilder.api.v0.models.DiffBreaking]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.DiffBreaking]] } - implicit val columnToMapApibuilderApiDiffBreaking: Column[Map[String, _root_.io.apibuilder.api.v0.models.DiffBreaking]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.DiffBreaking]] } implicit val columnToSeqApibuilderApiDiffNonBreaking: Column[Seq[_root_.io.apibuilder.api.v0.models.DiffNonBreaking]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.DiffNonBreaking]] } - implicit val columnToMapApibuilderApiDiffNonBreaking: Column[Map[String, _root_.io.apibuilder.api.v0.models.DiffNonBreaking]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.DiffNonBreaking]] } implicit val columnToSeqApibuilderApiDomain: Column[Seq[_root_.io.apibuilder.api.v0.models.Domain]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Domain]] } - implicit val columnToMapApibuilderApiDomain: Column[Map[String, _root_.io.apibuilder.api.v0.models.Domain]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Domain]] } implicit val columnToSeqApibuilderApiEmailVerificationConfirmationForm: Column[Seq[_root_.io.apibuilder.api.v0.models.EmailVerificationConfirmationForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.EmailVerificationConfirmationForm]] } - implicit val columnToMapApibuilderApiEmailVerificationConfirmationForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.EmailVerificationConfirmationForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.EmailVerificationConfirmationForm]] } implicit val columnToSeqApibuilderApiError: Column[Seq[_root_.io.apibuilder.api.v0.models.Error]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Error]] } - implicit val columnToMapApibuilderApiError: Column[Map[String, _root_.io.apibuilder.api.v0.models.Error]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Error]] } implicit val columnToSeqApibuilderApiGeneratorForm: Column[Seq[_root_.io.apibuilder.api.v0.models.GeneratorForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.GeneratorForm]] } - implicit val columnToMapApibuilderApiGeneratorForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.GeneratorForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.GeneratorForm]] } implicit val columnToSeqApibuilderApiGeneratorService: Column[Seq[_root_.io.apibuilder.api.v0.models.GeneratorService]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.GeneratorService]] } - implicit val columnToMapApibuilderApiGeneratorService: Column[Map[String, _root_.io.apibuilder.api.v0.models.GeneratorService]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.GeneratorService]] } implicit val columnToSeqApibuilderApiGeneratorServiceForm: Column[Seq[_root_.io.apibuilder.api.v0.models.GeneratorServiceForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.GeneratorServiceForm]] } - implicit val columnToMapApibuilderApiGeneratorServiceForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.GeneratorServiceForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.GeneratorServiceForm]] } implicit val columnToSeqApibuilderApiGeneratorWithService: Column[Seq[_root_.io.apibuilder.api.v0.models.GeneratorWithService]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.GeneratorWithService]] } - implicit val columnToMapApibuilderApiGeneratorWithService: Column[Map[String, _root_.io.apibuilder.api.v0.models.GeneratorWithService]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.GeneratorWithService]] } implicit val columnToSeqApibuilderApiItem: Column[Seq[_root_.io.apibuilder.api.v0.models.Item]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Item]] } - implicit val columnToMapApibuilderApiItem: Column[Map[String, _root_.io.apibuilder.api.v0.models.Item]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Item]] } implicit val columnToSeqApibuilderApiMembership: Column[Seq[_root_.io.apibuilder.api.v0.models.Membership]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Membership]] } - implicit val columnToMapApibuilderApiMembership: Column[Map[String, _root_.io.apibuilder.api.v0.models.Membership]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Membership]] } implicit val columnToSeqApibuilderApiMembershipRequest: Column[Seq[_root_.io.apibuilder.api.v0.models.MembershipRequest]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.MembershipRequest]] } - implicit val columnToMapApibuilderApiMembershipRequest: Column[Map[String, _root_.io.apibuilder.api.v0.models.MembershipRequest]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.MembershipRequest]] } implicit val columnToSeqApibuilderApiMoveForm: Column[Seq[_root_.io.apibuilder.api.v0.models.MoveForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.MoveForm]] } - implicit val columnToMapApibuilderApiMoveForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.MoveForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.MoveForm]] } implicit val columnToSeqApibuilderApiOrganization: Column[Seq[_root_.io.apibuilder.api.v0.models.Organization]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Organization]] } - implicit val columnToMapApibuilderApiOrganization: Column[Map[String, _root_.io.apibuilder.api.v0.models.Organization]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Organization]] } implicit val columnToSeqApibuilderApiOrganizationForm: Column[Seq[_root_.io.apibuilder.api.v0.models.OrganizationForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.OrganizationForm]] } - implicit val columnToMapApibuilderApiOrganizationForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.OrganizationForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.OrganizationForm]] } implicit val columnToSeqApibuilderApiOriginal: Column[Seq[_root_.io.apibuilder.api.v0.models.Original]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Original]] } - implicit val columnToMapApibuilderApiOriginal: Column[Map[String, _root_.io.apibuilder.api.v0.models.Original]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Original]] } implicit val columnToSeqApibuilderApiOriginalForm: Column[Seq[_root_.io.apibuilder.api.v0.models.OriginalForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.OriginalForm]] } - implicit val columnToMapApibuilderApiOriginalForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.OriginalForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.OriginalForm]] } implicit val columnToSeqApibuilderApiPasswordReset: Column[Seq[_root_.io.apibuilder.api.v0.models.PasswordReset]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.PasswordReset]] } - implicit val columnToMapApibuilderApiPasswordReset: Column[Map[String, _root_.io.apibuilder.api.v0.models.PasswordReset]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.PasswordReset]] } implicit val columnToSeqApibuilderApiPasswordResetRequest: Column[Seq[_root_.io.apibuilder.api.v0.models.PasswordResetRequest]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.PasswordResetRequest]] } - implicit val columnToMapApibuilderApiPasswordResetRequest: Column[Map[String, _root_.io.apibuilder.api.v0.models.PasswordResetRequest]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.PasswordResetRequest]] } implicit val columnToSeqApibuilderApiSession: Column[Seq[_root_.io.apibuilder.api.v0.models.Session]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Session]] } - implicit val columnToMapApibuilderApiSession: Column[Map[String, _root_.io.apibuilder.api.v0.models.Session]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Session]] } implicit val columnToSeqApibuilderApiSubscription: Column[Seq[_root_.io.apibuilder.api.v0.models.Subscription]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Subscription]] } - implicit val columnToMapApibuilderApiSubscription: Column[Map[String, _root_.io.apibuilder.api.v0.models.Subscription]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Subscription]] } implicit val columnToSeqApibuilderApiSubscriptionForm: Column[Seq[_root_.io.apibuilder.api.v0.models.SubscriptionForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.SubscriptionForm]] } - implicit val columnToMapApibuilderApiSubscriptionForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.SubscriptionForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.SubscriptionForm]] } implicit val columnToSeqApibuilderApiToken: Column[Seq[_root_.io.apibuilder.api.v0.models.Token]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Token]] } - implicit val columnToMapApibuilderApiToken: Column[Map[String, _root_.io.apibuilder.api.v0.models.Token]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Token]] } implicit val columnToSeqApibuilderApiTokenForm: Column[Seq[_root_.io.apibuilder.api.v0.models.TokenForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.TokenForm]] } - implicit val columnToMapApibuilderApiTokenForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.TokenForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.TokenForm]] } implicit val columnToSeqApibuilderApiUser: Column[Seq[_root_.io.apibuilder.api.v0.models.User]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.User]] } - implicit val columnToMapApibuilderApiUser: Column[Map[String, _root_.io.apibuilder.api.v0.models.User]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.User]] } implicit val columnToSeqApibuilderApiUserForm: Column[Seq[_root_.io.apibuilder.api.v0.models.UserForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.UserForm]] } - implicit val columnToMapApibuilderApiUserForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.UserForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.UserForm]] } implicit val columnToSeqApibuilderApiUserSummary: Column[Seq[_root_.io.apibuilder.api.v0.models.UserSummary]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.UserSummary]] } - implicit val columnToMapApibuilderApiUserSummary: Column[Map[String, _root_.io.apibuilder.api.v0.models.UserSummary]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.UserSummary]] } implicit val columnToSeqApibuilderApiUserUpdateForm: Column[Seq[_root_.io.apibuilder.api.v0.models.UserUpdateForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.UserUpdateForm]] } - implicit val columnToMapApibuilderApiUserUpdateForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.UserUpdateForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.UserUpdateForm]] } implicit val columnToSeqApibuilderApiValidation: Column[Seq[_root_.io.apibuilder.api.v0.models.Validation]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Validation]] } - implicit val columnToMapApibuilderApiValidation: Column[Map[String, _root_.io.apibuilder.api.v0.models.Validation]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Validation]] } implicit val columnToSeqApibuilderApiVersion: Column[Seq[_root_.io.apibuilder.api.v0.models.Version]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Version]] } - implicit val columnToMapApibuilderApiVersion: Column[Map[String, _root_.io.apibuilder.api.v0.models.Version]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Version]] } implicit val columnToSeqApibuilderApiVersionForm: Column[Seq[_root_.io.apibuilder.api.v0.models.VersionForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.VersionForm]] } - implicit val columnToMapApibuilderApiVersionForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.VersionForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.VersionForm]] } implicit val columnToSeqApibuilderApiWatch: Column[Seq[_root_.io.apibuilder.api.v0.models.Watch]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Watch]] } - implicit val columnToMapApibuilderApiWatch: Column[Map[String, _root_.io.apibuilder.api.v0.models.Watch]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Watch]] } implicit val columnToSeqApibuilderApiWatchForm: Column[Seq[_root_.io.apibuilder.api.v0.models.WatchForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.WatchForm]] } - implicit val columnToMapApibuilderApiWatchForm: Column[Map[String, _root_.io.apibuilder.api.v0.models.WatchForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.WatchForm]] } implicit val columnToSeqApibuilderApiDiff: Column[Seq[_root_.io.apibuilder.api.v0.models.Diff]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Diff]] } - implicit val columnToMapApibuilderApiDiff: Column[Map[String, _root_.io.apibuilder.api.v0.models.Diff]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.Diff]] } implicit val columnToSeqApibuilderApiItemDetail: Column[Seq[_root_.io.apibuilder.api.v0.models.ItemDetail]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.ItemDetail]] } - implicit val columnToMapApibuilderApiItemDetail: Column[Map[String, _root_.io.apibuilder.api.v0.models.ItemDetail]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.api.v0.models.ItemDetail]] } } object Standard { implicit val columnToJsObject: Column[play.api.libs.json.JsObject] = Util.parser { _.as[play.api.libs.json.JsObject] } implicit val columnToJsValue: Column[play.api.libs.json.JsValue] = Util.parser { _.as[play.api.libs.json.JsValue] } implicit val columnToSeqBoolean: Column[Seq[Boolean]] = Util.parser { _.as[Seq[Boolean]] } - implicit val columnToMapBoolean: Column[Map[String, Boolean]] = Util.parser { _.as[Map[String, Boolean]] } implicit val columnToSeqDouble: Column[Seq[Double]] = Util.parser { _.as[Seq[Double]] } - implicit val columnToMapDouble: Column[Map[String, Double]] = Util.parser { _.as[Map[String, Double]] } implicit val columnToSeqInt: Column[Seq[Int]] = Util.parser { _.as[Seq[Int]] } - implicit val columnToMapInt: Column[Map[String, Int]] = Util.parser { _.as[Map[String, Int]] } implicit val columnToSeqLong: Column[Seq[Long]] = Util.parser { _.as[Seq[Long]] } - implicit val columnToMapLong: Column[Map[String, Long]] = Util.parser { _.as[Map[String, Long]] } implicit val columnToSeqLocalDate: Column[Seq[_root_.org.joda.time.LocalDate]] = Util.parser { _.as[Seq[_root_.org.joda.time.LocalDate]] } - implicit val columnToMapLocalDate: Column[Map[String, _root_.org.joda.time.LocalDate]] = Util.parser { _.as[Map[String, _root_.org.joda.time.LocalDate]] } implicit val columnToSeqDateTime: Column[Seq[_root_.org.joda.time.DateTime]] = Util.parser { _.as[Seq[_root_.org.joda.time.DateTime]] } - implicit val columnToMapDateTime: Column[Map[String, _root_.org.joda.time.DateTime]] = Util.parser { _.as[Map[String, _root_.org.joda.time.DateTime]] } implicit val columnToSeqBigDecimal: Column[Seq[BigDecimal]] = Util.parser { _.as[Seq[BigDecimal]] } - implicit val columnToMapBigDecimal: Column[Map[String, BigDecimal]] = Util.parser { _.as[Map[String, BigDecimal]] } implicit val columnToSeqJsObject: Column[Seq[_root_.play.api.libs.json.JsObject]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsObject]] } - implicit val columnToMapJsObject: Column[Map[String, _root_.play.api.libs.json.JsObject]] = Util.parser { _.as[Map[String, _root_.play.api.libs.json.JsObject]] } implicit val columnToSeqJsValue: Column[Seq[_root_.play.api.libs.json.JsValue]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsValue]] } - implicit val columnToMapJsValue: Column[Map[String, _root_.play.api.libs.json.JsValue]] = Util.parser { _.as[Map[String, _root_.play.api.libs.json.JsValue]] } implicit val columnToSeqString: Column[Seq[String]] = Util.parser { _.as[Seq[String]] } - implicit val columnToMapString: Column[Map[String, String]] = Util.parser { _.as[Map[String, String]] } implicit val columnToSeqUUID: Column[Seq[_root_.java.util.UUID]] = Util.parser { _.as[Seq[_root_.java.util.UUID]] } - implicit val columnToMapUUID: Column[Map[String, _root_.java.util.UUID]] = Util.parser { _.as[Map[String, _root_.java.util.UUID]] } } } \ No newline at end of file diff --git a/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala index eabc875a0..6092817a5 100644 --- a/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala +++ b/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-api/latest/anorm_2_8_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-api/latest/anorm_2_8_scala_3_parsers */ import anorm._ @@ -19,7 +19,7 @@ package io.apibuilder.api.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.AppSortBy] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "app_sort_by", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.AppSortBy] = { - SqlParser.str(prefixOpt.getOrElse("") + name).map { + SqlParser.str(prefixOpt.getOrElse("") + name) map { case value => io.apibuilder.api.v0.models.AppSortBy(value) } } @@ -31,7 +31,7 @@ package io.apibuilder.api.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.OriginalType] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "original_type", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.OriginalType] = { - SqlParser.str(prefixOpt.getOrElse("") + name).map { + SqlParser.str(prefixOpt.getOrElse("") + name) map { case value => io.apibuilder.api.v0.models.OriginalType(value) } } @@ -43,7 +43,7 @@ package io.apibuilder.api.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Publication] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "publication", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.Publication] = { - SqlParser.str(prefixOpt.getOrElse("") + name).map { + SqlParser.str(prefixOpt.getOrElse("") + name) map { case value => io.apibuilder.api.v0.models.Publication(value) } } @@ -55,7 +55,7 @@ package io.apibuilder.api.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.SortOrder] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "sort_order", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.SortOrder] = { - SqlParser.str(prefixOpt.getOrElse("") + name).map { + SqlParser.str(prefixOpt.getOrElse("") + name) map { case value => io.apibuilder.api.v0.models.SortOrder(value) } } @@ -67,7 +67,7 @@ package io.apibuilder.api.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Visibility] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "visibility", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.Visibility] = { - SqlParser.str(prefixOpt.getOrElse("") + name).map { + SqlParser.str(prefixOpt.getOrElse("") + name) map { case value => io.apibuilder.api.v0.models.Visibility(value) } } diff --git a/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala index cde824918..98809ed7c 100644 --- a/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-common/latest/anorm_2_8_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-common/latest/anorm_2_8_scala_3_parsers */ package io.apibuilder.common.v0.anorm.conversions { @@ -54,42 +54,26 @@ package io.apibuilder.common.v0.anorm.conversions { object Types { import io.apibuilder.common.v0.models.json._ implicit val columnToSeqApibuilderCommonMembershipRole: Column[Seq[_root_.io.apibuilder.common.v0.models.MembershipRole]] = Util.parser { _.as[Seq[_root_.io.apibuilder.common.v0.models.MembershipRole]] } - implicit val columnToMapApibuilderCommonMembershipRole: Column[Map[String, _root_.io.apibuilder.common.v0.models.MembershipRole]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.common.v0.models.MembershipRole]] } implicit val columnToSeqApibuilderCommonAudit: Column[Seq[_root_.io.apibuilder.common.v0.models.Audit]] = Util.parser { _.as[Seq[_root_.io.apibuilder.common.v0.models.Audit]] } - implicit val columnToMapApibuilderCommonAudit: Column[Map[String, _root_.io.apibuilder.common.v0.models.Audit]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.common.v0.models.Audit]] } implicit val columnToSeqApibuilderCommonHealthcheck: Column[Seq[_root_.io.apibuilder.common.v0.models.Healthcheck]] = Util.parser { _.as[Seq[_root_.io.apibuilder.common.v0.models.Healthcheck]] } - implicit val columnToMapApibuilderCommonHealthcheck: Column[Map[String, _root_.io.apibuilder.common.v0.models.Healthcheck]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.common.v0.models.Healthcheck]] } implicit val columnToSeqApibuilderCommonReference: Column[Seq[_root_.io.apibuilder.common.v0.models.Reference]] = Util.parser { _.as[Seq[_root_.io.apibuilder.common.v0.models.Reference]] } - implicit val columnToMapApibuilderCommonReference: Column[Map[String, _root_.io.apibuilder.common.v0.models.Reference]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.common.v0.models.Reference]] } implicit val columnToSeqApibuilderCommonReferenceGuid: Column[Seq[_root_.io.apibuilder.common.v0.models.ReferenceGuid]] = Util.parser { _.as[Seq[_root_.io.apibuilder.common.v0.models.ReferenceGuid]] } - implicit val columnToMapApibuilderCommonReferenceGuid: Column[Map[String, _root_.io.apibuilder.common.v0.models.ReferenceGuid]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.common.v0.models.ReferenceGuid]] } } object Standard { implicit val columnToJsObject: Column[play.api.libs.json.JsObject] = Util.parser { _.as[play.api.libs.json.JsObject] } implicit val columnToJsValue: Column[play.api.libs.json.JsValue] = Util.parser { _.as[play.api.libs.json.JsValue] } implicit val columnToSeqBoolean: Column[Seq[Boolean]] = Util.parser { _.as[Seq[Boolean]] } - implicit val columnToMapBoolean: Column[Map[String, Boolean]] = Util.parser { _.as[Map[String, Boolean]] } implicit val columnToSeqDouble: Column[Seq[Double]] = Util.parser { _.as[Seq[Double]] } - implicit val columnToMapDouble: Column[Map[String, Double]] = Util.parser { _.as[Map[String, Double]] } implicit val columnToSeqInt: Column[Seq[Int]] = Util.parser { _.as[Seq[Int]] } - implicit val columnToMapInt: Column[Map[String, Int]] = Util.parser { _.as[Map[String, Int]] } implicit val columnToSeqLong: Column[Seq[Long]] = Util.parser { _.as[Seq[Long]] } - implicit val columnToMapLong: Column[Map[String, Long]] = Util.parser { _.as[Map[String, Long]] } implicit val columnToSeqLocalDate: Column[Seq[_root_.org.joda.time.LocalDate]] = Util.parser { _.as[Seq[_root_.org.joda.time.LocalDate]] } - implicit val columnToMapLocalDate: Column[Map[String, _root_.org.joda.time.LocalDate]] = Util.parser { _.as[Map[String, _root_.org.joda.time.LocalDate]] } implicit val columnToSeqDateTime: Column[Seq[_root_.org.joda.time.DateTime]] = Util.parser { _.as[Seq[_root_.org.joda.time.DateTime]] } - implicit val columnToMapDateTime: Column[Map[String, _root_.org.joda.time.DateTime]] = Util.parser { _.as[Map[String, _root_.org.joda.time.DateTime]] } implicit val columnToSeqBigDecimal: Column[Seq[BigDecimal]] = Util.parser { _.as[Seq[BigDecimal]] } - implicit val columnToMapBigDecimal: Column[Map[String, BigDecimal]] = Util.parser { _.as[Map[String, BigDecimal]] } implicit val columnToSeqJsObject: Column[Seq[_root_.play.api.libs.json.JsObject]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsObject]] } - implicit val columnToMapJsObject: Column[Map[String, _root_.play.api.libs.json.JsObject]] = Util.parser { _.as[Map[String, _root_.play.api.libs.json.JsObject]] } implicit val columnToSeqJsValue: Column[Seq[_root_.play.api.libs.json.JsValue]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsValue]] } - implicit val columnToMapJsValue: Column[Map[String, _root_.play.api.libs.json.JsValue]] = Util.parser { _.as[Map[String, _root_.play.api.libs.json.JsValue]] } implicit val columnToSeqString: Column[Seq[String]] = Util.parser { _.as[Seq[String]] } - implicit val columnToMapString: Column[Map[String, String]] = Util.parser { _.as[Map[String, String]] } implicit val columnToSeqUUID: Column[Seq[_root_.java.util.UUID]] = Util.parser { _.as[Seq[_root_.java.util.UUID]] } - implicit val columnToMapUUID: Column[Map[String, _root_.java.util.UUID]] = Util.parser { _.as[Map[String, _root_.java.util.UUID]] } } } \ No newline at end of file diff --git a/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala index 022d57c21..fcd3044f4 100644 --- a/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala +++ b/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-common/latest/anorm_2_8_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-common/latest/anorm_2_8_scala_3_parsers */ import anorm._ @@ -16,7 +16,7 @@ package io.apibuilder.common.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.common.v0.models.MembershipRole] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "membership_role", prefixOpt: Option[String] = None): RowParser[io.apibuilder.common.v0.models.MembershipRole] = { - SqlParser.str(prefixOpt.getOrElse("") + name).map { + SqlParser.str(prefixOpt.getOrElse("") + name) map { case value => io.apibuilder.common.v0.models.MembershipRole(value) } } diff --git a/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala index 0d3d16d73..2b9b2dd4b 100644 --- a/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-generator/latest/anorm_2_8_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-generator/latest/anorm_2_8_scala_3_parsers */ package io.apibuilder.generator.v0.anorm.conversions { @@ -54,48 +54,29 @@ package io.apibuilder.generator.v0.anorm.conversions { object Types { import io.apibuilder.generator.v0.models.json._ implicit val columnToSeqApibuilderGeneratorFileFlag: Column[Seq[_root_.io.apibuilder.generator.v0.models.FileFlag]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.FileFlag]] } - implicit val columnToMapApibuilderGeneratorFileFlag: Column[Map[String, _root_.io.apibuilder.generator.v0.models.FileFlag]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.FileFlag]] } implicit val columnToSeqApibuilderGeneratorAttribute: Column[Seq[_root_.io.apibuilder.generator.v0.models.Attribute]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Attribute]] } - implicit val columnToMapApibuilderGeneratorAttribute: Column[Map[String, _root_.io.apibuilder.generator.v0.models.Attribute]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.Attribute]] } implicit val columnToSeqApibuilderGeneratorError: Column[Seq[_root_.io.apibuilder.generator.v0.models.Error]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Error]] } - implicit val columnToMapApibuilderGeneratorError: Column[Map[String, _root_.io.apibuilder.generator.v0.models.Error]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.Error]] } implicit val columnToSeqApibuilderGeneratorFile: Column[Seq[_root_.io.apibuilder.generator.v0.models.File]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.File]] } - implicit val columnToMapApibuilderGeneratorFile: Column[Map[String, _root_.io.apibuilder.generator.v0.models.File]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.File]] } implicit val columnToSeqApibuilderGeneratorGenerator: Column[Seq[_root_.io.apibuilder.generator.v0.models.Generator]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Generator]] } - implicit val columnToMapApibuilderGeneratorGenerator: Column[Map[String, _root_.io.apibuilder.generator.v0.models.Generator]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.Generator]] } implicit val columnToSeqApibuilderGeneratorHealthcheck: Column[Seq[_root_.io.apibuilder.generator.v0.models.Healthcheck]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Healthcheck]] } - implicit val columnToMapApibuilderGeneratorHealthcheck: Column[Map[String, _root_.io.apibuilder.generator.v0.models.Healthcheck]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.Healthcheck]] } implicit val columnToSeqApibuilderGeneratorInvocation: Column[Seq[_root_.io.apibuilder.generator.v0.models.Invocation]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Invocation]] } - implicit val columnToMapApibuilderGeneratorInvocation: Column[Map[String, _root_.io.apibuilder.generator.v0.models.Invocation]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.Invocation]] } implicit val columnToSeqApibuilderGeneratorInvocationForm: Column[Seq[_root_.io.apibuilder.generator.v0.models.InvocationForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.InvocationForm]] } - implicit val columnToMapApibuilderGeneratorInvocationForm: Column[Map[String, _root_.io.apibuilder.generator.v0.models.InvocationForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.InvocationForm]] } } object Standard { implicit val columnToJsObject: Column[play.api.libs.json.JsObject] = Util.parser { _.as[play.api.libs.json.JsObject] } implicit val columnToJsValue: Column[play.api.libs.json.JsValue] = Util.parser { _.as[play.api.libs.json.JsValue] } implicit val columnToSeqBoolean: Column[Seq[Boolean]] = Util.parser { _.as[Seq[Boolean]] } - implicit val columnToMapBoolean: Column[Map[String, Boolean]] = Util.parser { _.as[Map[String, Boolean]] } implicit val columnToSeqDouble: Column[Seq[Double]] = Util.parser { _.as[Seq[Double]] } - implicit val columnToMapDouble: Column[Map[String, Double]] = Util.parser { _.as[Map[String, Double]] } implicit val columnToSeqInt: Column[Seq[Int]] = Util.parser { _.as[Seq[Int]] } - implicit val columnToMapInt: Column[Map[String, Int]] = Util.parser { _.as[Map[String, Int]] } implicit val columnToSeqLong: Column[Seq[Long]] = Util.parser { _.as[Seq[Long]] } - implicit val columnToMapLong: Column[Map[String, Long]] = Util.parser { _.as[Map[String, Long]] } implicit val columnToSeqLocalDate: Column[Seq[_root_.org.joda.time.LocalDate]] = Util.parser { _.as[Seq[_root_.org.joda.time.LocalDate]] } - implicit val columnToMapLocalDate: Column[Map[String, _root_.org.joda.time.LocalDate]] = Util.parser { _.as[Map[String, _root_.org.joda.time.LocalDate]] } implicit val columnToSeqDateTime: Column[Seq[_root_.org.joda.time.DateTime]] = Util.parser { _.as[Seq[_root_.org.joda.time.DateTime]] } - implicit val columnToMapDateTime: Column[Map[String, _root_.org.joda.time.DateTime]] = Util.parser { _.as[Map[String, _root_.org.joda.time.DateTime]] } implicit val columnToSeqBigDecimal: Column[Seq[BigDecimal]] = Util.parser { _.as[Seq[BigDecimal]] } - implicit val columnToMapBigDecimal: Column[Map[String, BigDecimal]] = Util.parser { _.as[Map[String, BigDecimal]] } implicit val columnToSeqJsObject: Column[Seq[_root_.play.api.libs.json.JsObject]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsObject]] } - implicit val columnToMapJsObject: Column[Map[String, _root_.play.api.libs.json.JsObject]] = Util.parser { _.as[Map[String, _root_.play.api.libs.json.JsObject]] } implicit val columnToSeqJsValue: Column[Seq[_root_.play.api.libs.json.JsValue]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsValue]] } - implicit val columnToMapJsValue: Column[Map[String, _root_.play.api.libs.json.JsValue]] = Util.parser { _.as[Map[String, _root_.play.api.libs.json.JsValue]] } implicit val columnToSeqString: Column[Seq[String]] = Util.parser { _.as[Seq[String]] } - implicit val columnToMapString: Column[Map[String, String]] = Util.parser { _.as[Map[String, String]] } implicit val columnToSeqUUID: Column[Seq[_root_.java.util.UUID]] = Util.parser { _.as[Seq[_root_.java.util.UUID]] } - implicit val columnToMapUUID: Column[Map[String, _root_.java.util.UUID]] = Util.parser { _.as[Map[String, _root_.java.util.UUID]] } } } \ No newline at end of file diff --git a/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala index 843113dbb..51ac152a6 100644 --- a/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala +++ b/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-generator/latest/anorm_2_8_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-generator/latest/anorm_2_8_scala_3_parsers */ import anorm._ @@ -17,7 +17,7 @@ package io.apibuilder.generator.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.generator.v0.models.FileFlag] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "file_flag", prefixOpt: Option[String] = None): RowParser[io.apibuilder.generator.v0.models.FileFlag] = { - SqlParser.str(prefixOpt.getOrElse("") + name).map { + SqlParser.str(prefixOpt.getOrElse("") + name) map { case value => io.apibuilder.generator.v0.models.FileFlag(value) } } diff --git a/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala index af192fdb9..3ea967a68 100644 --- a/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-spec/latest/anorm_2_8_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-spec/latest/anorm_2_8_scala_3_parsers */ package io.apibuilder.spec.v0.anorm.conversions { @@ -54,88 +54,49 @@ package io.apibuilder.spec.v0.anorm.conversions { object Types { import io.apibuilder.spec.v0.models.json._ implicit val columnToSeqApibuilderSpecMethod: Column[Seq[_root_.io.apibuilder.spec.v0.models.Method]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Method]] } - implicit val columnToMapApibuilderSpecMethod: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Method]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Method]] } implicit val columnToSeqApibuilderSpecParameterLocation: Column[Seq[_root_.io.apibuilder.spec.v0.models.ParameterLocation]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.ParameterLocation]] } - implicit val columnToMapApibuilderSpecParameterLocation: Column[Map[String, _root_.io.apibuilder.spec.v0.models.ParameterLocation]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.ParameterLocation]] } implicit val columnToSeqApibuilderSpecResponseCodeOption: Column[Seq[_root_.io.apibuilder.spec.v0.models.ResponseCodeOption]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.ResponseCodeOption]] } - implicit val columnToMapApibuilderSpecResponseCodeOption: Column[Map[String, _root_.io.apibuilder.spec.v0.models.ResponseCodeOption]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.ResponseCodeOption]] } implicit val columnToSeqApibuilderSpecAnnotation: Column[Seq[_root_.io.apibuilder.spec.v0.models.Annotation]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Annotation]] } - implicit val columnToMapApibuilderSpecAnnotation: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Annotation]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Annotation]] } implicit val columnToSeqApibuilderSpecApidoc: Column[Seq[_root_.io.apibuilder.spec.v0.models.Apidoc]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Apidoc]] } - implicit val columnToMapApibuilderSpecApidoc: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Apidoc]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Apidoc]] } implicit val columnToSeqApibuilderSpecApplication: Column[Seq[_root_.io.apibuilder.spec.v0.models.Application]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Application]] } - implicit val columnToMapApibuilderSpecApplication: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Application]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Application]] } implicit val columnToSeqApibuilderSpecAttribute: Column[Seq[_root_.io.apibuilder.spec.v0.models.Attribute]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Attribute]] } - implicit val columnToMapApibuilderSpecAttribute: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Attribute]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Attribute]] } implicit val columnToSeqApibuilderSpecBody: Column[Seq[_root_.io.apibuilder.spec.v0.models.Body]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Body]] } - implicit val columnToMapApibuilderSpecBody: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Body]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Body]] } implicit val columnToSeqApibuilderSpecContact: Column[Seq[_root_.io.apibuilder.spec.v0.models.Contact]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Contact]] } - implicit val columnToMapApibuilderSpecContact: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Contact]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Contact]] } implicit val columnToSeqApibuilderSpecDeprecation: Column[Seq[_root_.io.apibuilder.spec.v0.models.Deprecation]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Deprecation]] } - implicit val columnToMapApibuilderSpecDeprecation: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Deprecation]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Deprecation]] } implicit val columnToSeqApibuilderSpecEnum: Column[Seq[_root_.io.apibuilder.spec.v0.models.Enum]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Enum]] } - implicit val columnToMapApibuilderSpecEnum: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Enum]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Enum]] } implicit val columnToSeqApibuilderSpecEnumValue: Column[Seq[_root_.io.apibuilder.spec.v0.models.EnumValue]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.EnumValue]] } - implicit val columnToMapApibuilderSpecEnumValue: Column[Map[String, _root_.io.apibuilder.spec.v0.models.EnumValue]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.EnumValue]] } implicit val columnToSeqApibuilderSpecField: Column[Seq[_root_.io.apibuilder.spec.v0.models.Field]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Field]] } - implicit val columnToMapApibuilderSpecField: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Field]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Field]] } implicit val columnToSeqApibuilderSpecHeader: Column[Seq[_root_.io.apibuilder.spec.v0.models.Header]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Header]] } - implicit val columnToMapApibuilderSpecHeader: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Header]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Header]] } implicit val columnToSeqApibuilderSpecImport: Column[Seq[_root_.io.apibuilder.spec.v0.models.Import]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Import]] } - implicit val columnToMapApibuilderSpecImport: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Import]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Import]] } implicit val columnToSeqApibuilderSpecInfo: Column[Seq[_root_.io.apibuilder.spec.v0.models.Info]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Info]] } - implicit val columnToMapApibuilderSpecInfo: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Info]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Info]] } implicit val columnToSeqApibuilderSpecInterface: Column[Seq[_root_.io.apibuilder.spec.v0.models.Interface]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Interface]] } - implicit val columnToMapApibuilderSpecInterface: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Interface]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Interface]] } implicit val columnToSeqApibuilderSpecLicense: Column[Seq[_root_.io.apibuilder.spec.v0.models.License]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.License]] } - implicit val columnToMapApibuilderSpecLicense: Column[Map[String, _root_.io.apibuilder.spec.v0.models.License]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.License]] } implicit val columnToSeqApibuilderSpecModel: Column[Seq[_root_.io.apibuilder.spec.v0.models.Model]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Model]] } - implicit val columnToMapApibuilderSpecModel: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Model]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Model]] } implicit val columnToSeqApibuilderSpecOperation: Column[Seq[_root_.io.apibuilder.spec.v0.models.Operation]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Operation]] } - implicit val columnToMapApibuilderSpecOperation: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Operation]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Operation]] } implicit val columnToSeqApibuilderSpecOrganization: Column[Seq[_root_.io.apibuilder.spec.v0.models.Organization]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Organization]] } - implicit val columnToMapApibuilderSpecOrganization: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Organization]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Organization]] } implicit val columnToSeqApibuilderSpecParameter: Column[Seq[_root_.io.apibuilder.spec.v0.models.Parameter]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Parameter]] } - implicit val columnToMapApibuilderSpecParameter: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Parameter]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Parameter]] } implicit val columnToSeqApibuilderSpecResource: Column[Seq[_root_.io.apibuilder.spec.v0.models.Resource]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Resource]] } - implicit val columnToMapApibuilderSpecResource: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Resource]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Resource]] } implicit val columnToSeqApibuilderSpecResponse: Column[Seq[_root_.io.apibuilder.spec.v0.models.Response]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Response]] } - implicit val columnToMapApibuilderSpecResponse: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Response]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Response]] } implicit val columnToSeqApibuilderSpecService: Column[Seq[_root_.io.apibuilder.spec.v0.models.Service]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Service]] } - implicit val columnToMapApibuilderSpecService: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Service]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Service]] } implicit val columnToSeqApibuilderSpecUnion: Column[Seq[_root_.io.apibuilder.spec.v0.models.Union]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Union]] } - implicit val columnToMapApibuilderSpecUnion: Column[Map[String, _root_.io.apibuilder.spec.v0.models.Union]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.Union]] } implicit val columnToSeqApibuilderSpecUnionType: Column[Seq[_root_.io.apibuilder.spec.v0.models.UnionType]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.UnionType]] } - implicit val columnToMapApibuilderSpecUnionType: Column[Map[String, _root_.io.apibuilder.spec.v0.models.UnionType]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.UnionType]] } implicit val columnToSeqApibuilderSpecResponseCode: Column[Seq[_root_.io.apibuilder.spec.v0.models.ResponseCode]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.ResponseCode]] } - implicit val columnToMapApibuilderSpecResponseCode: Column[Map[String, _root_.io.apibuilder.spec.v0.models.ResponseCode]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.spec.v0.models.ResponseCode]] } } object Standard { implicit val columnToJsObject: Column[play.api.libs.json.JsObject] = Util.parser { _.as[play.api.libs.json.JsObject] } implicit val columnToJsValue: Column[play.api.libs.json.JsValue] = Util.parser { _.as[play.api.libs.json.JsValue] } implicit val columnToSeqBoolean: Column[Seq[Boolean]] = Util.parser { _.as[Seq[Boolean]] } - implicit val columnToMapBoolean: Column[Map[String, Boolean]] = Util.parser { _.as[Map[String, Boolean]] } implicit val columnToSeqDouble: Column[Seq[Double]] = Util.parser { _.as[Seq[Double]] } - implicit val columnToMapDouble: Column[Map[String, Double]] = Util.parser { _.as[Map[String, Double]] } implicit val columnToSeqInt: Column[Seq[Int]] = Util.parser { _.as[Seq[Int]] } - implicit val columnToMapInt: Column[Map[String, Int]] = Util.parser { _.as[Map[String, Int]] } implicit val columnToSeqLong: Column[Seq[Long]] = Util.parser { _.as[Seq[Long]] } - implicit val columnToMapLong: Column[Map[String, Long]] = Util.parser { _.as[Map[String, Long]] } implicit val columnToSeqLocalDate: Column[Seq[_root_.org.joda.time.LocalDate]] = Util.parser { _.as[Seq[_root_.org.joda.time.LocalDate]] } - implicit val columnToMapLocalDate: Column[Map[String, _root_.org.joda.time.LocalDate]] = Util.parser { _.as[Map[String, _root_.org.joda.time.LocalDate]] } implicit val columnToSeqDateTime: Column[Seq[_root_.org.joda.time.DateTime]] = Util.parser { _.as[Seq[_root_.org.joda.time.DateTime]] } - implicit val columnToMapDateTime: Column[Map[String, _root_.org.joda.time.DateTime]] = Util.parser { _.as[Map[String, _root_.org.joda.time.DateTime]] } implicit val columnToSeqBigDecimal: Column[Seq[BigDecimal]] = Util.parser { _.as[Seq[BigDecimal]] } - implicit val columnToMapBigDecimal: Column[Map[String, BigDecimal]] = Util.parser { _.as[Map[String, BigDecimal]] } implicit val columnToSeqJsObject: Column[Seq[_root_.play.api.libs.json.JsObject]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsObject]] } - implicit val columnToMapJsObject: Column[Map[String, _root_.play.api.libs.json.JsObject]] = Util.parser { _.as[Map[String, _root_.play.api.libs.json.JsObject]] } implicit val columnToSeqJsValue: Column[Seq[_root_.play.api.libs.json.JsValue]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsValue]] } - implicit val columnToMapJsValue: Column[Map[String, _root_.play.api.libs.json.JsValue]] = Util.parser { _.as[Map[String, _root_.play.api.libs.json.JsValue]] } implicit val columnToSeqString: Column[Seq[String]] = Util.parser { _.as[Seq[String]] } - implicit val columnToMapString: Column[Map[String, String]] = Util.parser { _.as[Map[String, String]] } implicit val columnToSeqUUID: Column[Seq[_root_.java.util.UUID]] = Util.parser { _.as[Seq[_root_.java.util.UUID]] } - implicit val columnToMapUUID: Column[Map[String, _root_.java.util.UUID]] = Util.parser { _.as[Map[String, _root_.java.util.UUID]] } } } \ No newline at end of file diff --git a/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala index 6468db2ec..d812c5869 100644 --- a/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala +++ b/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala @@ -1,7 +1,7 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-spec/latest/anorm_2_8_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-spec/latest/anorm_2_8_scala_3_parsers */ import anorm._ @@ -16,7 +16,7 @@ package io.apibuilder.spec.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Method] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "method", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.Method] = { - SqlParser.str(prefixOpt.getOrElse("") + name).map { + SqlParser.str(prefixOpt.getOrElse("") + name) map { case value => io.apibuilder.spec.v0.models.Method(value) } } @@ -28,7 +28,7 @@ package io.apibuilder.spec.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.ParameterLocation] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "parameter_location", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.ParameterLocation] = { - SqlParser.str(prefixOpt.getOrElse("") + name).map { + SqlParser.str(prefixOpt.getOrElse("") + name) map { case value => io.apibuilder.spec.v0.models.ParameterLocation(value) } } @@ -40,7 +40,7 @@ package io.apibuilder.spec.v0.anorm.parsers { def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.ResponseCodeOption] = parser(prefixOpt = Some(s"$prefix$sep")) def parser(name: String = "response_code_option", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.ResponseCodeOption] = { - SqlParser.str(prefixOpt.getOrElse("") + name).map { + SqlParser.str(prefixOpt.getOrElse("") + name) map { case value => io.apibuilder.spec.v0.models.ResponseCodeOption(value) } } From a546edd0893d92eb5e3cede905e9cc1aa1a84459 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 08:32:36 -0400 Subject: [PATCH 42/95] wip --- ...collectiveApibuilderApiV0Conversions.scala | 60 ------------------- ...lectiveApibuilderCommonV0Conversions.scala | 6 -- ...tiveApibuilderGeneratorV0Conversions.scala | 9 --- ...ollectiveApibuilderSpecV0Conversions.scala | 29 --------- 4 files changed, 104 deletions(-) diff --git a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala index 41be6a838..17cf18c4a 100644 --- a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala @@ -52,66 +52,6 @@ package io.apibuilder.api.v0.anorm.conversions { } object Types { - import io.apibuilder.api.v0.models.json._ - implicit val columnToSeqApibuilderApiAppSortBy: Column[Seq[_root_.io.apibuilder.api.v0.models.AppSortBy]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.AppSortBy]] } - implicit val columnToSeqApibuilderApiOriginalType: Column[Seq[_root_.io.apibuilder.api.v0.models.OriginalType]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.OriginalType]] } - implicit val columnToSeqApibuilderApiPublication: Column[Seq[_root_.io.apibuilder.api.v0.models.Publication]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Publication]] } - implicit val columnToSeqApibuilderApiSortOrder: Column[Seq[_root_.io.apibuilder.api.v0.models.SortOrder]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.SortOrder]] } - implicit val columnToSeqApibuilderApiVisibility: Column[Seq[_root_.io.apibuilder.api.v0.models.Visibility]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Visibility]] } - implicit val columnToSeqApibuilderApiApplication: Column[Seq[_root_.io.apibuilder.api.v0.models.Application]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Application]] } - implicit val columnToSeqApibuilderApiApplicationForm: Column[Seq[_root_.io.apibuilder.api.v0.models.ApplicationForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.ApplicationForm]] } - implicit val columnToSeqApibuilderApiApplicationMetadata: Column[Seq[_root_.io.apibuilder.api.v0.models.ApplicationMetadata]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.ApplicationMetadata]] } - implicit val columnToSeqApibuilderApiApplicationMetadataVersion: Column[Seq[_root_.io.apibuilder.api.v0.models.ApplicationMetadataVersion]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.ApplicationMetadataVersion]] } - implicit val columnToSeqApibuilderApiApplicationSummary: Column[Seq[_root_.io.apibuilder.api.v0.models.ApplicationSummary]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.ApplicationSummary]] } - implicit val columnToSeqApibuilderApiAttribute: Column[Seq[_root_.io.apibuilder.api.v0.models.Attribute]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Attribute]] } - implicit val columnToSeqApibuilderApiAttributeForm: Column[Seq[_root_.io.apibuilder.api.v0.models.AttributeForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.AttributeForm]] } - implicit val columnToSeqApibuilderApiAttributeSummary: Column[Seq[_root_.io.apibuilder.api.v0.models.AttributeSummary]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.AttributeSummary]] } - implicit val columnToSeqApibuilderApiAttributeValue: Column[Seq[_root_.io.apibuilder.api.v0.models.AttributeValue]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.AttributeValue]] } - implicit val columnToSeqApibuilderApiAttributeValueForm: Column[Seq[_root_.io.apibuilder.api.v0.models.AttributeValueForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.AttributeValueForm]] } - implicit val columnToSeqApibuilderApiAuthentication: Column[Seq[_root_.io.apibuilder.api.v0.models.Authentication]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Authentication]] } - implicit val columnToSeqApibuilderApiBatchDownloadApplicationForm: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationForm]] } - implicit val columnToSeqApibuilderApiBatchDownloadApplications: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplications]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplications]] } - implicit val columnToSeqApibuilderApiBatchDownloadApplicationsForm: Column[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationsForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.BatchDownloadApplicationsForm]] } - implicit val columnToSeqApibuilderApiChange: Column[Seq[_root_.io.apibuilder.api.v0.models.Change]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Change]] } - implicit val columnToSeqApibuilderApiChangeVersion: Column[Seq[_root_.io.apibuilder.api.v0.models.ChangeVersion]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.ChangeVersion]] } - implicit val columnToSeqApibuilderApiCleartextToken: Column[Seq[_root_.io.apibuilder.api.v0.models.CleartextToken]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.CleartextToken]] } - implicit val columnToSeqApibuilderApiCode: Column[Seq[_root_.io.apibuilder.api.v0.models.Code]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Code]] } - implicit val columnToSeqApibuilderApiCodeForm: Column[Seq[_root_.io.apibuilder.api.v0.models.CodeForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.CodeForm]] } - implicit val columnToSeqApibuilderApiDiffBreaking: Column[Seq[_root_.io.apibuilder.api.v0.models.DiffBreaking]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.DiffBreaking]] } - implicit val columnToSeqApibuilderApiDiffNonBreaking: Column[Seq[_root_.io.apibuilder.api.v0.models.DiffNonBreaking]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.DiffNonBreaking]] } - implicit val columnToSeqApibuilderApiDomain: Column[Seq[_root_.io.apibuilder.api.v0.models.Domain]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Domain]] } - implicit val columnToSeqApibuilderApiEmailVerificationConfirmationForm: Column[Seq[_root_.io.apibuilder.api.v0.models.EmailVerificationConfirmationForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.EmailVerificationConfirmationForm]] } - implicit val columnToSeqApibuilderApiError: Column[Seq[_root_.io.apibuilder.api.v0.models.Error]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Error]] } - implicit val columnToSeqApibuilderApiGeneratorForm: Column[Seq[_root_.io.apibuilder.api.v0.models.GeneratorForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.GeneratorForm]] } - implicit val columnToSeqApibuilderApiGeneratorService: Column[Seq[_root_.io.apibuilder.api.v0.models.GeneratorService]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.GeneratorService]] } - implicit val columnToSeqApibuilderApiGeneratorServiceForm: Column[Seq[_root_.io.apibuilder.api.v0.models.GeneratorServiceForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.GeneratorServiceForm]] } - implicit val columnToSeqApibuilderApiGeneratorWithService: Column[Seq[_root_.io.apibuilder.api.v0.models.GeneratorWithService]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.GeneratorWithService]] } - implicit val columnToSeqApibuilderApiItem: Column[Seq[_root_.io.apibuilder.api.v0.models.Item]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Item]] } - implicit val columnToSeqApibuilderApiMembership: Column[Seq[_root_.io.apibuilder.api.v0.models.Membership]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Membership]] } - implicit val columnToSeqApibuilderApiMembershipRequest: Column[Seq[_root_.io.apibuilder.api.v0.models.MembershipRequest]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.MembershipRequest]] } - implicit val columnToSeqApibuilderApiMoveForm: Column[Seq[_root_.io.apibuilder.api.v0.models.MoveForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.MoveForm]] } - implicit val columnToSeqApibuilderApiOrganization: Column[Seq[_root_.io.apibuilder.api.v0.models.Organization]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Organization]] } - implicit val columnToSeqApibuilderApiOrganizationForm: Column[Seq[_root_.io.apibuilder.api.v0.models.OrganizationForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.OrganizationForm]] } - implicit val columnToSeqApibuilderApiOriginal: Column[Seq[_root_.io.apibuilder.api.v0.models.Original]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Original]] } - implicit val columnToSeqApibuilderApiOriginalForm: Column[Seq[_root_.io.apibuilder.api.v0.models.OriginalForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.OriginalForm]] } - implicit val columnToSeqApibuilderApiPasswordReset: Column[Seq[_root_.io.apibuilder.api.v0.models.PasswordReset]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.PasswordReset]] } - implicit val columnToSeqApibuilderApiPasswordResetRequest: Column[Seq[_root_.io.apibuilder.api.v0.models.PasswordResetRequest]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.PasswordResetRequest]] } - implicit val columnToSeqApibuilderApiSession: Column[Seq[_root_.io.apibuilder.api.v0.models.Session]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Session]] } - implicit val columnToSeqApibuilderApiSubscription: Column[Seq[_root_.io.apibuilder.api.v0.models.Subscription]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Subscription]] } - implicit val columnToSeqApibuilderApiSubscriptionForm: Column[Seq[_root_.io.apibuilder.api.v0.models.SubscriptionForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.SubscriptionForm]] } - implicit val columnToSeqApibuilderApiToken: Column[Seq[_root_.io.apibuilder.api.v0.models.Token]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Token]] } - implicit val columnToSeqApibuilderApiTokenForm: Column[Seq[_root_.io.apibuilder.api.v0.models.TokenForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.TokenForm]] } - implicit val columnToSeqApibuilderApiUser: Column[Seq[_root_.io.apibuilder.api.v0.models.User]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.User]] } - implicit val columnToSeqApibuilderApiUserForm: Column[Seq[_root_.io.apibuilder.api.v0.models.UserForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.UserForm]] } - implicit val columnToSeqApibuilderApiUserSummary: Column[Seq[_root_.io.apibuilder.api.v0.models.UserSummary]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.UserSummary]] } - implicit val columnToSeqApibuilderApiUserUpdateForm: Column[Seq[_root_.io.apibuilder.api.v0.models.UserUpdateForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.UserUpdateForm]] } - implicit val columnToSeqApibuilderApiValidation: Column[Seq[_root_.io.apibuilder.api.v0.models.Validation]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Validation]] } - implicit val columnToSeqApibuilderApiVersion: Column[Seq[_root_.io.apibuilder.api.v0.models.Version]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Version]] } - implicit val columnToSeqApibuilderApiVersionForm: Column[Seq[_root_.io.apibuilder.api.v0.models.VersionForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.VersionForm]] } - implicit val columnToSeqApibuilderApiWatch: Column[Seq[_root_.io.apibuilder.api.v0.models.Watch]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Watch]] } - implicit val columnToSeqApibuilderApiWatchForm: Column[Seq[_root_.io.apibuilder.api.v0.models.WatchForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.WatchForm]] } - implicit val columnToSeqApibuilderApiDiff: Column[Seq[_root_.io.apibuilder.api.v0.models.Diff]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.Diff]] } - implicit val columnToSeqApibuilderApiItemDetail: Column[Seq[_root_.io.apibuilder.api.v0.models.ItemDetail]] = Util.parser { _.as[Seq[_root_.io.apibuilder.api.v0.models.ItemDetail]] } } object Standard { diff --git a/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala index 98809ed7c..28932bba9 100644 --- a/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala @@ -52,12 +52,6 @@ package io.apibuilder.common.v0.anorm.conversions { } object Types { - import io.apibuilder.common.v0.models.json._ - implicit val columnToSeqApibuilderCommonMembershipRole: Column[Seq[_root_.io.apibuilder.common.v0.models.MembershipRole]] = Util.parser { _.as[Seq[_root_.io.apibuilder.common.v0.models.MembershipRole]] } - implicit val columnToSeqApibuilderCommonAudit: Column[Seq[_root_.io.apibuilder.common.v0.models.Audit]] = Util.parser { _.as[Seq[_root_.io.apibuilder.common.v0.models.Audit]] } - implicit val columnToSeqApibuilderCommonHealthcheck: Column[Seq[_root_.io.apibuilder.common.v0.models.Healthcheck]] = Util.parser { _.as[Seq[_root_.io.apibuilder.common.v0.models.Healthcheck]] } - implicit val columnToSeqApibuilderCommonReference: Column[Seq[_root_.io.apibuilder.common.v0.models.Reference]] = Util.parser { _.as[Seq[_root_.io.apibuilder.common.v0.models.Reference]] } - implicit val columnToSeqApibuilderCommonReferenceGuid: Column[Seq[_root_.io.apibuilder.common.v0.models.ReferenceGuid]] = Util.parser { _.as[Seq[_root_.io.apibuilder.common.v0.models.ReferenceGuid]] } } object Standard { diff --git a/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala index 2b9b2dd4b..12df32ce3 100644 --- a/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala @@ -52,15 +52,6 @@ package io.apibuilder.generator.v0.anorm.conversions { } object Types { - import io.apibuilder.generator.v0.models.json._ - implicit val columnToSeqApibuilderGeneratorFileFlag: Column[Seq[_root_.io.apibuilder.generator.v0.models.FileFlag]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.FileFlag]] } - implicit val columnToSeqApibuilderGeneratorAttribute: Column[Seq[_root_.io.apibuilder.generator.v0.models.Attribute]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Attribute]] } - implicit val columnToSeqApibuilderGeneratorError: Column[Seq[_root_.io.apibuilder.generator.v0.models.Error]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Error]] } - implicit val columnToSeqApibuilderGeneratorFile: Column[Seq[_root_.io.apibuilder.generator.v0.models.File]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.File]] } - implicit val columnToSeqApibuilderGeneratorGenerator: Column[Seq[_root_.io.apibuilder.generator.v0.models.Generator]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Generator]] } - implicit val columnToSeqApibuilderGeneratorHealthcheck: Column[Seq[_root_.io.apibuilder.generator.v0.models.Healthcheck]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Healthcheck]] } - implicit val columnToSeqApibuilderGeneratorInvocation: Column[Seq[_root_.io.apibuilder.generator.v0.models.Invocation]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Invocation]] } - implicit val columnToSeqApibuilderGeneratorInvocationForm: Column[Seq[_root_.io.apibuilder.generator.v0.models.InvocationForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.InvocationForm]] } } object Standard { diff --git a/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala index 3ea967a68..2b5b78459 100644 --- a/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala @@ -52,35 +52,6 @@ package io.apibuilder.spec.v0.anorm.conversions { } object Types { - import io.apibuilder.spec.v0.models.json._ - implicit val columnToSeqApibuilderSpecMethod: Column[Seq[_root_.io.apibuilder.spec.v0.models.Method]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Method]] } - implicit val columnToSeqApibuilderSpecParameterLocation: Column[Seq[_root_.io.apibuilder.spec.v0.models.ParameterLocation]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.ParameterLocation]] } - implicit val columnToSeqApibuilderSpecResponseCodeOption: Column[Seq[_root_.io.apibuilder.spec.v0.models.ResponseCodeOption]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.ResponseCodeOption]] } - implicit val columnToSeqApibuilderSpecAnnotation: Column[Seq[_root_.io.apibuilder.spec.v0.models.Annotation]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Annotation]] } - implicit val columnToSeqApibuilderSpecApidoc: Column[Seq[_root_.io.apibuilder.spec.v0.models.Apidoc]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Apidoc]] } - implicit val columnToSeqApibuilderSpecApplication: Column[Seq[_root_.io.apibuilder.spec.v0.models.Application]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Application]] } - implicit val columnToSeqApibuilderSpecAttribute: Column[Seq[_root_.io.apibuilder.spec.v0.models.Attribute]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Attribute]] } - implicit val columnToSeqApibuilderSpecBody: Column[Seq[_root_.io.apibuilder.spec.v0.models.Body]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Body]] } - implicit val columnToSeqApibuilderSpecContact: Column[Seq[_root_.io.apibuilder.spec.v0.models.Contact]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Contact]] } - implicit val columnToSeqApibuilderSpecDeprecation: Column[Seq[_root_.io.apibuilder.spec.v0.models.Deprecation]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Deprecation]] } - implicit val columnToSeqApibuilderSpecEnum: Column[Seq[_root_.io.apibuilder.spec.v0.models.Enum]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Enum]] } - implicit val columnToSeqApibuilderSpecEnumValue: Column[Seq[_root_.io.apibuilder.spec.v0.models.EnumValue]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.EnumValue]] } - implicit val columnToSeqApibuilderSpecField: Column[Seq[_root_.io.apibuilder.spec.v0.models.Field]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Field]] } - implicit val columnToSeqApibuilderSpecHeader: Column[Seq[_root_.io.apibuilder.spec.v0.models.Header]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Header]] } - implicit val columnToSeqApibuilderSpecImport: Column[Seq[_root_.io.apibuilder.spec.v0.models.Import]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Import]] } - implicit val columnToSeqApibuilderSpecInfo: Column[Seq[_root_.io.apibuilder.spec.v0.models.Info]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Info]] } - implicit val columnToSeqApibuilderSpecInterface: Column[Seq[_root_.io.apibuilder.spec.v0.models.Interface]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Interface]] } - implicit val columnToSeqApibuilderSpecLicense: Column[Seq[_root_.io.apibuilder.spec.v0.models.License]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.License]] } - implicit val columnToSeqApibuilderSpecModel: Column[Seq[_root_.io.apibuilder.spec.v0.models.Model]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Model]] } - implicit val columnToSeqApibuilderSpecOperation: Column[Seq[_root_.io.apibuilder.spec.v0.models.Operation]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Operation]] } - implicit val columnToSeqApibuilderSpecOrganization: Column[Seq[_root_.io.apibuilder.spec.v0.models.Organization]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Organization]] } - implicit val columnToSeqApibuilderSpecParameter: Column[Seq[_root_.io.apibuilder.spec.v0.models.Parameter]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Parameter]] } - implicit val columnToSeqApibuilderSpecResource: Column[Seq[_root_.io.apibuilder.spec.v0.models.Resource]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Resource]] } - implicit val columnToSeqApibuilderSpecResponse: Column[Seq[_root_.io.apibuilder.spec.v0.models.Response]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Response]] } - implicit val columnToSeqApibuilderSpecService: Column[Seq[_root_.io.apibuilder.spec.v0.models.Service]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Service]] } - implicit val columnToSeqApibuilderSpecUnion: Column[Seq[_root_.io.apibuilder.spec.v0.models.Union]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.Union]] } - implicit val columnToSeqApibuilderSpecUnionType: Column[Seq[_root_.io.apibuilder.spec.v0.models.UnionType]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.UnionType]] } - implicit val columnToSeqApibuilderSpecResponseCode: Column[Seq[_root_.io.apibuilder.spec.v0.models.ResponseCode]] = Util.parser { _.as[Seq[_root_.io.apibuilder.spec.v0.models.ResponseCode]] } } object Standard { From 4f7a2d1400e0f0c40caf72fe683525884a8e3a2c Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:01:40 -0400 Subject: [PATCH 43/95] wip --- core/{src/main/scala => app}/core/DuplicateJsonParser.scala | 0 core/{src/main/scala => app}/core/Importer.scala | 0 core/{src/main/scala => app}/core/ServiceFetcher.scala | 0 core/{src/main/scala => app}/core/TypeValidator.scala | 0 core/{src/main/scala => app}/core/Util.scala | 0 core/{src/main/scala => app}/core/VersionMigration.scala | 0 .../main/scala => app}/core/builder/DuplicateErrorMessage.scala | 0 core/{src/main/scala => app}/core/builder/JsonUtil.scala | 0 core/{src/main/scala => app}/core/builder/OriginalValidator.scala | 0 .../main/scala => app}/core/builder/ServiceSpecValidator.scala | 0 .../core/builder/api_json/ApiJsonServiceValidator.scala | 0 .../scala => app}/core/builder/api_json/InternalApiJsonForm.scala | 0 .../scala => app}/core/builder/api_json/InternalDatatype.scala | 0 .../main/scala => app}/core/builder/api_json/ServiceBuilder.scala | 0 .../core/builder/api_json/ServiceJsonServiceValidator.scala | 0 core/{src/main/scala => app}/core/builder/api_json/Types.scala | 0 .../core/builder/api_json/templates/ArrayMerge.scala | 0 .../core/builder/api_json/templates/AttributeMerge.scala | 0 .../core/builder/api_json/templates/HeaderMerge.scala | 0 .../scala => app}/core/builder/api_json/templates/JsMerge.scala | 0 .../scala => app}/core/builder/api_json/templates/MapMerge.scala | 0 .../core/builder/api_json/templates/ModelMerge.scala | 0 .../core/builder/api_json/templates/OptionHelpers.scala | 0 .../core/builder/api_json/templates/RenameTypes.scala | 0 .../core/builder/api_json/templates/ResourceMerge.scala | 0 .../core/builder/api_json/templates/TemplateMerge.scala | 0 .../builder/api_json/upgrades/InterfacesToSupportResources.scala | 0 .../core/builder/api_json/upgrades/RemoveApiDocElement.scala | 0 .../core/builder/api_json/upgrades/ServiceParser.scala | 0 .../scala => app}/core/builder/api_json/upgrades/Upgrader.scala | 0 .../core/generated/ApicollectiveApibuilderApiJsonV0Models.scala | 0 core/{src/test/scala => test}/core/ApiJsonStructureSpec.scala | 0 core/{src/test/scala => test}/core/BodyParameterSpec.scala | 0 core/{src/test/scala => test}/core/BrokenSpec.scala | 0 core/{src/test/scala => test}/core/DeprecationSpec.scala | 0 .../test/scala => test}/core/DuplicateFieldValidatorSpec.scala | 0 core/{src/test/scala => test}/core/DuplicateNamesSpec.scala | 0 core/{src/test/scala => test}/core/EnumSpec.scala | 0 core/{src/test/scala => test}/core/FileServiceFetcher.scala | 0 core/{src/test/scala => test}/core/ImportServiceApiJsonSpec.scala | 0 .../test/scala => test}/core/ImportServiceServiceJsonSpec.scala | 0 .../{src/test/scala => test}/core/ImportedResourcePathsSpec.scala | 0 core/{src/test/scala => test}/core/ImporterSpec.scala | 0 core/{src/test/scala => test}/core/InfoSpec.scala | 0 .../test/scala => test}/core/InlineEnumInModelFieldsSpec.scala | 0 core/{src/test/scala => test}/core/InlineEnumsSpec.scala | 0 core/{src/test/scala => test}/core/InlineModelsSpec.scala | 0 core/{src/test/scala => test}/core/InlineUnionsSpec.scala | 0 core/{src/test/scala => test}/core/InterfaceImportsSpec.scala | 0 core/{src/test/scala => test}/core/InterfaceSpec.scala | 0 core/{src/test/scala => test}/core/MockServiceFetcher.scala | 0 core/{src/test/scala => test}/core/NestedUnionsSpec.scala | 0 core/{src/test/scala => test}/core/OriginalValidatorSpec.scala | 0 core/{src/test/scala => test}/core/ServiceAnnotationsSpec.scala | 0 .../test/scala => test}/core/ServiceCommonReturnTypeSpec.scala | 0 core/{src/test/scala => test}/core/ServiceDefaultsSpec.scala | 0 core/{src/test/scala => test}/core/ServiceEnumSpec.scala | 0 core/{src/test/scala => test}/core/ServiceHeaderImportsSpec.scala | 0 core/{src/test/scala => test}/core/ServiceHeadersSpec.scala | 0 .../test/scala => test}/core/ServiceInternalReferencesSpec.scala | 0 core/{src/test/scala => test}/core/ServiceMapSpec.scala | 0 core/{src/test/scala => test}/core/ServiceMethodsSpec.scala | 0 core/{src/test/scala => test}/core/ServiceParametersSpec.scala | 0 .../{src/test/scala => test}/core/ServicePathParametersSpec.scala | 0 core/{src/test/scala => test}/core/ServiceResourcesSpec.scala | 0 core/{src/test/scala => test}/core/ServiceResponsesSpec.scala | 0 core/{src/test/scala => test}/core/ServiceValidatorSpec.scala | 0 core/{src/test/scala => test}/core/SvcApiDocJsonSpec.scala | 0 core/{src/test/scala => test}/core/SvcIrisHubSpec.scala | 0 core/{src/test/scala => test}/core/TemplateSpec.scala | 0 core/{src/test/scala => test}/core/TestHelper.scala | 0 core/{src/test/scala => test}/core/TypeValidatorSpec.scala | 0 core/{src/test/scala => test}/core/UnionTypeDefaultSpec.scala | 0 .../scala => test}/core/UnionTypeDiscriminatorValueSpec.scala | 0 core/{src/test/scala => test}/core/UnionTypeSpec.scala | 0 core/{src/test/scala => test}/core/UtilSpec.scala | 0 core/{src/test/scala => test}/core/builder/JsonUtilSpec.scala | 0 .../core/builder/api_json/InternalDatatypeSpec.scala | 0 .../core/builder/api_json/templates/ModelMergeSpec.scala | 0 .../core/builder/api_json/templates/ResourceMergeSpec.scala | 0 .../core/builder/api_json/upgrades/RemoveApiDocElementSpec.scala | 0 .../core/builder/api_json/upgrades/ServiceParserSpec.scala | 0 core/{src/test/scala => test}/helpers/ApiJsonHelpers.scala | 0 core/{src/test/scala => test}/helpers/RandomHelpers.scala | 0 core/{src/test/scala => test}/helpers/ServiceHelpers.scala | 0 core/{src/test/scala => test}/helpers/ValidatedTestHelpers.scala | 0 core/{src => }/test/resources/apibuilder-service.json | 0 core/{src => }/test/resources/apidoc/plugin.properties | 0 core/{src => }/test/resources/avro/circular.avsc | 0 core/{src => }/test/resources/avro/circular.json | 0 core/{src => }/test/resources/avro/example.avsc | 0 core/{src => }/test/resources/avro/example.json | 0 .../generators/play-2-json-spec-readers-quality-plan-writers.txt | 0 core/{src => }/test/resources/simple-w-array.json | 0 core/{src => }/test/resources/simple-without-array.json | 0 core/{src => }/test/resources/svc-iris-hub-0-0-1.json | 0 96 files changed, 0 insertions(+), 0 deletions(-) rename core/{src/main/scala => app}/core/DuplicateJsonParser.scala (100%) rename core/{src/main/scala => app}/core/Importer.scala (100%) rename core/{src/main/scala => app}/core/ServiceFetcher.scala (100%) rename core/{src/main/scala => app}/core/TypeValidator.scala (100%) rename core/{src/main/scala => app}/core/Util.scala (100%) rename core/{src/main/scala => app}/core/VersionMigration.scala (100%) rename core/{src/main/scala => app}/core/builder/DuplicateErrorMessage.scala (100%) rename core/{src/main/scala => app}/core/builder/JsonUtil.scala (100%) rename core/{src/main/scala => app}/core/builder/OriginalValidator.scala (100%) rename core/{src/main/scala => app}/core/builder/ServiceSpecValidator.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/ApiJsonServiceValidator.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/InternalApiJsonForm.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/InternalDatatype.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/ServiceBuilder.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/ServiceJsonServiceValidator.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/Types.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/templates/ArrayMerge.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/templates/AttributeMerge.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/templates/HeaderMerge.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/templates/JsMerge.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/templates/MapMerge.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/templates/ModelMerge.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/templates/OptionHelpers.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/templates/RenameTypes.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/templates/ResourceMerge.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/templates/TemplateMerge.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/upgrades/InterfacesToSupportResources.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/upgrades/RemoveApiDocElement.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/upgrades/ServiceParser.scala (100%) rename core/{src/main/scala => app}/core/builder/api_json/upgrades/Upgrader.scala (100%) rename core/{src/main/scala => app}/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala (100%) rename core/{src/test/scala => test}/core/ApiJsonStructureSpec.scala (100%) rename core/{src/test/scala => test}/core/BodyParameterSpec.scala (100%) rename core/{src/test/scala => test}/core/BrokenSpec.scala (100%) rename core/{src/test/scala => test}/core/DeprecationSpec.scala (100%) rename core/{src/test/scala => test}/core/DuplicateFieldValidatorSpec.scala (100%) rename core/{src/test/scala => test}/core/DuplicateNamesSpec.scala (100%) rename core/{src/test/scala => test}/core/EnumSpec.scala (100%) rename core/{src/test/scala => test}/core/FileServiceFetcher.scala (100%) rename core/{src/test/scala => test}/core/ImportServiceApiJsonSpec.scala (100%) rename core/{src/test/scala => test}/core/ImportServiceServiceJsonSpec.scala (100%) rename core/{src/test/scala => test}/core/ImportedResourcePathsSpec.scala (100%) rename core/{src/test/scala => test}/core/ImporterSpec.scala (100%) rename core/{src/test/scala => test}/core/InfoSpec.scala (100%) rename core/{src/test/scala => test}/core/InlineEnumInModelFieldsSpec.scala (100%) rename core/{src/test/scala => test}/core/InlineEnumsSpec.scala (100%) rename core/{src/test/scala => test}/core/InlineModelsSpec.scala (100%) rename core/{src/test/scala => test}/core/InlineUnionsSpec.scala (100%) rename core/{src/test/scala => test}/core/InterfaceImportsSpec.scala (100%) rename core/{src/test/scala => test}/core/InterfaceSpec.scala (100%) rename core/{src/test/scala => test}/core/MockServiceFetcher.scala (100%) rename core/{src/test/scala => test}/core/NestedUnionsSpec.scala (100%) rename core/{src/test/scala => test}/core/OriginalValidatorSpec.scala (100%) rename core/{src/test/scala => test}/core/ServiceAnnotationsSpec.scala (100%) rename core/{src/test/scala => test}/core/ServiceCommonReturnTypeSpec.scala (100%) rename core/{src/test/scala => test}/core/ServiceDefaultsSpec.scala (100%) rename core/{src/test/scala => test}/core/ServiceEnumSpec.scala (100%) rename core/{src/test/scala => test}/core/ServiceHeaderImportsSpec.scala (100%) rename core/{src/test/scala => test}/core/ServiceHeadersSpec.scala (100%) rename core/{src/test/scala => test}/core/ServiceInternalReferencesSpec.scala (100%) rename core/{src/test/scala => test}/core/ServiceMapSpec.scala (100%) rename core/{src/test/scala => test}/core/ServiceMethodsSpec.scala (100%) rename core/{src/test/scala => test}/core/ServiceParametersSpec.scala (100%) rename core/{src/test/scala => test}/core/ServicePathParametersSpec.scala (100%) rename core/{src/test/scala => test}/core/ServiceResourcesSpec.scala (100%) rename core/{src/test/scala => test}/core/ServiceResponsesSpec.scala (100%) rename core/{src/test/scala => test}/core/ServiceValidatorSpec.scala (100%) rename core/{src/test/scala => test}/core/SvcApiDocJsonSpec.scala (100%) rename core/{src/test/scala => test}/core/SvcIrisHubSpec.scala (100%) rename core/{src/test/scala => test}/core/TemplateSpec.scala (100%) rename core/{src/test/scala => test}/core/TestHelper.scala (100%) rename core/{src/test/scala => test}/core/TypeValidatorSpec.scala (100%) rename core/{src/test/scala => test}/core/UnionTypeDefaultSpec.scala (100%) rename core/{src/test/scala => test}/core/UnionTypeDiscriminatorValueSpec.scala (100%) rename core/{src/test/scala => test}/core/UnionTypeSpec.scala (100%) rename core/{src/test/scala => test}/core/UtilSpec.scala (100%) rename core/{src/test/scala => test}/core/builder/JsonUtilSpec.scala (100%) rename core/{src/test/scala => test}/core/builder/api_json/InternalDatatypeSpec.scala (100%) rename core/{src/test/scala => test}/core/builder/api_json/templates/ModelMergeSpec.scala (100%) rename core/{src/test/scala => test}/core/builder/api_json/templates/ResourceMergeSpec.scala (100%) rename core/{src/test/scala => test}/core/builder/api_json/upgrades/RemoveApiDocElementSpec.scala (100%) rename core/{src/test/scala => test}/core/builder/api_json/upgrades/ServiceParserSpec.scala (100%) rename core/{src/test/scala => test}/helpers/ApiJsonHelpers.scala (100%) rename core/{src/test/scala => test}/helpers/RandomHelpers.scala (100%) rename core/{src/test/scala => test}/helpers/ServiceHelpers.scala (100%) rename core/{src/test/scala => test}/helpers/ValidatedTestHelpers.scala (100%) rename core/{src => }/test/resources/apibuilder-service.json (100%) rename core/{src => }/test/resources/apidoc/plugin.properties (100%) rename core/{src => }/test/resources/avro/circular.avsc (100%) rename core/{src => }/test/resources/avro/circular.json (100%) rename core/{src => }/test/resources/avro/example.avsc (100%) rename core/{src => }/test/resources/avro/example.json (100%) rename core/{src => }/test/resources/generators/play-2-json-spec-readers-quality-plan-writers.txt (100%) rename core/{src => }/test/resources/simple-w-array.json (100%) rename core/{src => }/test/resources/simple-without-array.json (100%) rename core/{src => }/test/resources/svc-iris-hub-0-0-1.json (100%) diff --git a/core/src/main/scala/core/DuplicateJsonParser.scala b/core/app/core/DuplicateJsonParser.scala similarity index 100% rename from core/src/main/scala/core/DuplicateJsonParser.scala rename to core/app/core/DuplicateJsonParser.scala diff --git a/core/src/main/scala/core/Importer.scala b/core/app/core/Importer.scala similarity index 100% rename from core/src/main/scala/core/Importer.scala rename to core/app/core/Importer.scala diff --git a/core/src/main/scala/core/ServiceFetcher.scala b/core/app/core/ServiceFetcher.scala similarity index 100% rename from core/src/main/scala/core/ServiceFetcher.scala rename to core/app/core/ServiceFetcher.scala diff --git a/core/src/main/scala/core/TypeValidator.scala b/core/app/core/TypeValidator.scala similarity index 100% rename from core/src/main/scala/core/TypeValidator.scala rename to core/app/core/TypeValidator.scala diff --git a/core/src/main/scala/core/Util.scala b/core/app/core/Util.scala similarity index 100% rename from core/src/main/scala/core/Util.scala rename to core/app/core/Util.scala diff --git a/core/src/main/scala/core/VersionMigration.scala b/core/app/core/VersionMigration.scala similarity index 100% rename from core/src/main/scala/core/VersionMigration.scala rename to core/app/core/VersionMigration.scala diff --git a/core/src/main/scala/core/builder/DuplicateErrorMessage.scala b/core/app/core/builder/DuplicateErrorMessage.scala similarity index 100% rename from core/src/main/scala/core/builder/DuplicateErrorMessage.scala rename to core/app/core/builder/DuplicateErrorMessage.scala diff --git a/core/src/main/scala/core/builder/JsonUtil.scala b/core/app/core/builder/JsonUtil.scala similarity index 100% rename from core/src/main/scala/core/builder/JsonUtil.scala rename to core/app/core/builder/JsonUtil.scala diff --git a/core/src/main/scala/core/builder/OriginalValidator.scala b/core/app/core/builder/OriginalValidator.scala similarity index 100% rename from core/src/main/scala/core/builder/OriginalValidator.scala rename to core/app/core/builder/OriginalValidator.scala diff --git a/core/src/main/scala/core/builder/ServiceSpecValidator.scala b/core/app/core/builder/ServiceSpecValidator.scala similarity index 100% rename from core/src/main/scala/core/builder/ServiceSpecValidator.scala rename to core/app/core/builder/ServiceSpecValidator.scala diff --git a/core/src/main/scala/core/builder/api_json/ApiJsonServiceValidator.scala b/core/app/core/builder/api_json/ApiJsonServiceValidator.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/ApiJsonServiceValidator.scala rename to core/app/core/builder/api_json/ApiJsonServiceValidator.scala diff --git a/core/src/main/scala/core/builder/api_json/InternalApiJsonForm.scala b/core/app/core/builder/api_json/InternalApiJsonForm.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/InternalApiJsonForm.scala rename to core/app/core/builder/api_json/InternalApiJsonForm.scala diff --git a/core/src/main/scala/core/builder/api_json/InternalDatatype.scala b/core/app/core/builder/api_json/InternalDatatype.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/InternalDatatype.scala rename to core/app/core/builder/api_json/InternalDatatype.scala diff --git a/core/src/main/scala/core/builder/api_json/ServiceBuilder.scala b/core/app/core/builder/api_json/ServiceBuilder.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/ServiceBuilder.scala rename to core/app/core/builder/api_json/ServiceBuilder.scala diff --git a/core/src/main/scala/core/builder/api_json/ServiceJsonServiceValidator.scala b/core/app/core/builder/api_json/ServiceJsonServiceValidator.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/ServiceJsonServiceValidator.scala rename to core/app/core/builder/api_json/ServiceJsonServiceValidator.scala diff --git a/core/src/main/scala/core/builder/api_json/Types.scala b/core/app/core/builder/api_json/Types.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/Types.scala rename to core/app/core/builder/api_json/Types.scala diff --git a/core/src/main/scala/core/builder/api_json/templates/ArrayMerge.scala b/core/app/core/builder/api_json/templates/ArrayMerge.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/templates/ArrayMerge.scala rename to core/app/core/builder/api_json/templates/ArrayMerge.scala diff --git a/core/src/main/scala/core/builder/api_json/templates/AttributeMerge.scala b/core/app/core/builder/api_json/templates/AttributeMerge.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/templates/AttributeMerge.scala rename to core/app/core/builder/api_json/templates/AttributeMerge.scala diff --git a/core/src/main/scala/core/builder/api_json/templates/HeaderMerge.scala b/core/app/core/builder/api_json/templates/HeaderMerge.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/templates/HeaderMerge.scala rename to core/app/core/builder/api_json/templates/HeaderMerge.scala diff --git a/core/src/main/scala/core/builder/api_json/templates/JsMerge.scala b/core/app/core/builder/api_json/templates/JsMerge.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/templates/JsMerge.scala rename to core/app/core/builder/api_json/templates/JsMerge.scala diff --git a/core/src/main/scala/core/builder/api_json/templates/MapMerge.scala b/core/app/core/builder/api_json/templates/MapMerge.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/templates/MapMerge.scala rename to core/app/core/builder/api_json/templates/MapMerge.scala diff --git a/core/src/main/scala/core/builder/api_json/templates/ModelMerge.scala b/core/app/core/builder/api_json/templates/ModelMerge.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/templates/ModelMerge.scala rename to core/app/core/builder/api_json/templates/ModelMerge.scala diff --git a/core/src/main/scala/core/builder/api_json/templates/OptionHelpers.scala b/core/app/core/builder/api_json/templates/OptionHelpers.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/templates/OptionHelpers.scala rename to core/app/core/builder/api_json/templates/OptionHelpers.scala diff --git a/core/src/main/scala/core/builder/api_json/templates/RenameTypes.scala b/core/app/core/builder/api_json/templates/RenameTypes.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/templates/RenameTypes.scala rename to core/app/core/builder/api_json/templates/RenameTypes.scala diff --git a/core/src/main/scala/core/builder/api_json/templates/ResourceMerge.scala b/core/app/core/builder/api_json/templates/ResourceMerge.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/templates/ResourceMerge.scala rename to core/app/core/builder/api_json/templates/ResourceMerge.scala diff --git a/core/src/main/scala/core/builder/api_json/templates/TemplateMerge.scala b/core/app/core/builder/api_json/templates/TemplateMerge.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/templates/TemplateMerge.scala rename to core/app/core/builder/api_json/templates/TemplateMerge.scala diff --git a/core/src/main/scala/core/builder/api_json/upgrades/InterfacesToSupportResources.scala b/core/app/core/builder/api_json/upgrades/InterfacesToSupportResources.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/upgrades/InterfacesToSupportResources.scala rename to core/app/core/builder/api_json/upgrades/InterfacesToSupportResources.scala diff --git a/core/src/main/scala/core/builder/api_json/upgrades/RemoveApiDocElement.scala b/core/app/core/builder/api_json/upgrades/RemoveApiDocElement.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/upgrades/RemoveApiDocElement.scala rename to core/app/core/builder/api_json/upgrades/RemoveApiDocElement.scala diff --git a/core/src/main/scala/core/builder/api_json/upgrades/ServiceParser.scala b/core/app/core/builder/api_json/upgrades/ServiceParser.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/upgrades/ServiceParser.scala rename to core/app/core/builder/api_json/upgrades/ServiceParser.scala diff --git a/core/src/main/scala/core/builder/api_json/upgrades/Upgrader.scala b/core/app/core/builder/api_json/upgrades/Upgrader.scala similarity index 100% rename from core/src/main/scala/core/builder/api_json/upgrades/Upgrader.scala rename to core/app/core/builder/api_json/upgrades/Upgrader.scala diff --git a/core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala b/core/app/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala similarity index 100% rename from core/src/main/scala/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala rename to core/app/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala diff --git a/core/src/test/scala/core/ApiJsonStructureSpec.scala b/core/test/core/ApiJsonStructureSpec.scala similarity index 100% rename from core/src/test/scala/core/ApiJsonStructureSpec.scala rename to core/test/core/ApiJsonStructureSpec.scala diff --git a/core/src/test/scala/core/BodyParameterSpec.scala b/core/test/core/BodyParameterSpec.scala similarity index 100% rename from core/src/test/scala/core/BodyParameterSpec.scala rename to core/test/core/BodyParameterSpec.scala diff --git a/core/src/test/scala/core/BrokenSpec.scala b/core/test/core/BrokenSpec.scala similarity index 100% rename from core/src/test/scala/core/BrokenSpec.scala rename to core/test/core/BrokenSpec.scala diff --git a/core/src/test/scala/core/DeprecationSpec.scala b/core/test/core/DeprecationSpec.scala similarity index 100% rename from core/src/test/scala/core/DeprecationSpec.scala rename to core/test/core/DeprecationSpec.scala diff --git a/core/src/test/scala/core/DuplicateFieldValidatorSpec.scala b/core/test/core/DuplicateFieldValidatorSpec.scala similarity index 100% rename from core/src/test/scala/core/DuplicateFieldValidatorSpec.scala rename to core/test/core/DuplicateFieldValidatorSpec.scala diff --git a/core/src/test/scala/core/DuplicateNamesSpec.scala b/core/test/core/DuplicateNamesSpec.scala similarity index 100% rename from core/src/test/scala/core/DuplicateNamesSpec.scala rename to core/test/core/DuplicateNamesSpec.scala diff --git a/core/src/test/scala/core/EnumSpec.scala b/core/test/core/EnumSpec.scala similarity index 100% rename from core/src/test/scala/core/EnumSpec.scala rename to core/test/core/EnumSpec.scala diff --git a/core/src/test/scala/core/FileServiceFetcher.scala b/core/test/core/FileServiceFetcher.scala similarity index 100% rename from core/src/test/scala/core/FileServiceFetcher.scala rename to core/test/core/FileServiceFetcher.scala diff --git a/core/src/test/scala/core/ImportServiceApiJsonSpec.scala b/core/test/core/ImportServiceApiJsonSpec.scala similarity index 100% rename from core/src/test/scala/core/ImportServiceApiJsonSpec.scala rename to core/test/core/ImportServiceApiJsonSpec.scala diff --git a/core/src/test/scala/core/ImportServiceServiceJsonSpec.scala b/core/test/core/ImportServiceServiceJsonSpec.scala similarity index 100% rename from core/src/test/scala/core/ImportServiceServiceJsonSpec.scala rename to core/test/core/ImportServiceServiceJsonSpec.scala diff --git a/core/src/test/scala/core/ImportedResourcePathsSpec.scala b/core/test/core/ImportedResourcePathsSpec.scala similarity index 100% rename from core/src/test/scala/core/ImportedResourcePathsSpec.scala rename to core/test/core/ImportedResourcePathsSpec.scala diff --git a/core/src/test/scala/core/ImporterSpec.scala b/core/test/core/ImporterSpec.scala similarity index 100% rename from core/src/test/scala/core/ImporterSpec.scala rename to core/test/core/ImporterSpec.scala diff --git a/core/src/test/scala/core/InfoSpec.scala b/core/test/core/InfoSpec.scala similarity index 100% rename from core/src/test/scala/core/InfoSpec.scala rename to core/test/core/InfoSpec.scala diff --git a/core/src/test/scala/core/InlineEnumInModelFieldsSpec.scala b/core/test/core/InlineEnumInModelFieldsSpec.scala similarity index 100% rename from core/src/test/scala/core/InlineEnumInModelFieldsSpec.scala rename to core/test/core/InlineEnumInModelFieldsSpec.scala diff --git a/core/src/test/scala/core/InlineEnumsSpec.scala b/core/test/core/InlineEnumsSpec.scala similarity index 100% rename from core/src/test/scala/core/InlineEnumsSpec.scala rename to core/test/core/InlineEnumsSpec.scala diff --git a/core/src/test/scala/core/InlineModelsSpec.scala b/core/test/core/InlineModelsSpec.scala similarity index 100% rename from core/src/test/scala/core/InlineModelsSpec.scala rename to core/test/core/InlineModelsSpec.scala diff --git a/core/src/test/scala/core/InlineUnionsSpec.scala b/core/test/core/InlineUnionsSpec.scala similarity index 100% rename from core/src/test/scala/core/InlineUnionsSpec.scala rename to core/test/core/InlineUnionsSpec.scala diff --git a/core/src/test/scala/core/InterfaceImportsSpec.scala b/core/test/core/InterfaceImportsSpec.scala similarity index 100% rename from core/src/test/scala/core/InterfaceImportsSpec.scala rename to core/test/core/InterfaceImportsSpec.scala diff --git a/core/src/test/scala/core/InterfaceSpec.scala b/core/test/core/InterfaceSpec.scala similarity index 100% rename from core/src/test/scala/core/InterfaceSpec.scala rename to core/test/core/InterfaceSpec.scala diff --git a/core/src/test/scala/core/MockServiceFetcher.scala b/core/test/core/MockServiceFetcher.scala similarity index 100% rename from core/src/test/scala/core/MockServiceFetcher.scala rename to core/test/core/MockServiceFetcher.scala diff --git a/core/src/test/scala/core/NestedUnionsSpec.scala b/core/test/core/NestedUnionsSpec.scala similarity index 100% rename from core/src/test/scala/core/NestedUnionsSpec.scala rename to core/test/core/NestedUnionsSpec.scala diff --git a/core/src/test/scala/core/OriginalValidatorSpec.scala b/core/test/core/OriginalValidatorSpec.scala similarity index 100% rename from core/src/test/scala/core/OriginalValidatorSpec.scala rename to core/test/core/OriginalValidatorSpec.scala diff --git a/core/src/test/scala/core/ServiceAnnotationsSpec.scala b/core/test/core/ServiceAnnotationsSpec.scala similarity index 100% rename from core/src/test/scala/core/ServiceAnnotationsSpec.scala rename to core/test/core/ServiceAnnotationsSpec.scala diff --git a/core/src/test/scala/core/ServiceCommonReturnTypeSpec.scala b/core/test/core/ServiceCommonReturnTypeSpec.scala similarity index 100% rename from core/src/test/scala/core/ServiceCommonReturnTypeSpec.scala rename to core/test/core/ServiceCommonReturnTypeSpec.scala diff --git a/core/src/test/scala/core/ServiceDefaultsSpec.scala b/core/test/core/ServiceDefaultsSpec.scala similarity index 100% rename from core/src/test/scala/core/ServiceDefaultsSpec.scala rename to core/test/core/ServiceDefaultsSpec.scala diff --git a/core/src/test/scala/core/ServiceEnumSpec.scala b/core/test/core/ServiceEnumSpec.scala similarity index 100% rename from core/src/test/scala/core/ServiceEnumSpec.scala rename to core/test/core/ServiceEnumSpec.scala diff --git a/core/src/test/scala/core/ServiceHeaderImportsSpec.scala b/core/test/core/ServiceHeaderImportsSpec.scala similarity index 100% rename from core/src/test/scala/core/ServiceHeaderImportsSpec.scala rename to core/test/core/ServiceHeaderImportsSpec.scala diff --git a/core/src/test/scala/core/ServiceHeadersSpec.scala b/core/test/core/ServiceHeadersSpec.scala similarity index 100% rename from core/src/test/scala/core/ServiceHeadersSpec.scala rename to core/test/core/ServiceHeadersSpec.scala diff --git a/core/src/test/scala/core/ServiceInternalReferencesSpec.scala b/core/test/core/ServiceInternalReferencesSpec.scala similarity index 100% rename from core/src/test/scala/core/ServiceInternalReferencesSpec.scala rename to core/test/core/ServiceInternalReferencesSpec.scala diff --git a/core/src/test/scala/core/ServiceMapSpec.scala b/core/test/core/ServiceMapSpec.scala similarity index 100% rename from core/src/test/scala/core/ServiceMapSpec.scala rename to core/test/core/ServiceMapSpec.scala diff --git a/core/src/test/scala/core/ServiceMethodsSpec.scala b/core/test/core/ServiceMethodsSpec.scala similarity index 100% rename from core/src/test/scala/core/ServiceMethodsSpec.scala rename to core/test/core/ServiceMethodsSpec.scala diff --git a/core/src/test/scala/core/ServiceParametersSpec.scala b/core/test/core/ServiceParametersSpec.scala similarity index 100% rename from core/src/test/scala/core/ServiceParametersSpec.scala rename to core/test/core/ServiceParametersSpec.scala diff --git a/core/src/test/scala/core/ServicePathParametersSpec.scala b/core/test/core/ServicePathParametersSpec.scala similarity index 100% rename from core/src/test/scala/core/ServicePathParametersSpec.scala rename to core/test/core/ServicePathParametersSpec.scala diff --git a/core/src/test/scala/core/ServiceResourcesSpec.scala b/core/test/core/ServiceResourcesSpec.scala similarity index 100% rename from core/src/test/scala/core/ServiceResourcesSpec.scala rename to core/test/core/ServiceResourcesSpec.scala diff --git a/core/src/test/scala/core/ServiceResponsesSpec.scala b/core/test/core/ServiceResponsesSpec.scala similarity index 100% rename from core/src/test/scala/core/ServiceResponsesSpec.scala rename to core/test/core/ServiceResponsesSpec.scala diff --git a/core/src/test/scala/core/ServiceValidatorSpec.scala b/core/test/core/ServiceValidatorSpec.scala similarity index 100% rename from core/src/test/scala/core/ServiceValidatorSpec.scala rename to core/test/core/ServiceValidatorSpec.scala diff --git a/core/src/test/scala/core/SvcApiDocJsonSpec.scala b/core/test/core/SvcApiDocJsonSpec.scala similarity index 100% rename from core/src/test/scala/core/SvcApiDocJsonSpec.scala rename to core/test/core/SvcApiDocJsonSpec.scala diff --git a/core/src/test/scala/core/SvcIrisHubSpec.scala b/core/test/core/SvcIrisHubSpec.scala similarity index 100% rename from core/src/test/scala/core/SvcIrisHubSpec.scala rename to core/test/core/SvcIrisHubSpec.scala diff --git a/core/src/test/scala/core/TemplateSpec.scala b/core/test/core/TemplateSpec.scala similarity index 100% rename from core/src/test/scala/core/TemplateSpec.scala rename to core/test/core/TemplateSpec.scala diff --git a/core/src/test/scala/core/TestHelper.scala b/core/test/core/TestHelper.scala similarity index 100% rename from core/src/test/scala/core/TestHelper.scala rename to core/test/core/TestHelper.scala diff --git a/core/src/test/scala/core/TypeValidatorSpec.scala b/core/test/core/TypeValidatorSpec.scala similarity index 100% rename from core/src/test/scala/core/TypeValidatorSpec.scala rename to core/test/core/TypeValidatorSpec.scala diff --git a/core/src/test/scala/core/UnionTypeDefaultSpec.scala b/core/test/core/UnionTypeDefaultSpec.scala similarity index 100% rename from core/src/test/scala/core/UnionTypeDefaultSpec.scala rename to core/test/core/UnionTypeDefaultSpec.scala diff --git a/core/src/test/scala/core/UnionTypeDiscriminatorValueSpec.scala b/core/test/core/UnionTypeDiscriminatorValueSpec.scala similarity index 100% rename from core/src/test/scala/core/UnionTypeDiscriminatorValueSpec.scala rename to core/test/core/UnionTypeDiscriminatorValueSpec.scala diff --git a/core/src/test/scala/core/UnionTypeSpec.scala b/core/test/core/UnionTypeSpec.scala similarity index 100% rename from core/src/test/scala/core/UnionTypeSpec.scala rename to core/test/core/UnionTypeSpec.scala diff --git a/core/src/test/scala/core/UtilSpec.scala b/core/test/core/UtilSpec.scala similarity index 100% rename from core/src/test/scala/core/UtilSpec.scala rename to core/test/core/UtilSpec.scala diff --git a/core/src/test/scala/core/builder/JsonUtilSpec.scala b/core/test/core/builder/JsonUtilSpec.scala similarity index 100% rename from core/src/test/scala/core/builder/JsonUtilSpec.scala rename to core/test/core/builder/JsonUtilSpec.scala diff --git a/core/src/test/scala/core/builder/api_json/InternalDatatypeSpec.scala b/core/test/core/builder/api_json/InternalDatatypeSpec.scala similarity index 100% rename from core/src/test/scala/core/builder/api_json/InternalDatatypeSpec.scala rename to core/test/core/builder/api_json/InternalDatatypeSpec.scala diff --git a/core/src/test/scala/core/builder/api_json/templates/ModelMergeSpec.scala b/core/test/core/builder/api_json/templates/ModelMergeSpec.scala similarity index 100% rename from core/src/test/scala/core/builder/api_json/templates/ModelMergeSpec.scala rename to core/test/core/builder/api_json/templates/ModelMergeSpec.scala diff --git a/core/src/test/scala/core/builder/api_json/templates/ResourceMergeSpec.scala b/core/test/core/builder/api_json/templates/ResourceMergeSpec.scala similarity index 100% rename from core/src/test/scala/core/builder/api_json/templates/ResourceMergeSpec.scala rename to core/test/core/builder/api_json/templates/ResourceMergeSpec.scala diff --git a/core/src/test/scala/core/builder/api_json/upgrades/RemoveApiDocElementSpec.scala b/core/test/core/builder/api_json/upgrades/RemoveApiDocElementSpec.scala similarity index 100% rename from core/src/test/scala/core/builder/api_json/upgrades/RemoveApiDocElementSpec.scala rename to core/test/core/builder/api_json/upgrades/RemoveApiDocElementSpec.scala diff --git a/core/src/test/scala/core/builder/api_json/upgrades/ServiceParserSpec.scala b/core/test/core/builder/api_json/upgrades/ServiceParserSpec.scala similarity index 100% rename from core/src/test/scala/core/builder/api_json/upgrades/ServiceParserSpec.scala rename to core/test/core/builder/api_json/upgrades/ServiceParserSpec.scala diff --git a/core/src/test/scala/helpers/ApiJsonHelpers.scala b/core/test/helpers/ApiJsonHelpers.scala similarity index 100% rename from core/src/test/scala/helpers/ApiJsonHelpers.scala rename to core/test/helpers/ApiJsonHelpers.scala diff --git a/core/src/test/scala/helpers/RandomHelpers.scala b/core/test/helpers/RandomHelpers.scala similarity index 100% rename from core/src/test/scala/helpers/RandomHelpers.scala rename to core/test/helpers/RandomHelpers.scala diff --git a/core/src/test/scala/helpers/ServiceHelpers.scala b/core/test/helpers/ServiceHelpers.scala similarity index 100% rename from core/src/test/scala/helpers/ServiceHelpers.scala rename to core/test/helpers/ServiceHelpers.scala diff --git a/core/src/test/scala/helpers/ValidatedTestHelpers.scala b/core/test/helpers/ValidatedTestHelpers.scala similarity index 100% rename from core/src/test/scala/helpers/ValidatedTestHelpers.scala rename to core/test/helpers/ValidatedTestHelpers.scala diff --git a/core/src/test/resources/apibuilder-service.json b/core/test/resources/apibuilder-service.json similarity index 100% rename from core/src/test/resources/apibuilder-service.json rename to core/test/resources/apibuilder-service.json diff --git a/core/src/test/resources/apidoc/plugin.properties b/core/test/resources/apidoc/plugin.properties similarity index 100% rename from core/src/test/resources/apidoc/plugin.properties rename to core/test/resources/apidoc/plugin.properties diff --git a/core/src/test/resources/avro/circular.avsc b/core/test/resources/avro/circular.avsc similarity index 100% rename from core/src/test/resources/avro/circular.avsc rename to core/test/resources/avro/circular.avsc diff --git a/core/src/test/resources/avro/circular.json b/core/test/resources/avro/circular.json similarity index 100% rename from core/src/test/resources/avro/circular.json rename to core/test/resources/avro/circular.json diff --git a/core/src/test/resources/avro/example.avsc b/core/test/resources/avro/example.avsc similarity index 100% rename from core/src/test/resources/avro/example.avsc rename to core/test/resources/avro/example.avsc diff --git a/core/src/test/resources/avro/example.json b/core/test/resources/avro/example.json similarity index 100% rename from core/src/test/resources/avro/example.json rename to core/test/resources/avro/example.json diff --git a/core/src/test/resources/generators/play-2-json-spec-readers-quality-plan-writers.txt b/core/test/resources/generators/play-2-json-spec-readers-quality-plan-writers.txt similarity index 100% rename from core/src/test/resources/generators/play-2-json-spec-readers-quality-plan-writers.txt rename to core/test/resources/generators/play-2-json-spec-readers-quality-plan-writers.txt diff --git a/core/src/test/resources/simple-w-array.json b/core/test/resources/simple-w-array.json similarity index 100% rename from core/src/test/resources/simple-w-array.json rename to core/test/resources/simple-w-array.json diff --git a/core/src/test/resources/simple-without-array.json b/core/test/resources/simple-without-array.json similarity index 100% rename from core/src/test/resources/simple-without-array.json rename to core/test/resources/simple-without-array.json diff --git a/core/src/test/resources/svc-iris-hub-0-0-1.json b/core/test/resources/svc-iris-hub-0-0-1.json similarity index 100% rename from core/src/test/resources/svc-iris-hub-0-0-1.json rename to core/test/resources/svc-iris-hub-0-0-1.json From 3e4510f6391ae8904254824728eac51ecaa9f40b Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:05:56 -0400 Subject: [PATCH 44/95] wip --- build.sbt | 7 +++++ core/app/core/TypeValidator.scala | 14 +++++----- .../core/builder/ServiceSpecValidator.scala | 28 +++++++++---------- .../api_json/ApiJsonServiceValidator.scala | 4 +-- .../api_json/InternalApiJsonForm.scala | 2 +- .../builder/api_json/ServiceBuilder.scala | 12 ++++---- 6 files changed, 37 insertions(+), 30 deletions(-) diff --git a/build.sbt b/build.sbt index 4290f2bd2..f463bdf87 100644 --- a/build.sbt +++ b/build.sbt @@ -68,6 +68,13 @@ lazy val core = project .dependsOn(generated, lib) .aggregate(generated, lib) .settings(commonSettings*) + .settings( + libraryDependencies ++= Seq( + "io.circe" %% "circe-core" % circeVersion, + "io.circe" %% "circe-generic" % circeVersion, + "io.circe" %% "circe-parser" % circeVersion + ), + ) lazy val generated = project .in(file("generated")) diff --git a/core/app/core/TypeValidator.scala b/core/app/core/TypeValidator.scala index 5866f1fbb..caf5a0ec5 100644 --- a/core/app/core/TypeValidator.scala +++ b/core/app/core/TypeValidator.scala @@ -102,12 +102,12 @@ object TypesProvider { case class FromService(service: Service) extends TypesProvider { - override def enums: Iterable[TypesProviderEnum] = service.enums.map { enum => + override def enums: Iterable[TypesProviderEnum] = service.enums.map { e => TypesProviderEnum( namespace = service.namespace, - name = enum.name, - plural = enum.plural, - values = enum.values.map(_.name) + name = e.name, + plural = e.plural, + values = e.values.map(_.name) ) } @@ -237,13 +237,13 @@ case class TypeValidator( None } - case Some(enum) => { - enum.values.find(_ == value) match { + case Some(e) => { + e.values.find(_ == value) match { case None => { Some( withPrefix( errorPrefix, - s"default[$value] is not a valid value for enum[$name]. Valid values are: " + enum.values.mkString(", ") + s"default[$value] is not a valid value for enum[$name]. Valid values are: " + e.values.mkString(", ") ) ) } diff --git a/core/app/core/builder/ServiceSpecValidator.scala b/core/app/core/builder/ServiceSpecValidator.scala index 321146e4d..8d90cda03 100644 --- a/core/app/core/builder/ServiceSpecValidator.scala +++ b/core/app/core/builder/ServiceSpecValidator.scala @@ -19,8 +19,8 @@ case class ServiceSpecValidator( private val typeResolver = DatatypeResolver( enumNames = localTypeResolver.enumNames ++ service.imports.flatMap { service => - service.enums.map { enum => - s"${service.namespace}.enums.$enum" + service.enums.map { e => + s"${service.namespace}.enums.$e" } }, @@ -150,7 +150,7 @@ case class ServiceSpecValidator( ) } - def validateField(prefix: String, field: Field): ValidatedNec[String, Unit] = { + private def validateField(prefix: String, field: Field): ValidatedNec[String, Unit] = { sequenceUnique( Seq( validateName(s"$prefix name", field.name), @@ -226,8 +226,8 @@ case class ServiceSpecValidator( private def validateEnumNames(): ValidatedNec[String, Unit] = { sequenceUnique( - service.enums.map { enum => - validateName(s"Enum[${enum.name}] name", enum.name) + service.enums.map { e => + validateName(s"Enum[${e.name}] name", e.name) } ++ Seq( DuplicateErrorMessage.validate("Enum", service.enums.map(_.name)) ) @@ -235,12 +235,12 @@ case class ServiceSpecValidator( } private def validateEnumValues(): ValidatedNec[String, Unit] = { sequenceUnique ( - service.enums.filter(_.name.nonEmpty).flatMap { enum => - (if (enum.values.isEmpty) { - Seq(s"Enum[${enum.name}] must have at least one value".invalidNec) + service.enums.filter(_.name.nonEmpty).flatMap { e => + (if (e.values.isEmpty) { + Seq(s"Enum[${e.name}] must have at least one value".invalidNec) } else { - enum.values.map { value => - validateName(s"Enum[${enum.name}] name[${value.name}]", value.name) + e.values.map { value => + validateName(s"Enum[${e.name}] name[${value.name}]", value.name) } }) ++ Seq(validateEnumValuesUniqueness()) } @@ -249,11 +249,11 @@ case class ServiceSpecValidator( private def validateEnumValuesUniqueness(): ValidatedNec[String, Unit] = { sequenceUnique( - service.enums.map { enum => - DuplicateErrorMessage.validate(s"Enum[${enum.name}] value", enum.values.map(_.name)) - } ++ service.enums.map { enum => + service.enums.map { e => + DuplicateErrorMessage.validate(s"Enum[${e.name}] value", e.values.map(_.name)) + } ++ service.enums.map { e => // Check uniqueness of the serialization values - DuplicateErrorMessage.validate(s"Enum[${enum.name}] value", enum.values.map { ev => ev.value.getOrElse(ev.name) }) + DuplicateErrorMessage.validate(s"Enum[${e.name}] value", e.values.map { ev => ev.value.getOrElse(ev.name) }) } ) } diff --git a/core/app/core/builder/api_json/ApiJsonServiceValidator.scala b/core/app/core/builder/api_json/ApiJsonServiceValidator.scala index e4b4d8f39..1557e6c89 100644 --- a/core/app/core/builder/api_json/ApiJsonServiceValidator.scala +++ b/core/app/core/builder/api_json/ApiJsonServiceValidator.scala @@ -155,8 +155,8 @@ case class ApiJsonServiceValidator( private def validateEnums(enums: Seq[InternalEnumForm]): ValidatedNec[String, Unit] = { sequenceUnique( - enums.map(_.warnings) ++ enums.map { enum => - validateAttributes(s"Enum[${enum.name}]", enum.attributes) + enums.map(_.warnings) ++ enums.map { e => + validateAttributes(s"Enum[${e.name}]", e.attributes) } ++ enums.map(validateEnumValues) ) } diff --git a/core/app/core/builder/api_json/InternalApiJsonForm.scala b/core/app/core/builder/api_json/InternalApiJsonForm.scala index 291c3894b..8cf9ca4f6 100644 --- a/core/app/core/builder/api_json/InternalApiJsonForm.scala +++ b/core/app/core/builder/api_json/InternalApiJsonForm.scala @@ -664,7 +664,7 @@ object InternalResourceForm extends ValidatedHelpers { } case None => { enums.find(e => e.name == typeName) match { - case Some(enum) => Some("/" + enum.plural) + case Some(e) => Some("/" + e.plural) case None => { models.find(m => m.name == typeName) match { case Some(model) => Some("/" + model.plural) diff --git a/core/app/core/builder/api_json/ServiceBuilder.scala b/core/app/core/builder/api_json/ServiceBuilder.scala index 690c74b45..57c660df6 100644 --- a/core/app/core/builder/api_json/ServiceBuilder.scala +++ b/core/app/core/builder/api_json/ServiceBuilder.scala @@ -95,8 +95,8 @@ case class ServiceBuilder( name: String ): Resolution = { resolver.enums.find(o => o.name == name || o.fullName == name) match { - case Some(enum) => { - Resolution(enum = Some(enum)) + case Some(e) => { + Resolution(e = Some(e)) } case None => { resolver.models.find(o => o.name == name || o.fullName == name) match { @@ -124,12 +124,12 @@ case class ServiceBuilder( ): Resource = { val resolution = resolve(resolver.provider, internal.datatype.name) - resolution.enum match { - case Some(enum) => { - val resourcePath = internal.path.getOrElse("/" + enum.plural) + resolution.e match { + case Some(e) => { + val resourcePath = internal.path.getOrElse("/" + e.plural) Resource( `type` = internal.datatype.label, - plural = enum.plural, + plural = e.plural, path = Some(resourcePath), description = internal.description, deprecation = internal.deprecation.map(DeprecationBuilder(_)), From 709ab458779481c8a96838963104dd9ebb5651f0 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:07:43 -0400 Subject: [PATCH 45/95] wip --- build.sbt | 4 ++-- core/app/core/builder/api_json/Types.scala | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index f463bdf87..8e3d40c94 100644 --- a/build.sbt +++ b/build.sbt @@ -65,8 +65,8 @@ val circeVersion = "0.14.9" lazy val core = project .in(file("core")) .enablePlugins(PlayScala) - .dependsOn(generated, lib) - .aggregate(generated, lib) + .dependsOn(generated, lib, avro, swagger) + .aggregate(generated, lib, avro, swagger) .settings(commonSettings*) .settings( libraryDependencies ++= Seq( diff --git a/core/app/core/builder/api_json/Types.scala b/core/app/core/builder/api_json/Types.scala index b964cc40c..37dd19c4b 100644 --- a/core/app/core/builder/api_json/Types.scala +++ b/core/app/core/builder/api_json/Types.scala @@ -6,12 +6,12 @@ import lib.Kind private[api_json] case class InternalApiJsonFormTypesProvider(internal: InternalApiJsonForm) extends TypesProvider { - override def enums: Seq[TypesProviderEnum] = internal.enums.map { enum => + override def enums: Seq[TypesProviderEnum] = internal.enums.map { e => TypesProviderEnum( namespace = internal.namespace.getOrElse(""), - name = enum.name, - plural = enum.plural, - values = enum.values.flatMap(_.name) + name = e.name, + plural = e.plural, + values = e.values.flatMap(_.name) ) } From 2c1a149a82380565e77d794c6a626448b274fe18 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:12:34 -0400 Subject: [PATCH 46/95] wip --- .../scala/io/apibuilder/avro/ParserSpec.scala | 6 +- .../builder/api_json/ServiceBuilder.scala | 4 +- core/app/core/builder/api_json/Types.scala | 2 +- core/test/core/InlineUnionsSpec.scala | 4 +- core/test/core/NestedUnionsSpec.scala | 66 +++++++++---------- core/test/core/ServiceValidatorSpec.scala | 2 +- core/test/core/UnionTypeSpec.scala | 2 +- .../api_json/templates/ModelMergeSpec.scala | 2 +- .../swagger/translators/Field.scala | 2 +- .../swagger/translators/Operation.scala | 2 +- .../swagger/SwaggerServiceValidatorSpec.scala | 2 +- 11 files changed, 46 insertions(+), 48 deletions(-) diff --git a/avro/src/test/scala/io/apibuilder/avro/ParserSpec.scala b/avro/src/test/scala/io/apibuilder/avro/ParserSpec.scala index cb44805a5..45f132fb4 100644 --- a/avro/src/test/scala/io/apibuilder/avro/ParserSpec.scala +++ b/avro/src/test/scala/io/apibuilder/avro/ParserSpec.scala @@ -26,9 +26,9 @@ class ParserSpec extends AnyFunSpec with Matchers { println("namespace: " + service.namespace) println("Enums:") - service.enums.foreach { enum => - println(s" - ${enum.name}") - enum.values.foreach { value => + service.enums.foreach { e => + println(s" - ${e.name}") + e.values.foreach { value => println(s" - ${value.name}") } } diff --git a/core/app/core/builder/api_json/ServiceBuilder.scala b/core/app/core/builder/api_json/ServiceBuilder.scala index 57c660df6..5177e0adc 100644 --- a/core/app/core/builder/api_json/ServiceBuilder.scala +++ b/core/app/core/builder/api_json/ServiceBuilder.scala @@ -96,7 +96,7 @@ case class ServiceBuilder( ): Resolution = { resolver.enums.find(o => o.name == name || o.fullName == name) match { case Some(e) => { - Resolution(e = Some(e)) + Resolution(`enum` = Some(e)) } case None => { resolver.models.find(o => o.name == name || o.fullName == name) match { @@ -124,7 +124,7 @@ case class ServiceBuilder( ): Resource = { val resolution = resolve(resolver.provider, internal.datatype.name) - resolution.e match { + resolution.`enum` match { case Some(e) => { val resourcePath = internal.path.getOrElse("/" + e.plural) Resource( diff --git a/core/app/core/builder/api_json/Types.scala b/core/app/core/builder/api_json/Types.scala index 37dd19c4b..7fff4dd4a 100644 --- a/core/app/core/builder/api_json/Types.scala +++ b/core/app/core/builder/api_json/Types.scala @@ -21,7 +21,7 @@ private[api_json] case class InternalApiJsonFormTypesProvider(internal: Internal name = u.name, plural = u.plural, types = u.types.flatMap { t => - t.datatype.toOption.map(_.name).map(core.TypesProviderUnionType) + t.datatype.toOption.map(_.name).map(core.TypesProviderUnionType(_)) } ) } diff --git a/core/test/core/InlineUnionsSpec.scala b/core/test/core/InlineUnionsSpec.scala index 6ef3f00ae..2c3a68174 100644 --- a/core/test/core/InlineUnionsSpec.scala +++ b/core/test/core/InlineUnionsSpec.scala @@ -6,9 +6,7 @@ import org.scalatest.matchers.should.Matchers class InlineUnionsSpec extends AnyFunSpec with Matchers with ApiJsonHelpers { - - - it("union types support inline models") { + it("union types support inline models") { val json = """ { diff --git a/core/test/core/NestedUnionsSpec.scala b/core/test/core/NestedUnionsSpec.scala index 47f673495..3beb1cf04 100644 --- a/core/test/core/NestedUnionsSpec.scala +++ b/core/test/core/NestedUnionsSpec.scala @@ -7,45 +7,45 @@ import org.scalatest.matchers.should.Matchers class NestedUnionsSpec extends AnyFunSpec with Matchers with ApiJsonHelpers { - it("validates discriminator values are unique") { - def setup( - userDiscriminatorValue: String, - guestDiscriminatorValue: String, - abstractUserDiscriminatorValue: Option[String], - ) = { - val service = makeApiJson( - models = Map( - "user" -> makeModelWithField(), - "guest" -> makeModelWithField(), + it("validates discriminator values are unique") { + def setup( + userDiscriminatorValue: String, + guestDiscriminatorValue: String, + abstractUserDiscriminatorValue: Option[String], + ) = { + val service = makeApiJson( + models = Map( + "user" -> makeModelWithField(), + "guest" -> makeModelWithField(), + ), + unions = Map( + "abstract_user" -> makeUnion( + types = Seq(makeUnionType("user", discriminatorValue = Some(userDiscriminatorValue))) ), - unions = Map( - "abstract_user" -> makeUnion( - types = Seq(makeUnionType("user", discriminatorValue = Some(userDiscriminatorValue))) - ), - "abstract_guest" -> makeUnion( - types = Seq(makeUnionType("guest", discriminatorValue = Some(guestDiscriminatorValue))) - ), - "party" -> makeUnion( - types = Seq( - makeUnionType("abstract_user", discriminatorValue = abstractUserDiscriminatorValue), - makeUnionType("abstract_guest"), - ) + "abstract_guest" -> makeUnion( + types = Seq(makeUnionType("guest", discriminatorValue = Some(guestDiscriminatorValue))) + ), + "party" -> makeUnion( + types = Seq( + makeUnionType("abstract_user", discriminatorValue = abstractUserDiscriminatorValue), + makeUnionType("abstract_guest"), ) ) ) - TestHelper.serviceValidator(service) match { - case Invalid(e) => e.toNonEmptyList.toList - case Valid(_) => Nil - } + ) + TestHelper.serviceValidator(service) match { + case Invalid(e) => e.toNonEmptyList.toList + case Valid(_) => Nil } + } - setup("user", "guest", None) shouldBe Nil - setup("user", "user", None) shouldBe Seq( - "Union[party] discriminator value[user] appears more than once" - ) - setup("user", "guest", Some("user")) shouldBe Seq( - "Union[party] discriminator value[user] appears more than once" - ) + setup("user", "guest", None) shouldBe Nil + setup("user", "user", None) shouldBe Seq( + "Union[party] discriminator value[user] appears more than once" + ) + setup("user", "guest", Some("user")) shouldBe Seq( + "Union[party] discriminator value[user] appears more than once" + ) } it("share a common discriminator") { diff --git a/core/test/core/ServiceValidatorSpec.scala b/core/test/core/ServiceValidatorSpec.scala index 8daf55eb1..ebb02bc1f 100644 --- a/core/test/core/ServiceValidatorSpec.scala +++ b/core/test/core/ServiceValidatorSpec.scala @@ -484,7 +484,7 @@ class ServiceValidatorSpec extends AnyFunSpec with Matchers with helpers.ApiJson } it("resources with duplicate plural names are NOT allowed") { - val json = + val json = """ { "name": "API Builder", diff --git a/core/test/core/UnionTypeSpec.scala b/core/test/core/UnionTypeSpec.scala index a6d00aa1a..2051c909d 100644 --- a/core/test/core/UnionTypeSpec.scala +++ b/core/test/core/UnionTypeSpec.scala @@ -7,7 +7,7 @@ import org.scalatest.matchers.should.Matchers class UnionTypeSpec extends AnyFunSpec with Matchers with ApiJsonHelpers { - private val baseJson = """ + private val baseJson = """ { "name": "Union Types Test", diff --git a/core/test/core/builder/api_json/templates/ModelMergeSpec.scala b/core/test/core/builder/api_json/templates/ModelMergeSpec.scala index 1cbb42b22..25f30e136 100644 --- a/core/test/core/builder/api_json/templates/ModelMergeSpec.scala +++ b/core/test/core/builder/api_json/templates/ModelMergeSpec.scala @@ -158,7 +158,7 @@ class ModelMergeSpec extends AnyWordSpec with Matchers with ApiJsonHelpers { val field = makeField(default = None) setupFields( templateField = field.copy(default = Some(JsString("foo"))), - modelField = field.copy(default = modelFieldDefault.map(JsString)), + modelField = field.copy(default = modelFieldDefault.map(JsString(_))), ).head.default.get } diff --git a/swagger/src/main/scala/io/apibuilder/swagger/translators/Field.scala b/swagger/src/main/scala/io/apibuilder/swagger/translators/Field.scala index a94942dc3..f4acea92c 100644 --- a/swagger/src/main/scala/io/apibuilder/swagger/translators/Field.scala +++ b/swagger/src/main/scala/io/apibuilder/swagger/translators/Field.scala @@ -54,7 +54,7 @@ object Field { base.copy( description = Option(p.getUniqueItems()).getOrElse(false) match { case true => Util.combine(Seq(base.description, Some(s"Note: items are unique"))) - case false => base.description + case _ => base.description } ) } diff --git a/swagger/src/main/scala/io/apibuilder/swagger/translators/Operation.scala b/swagger/src/main/scala/io/apibuilder/swagger/translators/Operation.scala index 9d9145328..6d3b6f519 100644 --- a/swagger/src/main/scala/io/apibuilder/swagger/translators/Operation.scala +++ b/swagger/src/main/scala/io/apibuilder/swagger/translators/Operation.scala @@ -44,7 +44,7 @@ object Operation { description = Util.combine(Seq(summary, description, ExternalDoc(Option(op.getExternalDocs)))), deprecation = Option(op.isDeprecated).getOrElse(false) match { case false => None - case true => Some(apidoc.Deprecation()) + case _ => Some(apidoc.Deprecation()) }, body = bodies.toList match { case Nil => None diff --git a/swagger/src/test/scala/io/apibuilder/swagger/SwaggerServiceValidatorSpec.scala b/swagger/src/test/scala/io/apibuilder/swagger/SwaggerServiceValidatorSpec.scala index 9bd4f4e7e..e3c059508 100644 --- a/swagger/src/test/scala/io/apibuilder/swagger/SwaggerServiceValidatorSpec.scala +++ b/swagger/src/test/scala/io/apibuilder/swagger/SwaggerServiceValidatorSpec.scala @@ -915,7 +915,7 @@ class SwaggerServiceValidatorSpec extends AnyFunSpec with Matchers with Validate filename => val path = resourcesDir + filename println(s"Reading file[$path]") - validate(path) match { + validate(path) match { case Invalid(errors) => { fail(s"Service validation failed for path[$path]: " + formatErrors(errors)) } From 66eae1fa587b5f3f4184ab170327c993996775de Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:13:34 -0400 Subject: [PATCH 47/95] wip --- core/test/helpers/ValidatedTestHelpers.scala | 4 ++-- lib/src/test/scala/helpers/ValidatedTestHelpers.scala | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/test/helpers/ValidatedTestHelpers.scala b/core/test/helpers/ValidatedTestHelpers.scala index 90697e64d..db6a2069e 100644 --- a/core/test/helpers/ValidatedTestHelpers.scala +++ b/core/test/helpers/ValidatedTestHelpers.scala @@ -5,14 +5,14 @@ import cats.data.ValidatedNec trait ValidatedTestHelpers { - def expectValid[T](r: ValidatedNec[?, T]): T = { + def expectValid[T, U](r: ValidatedNec[T, U]): U = { r match { case Valid(o) => o case Invalid(errors) => sys.error(s"Expected valid but was invalid: ${errors.toNonEmptyList}") } } - def expectInvalid[T](r: ValidatedNec[T, ?]): Seq[T] = { + def expectInvalid[T, U](r: ValidatedNec[T, U]): Seq[T] = { r match { case Valid(_) => sys.error("Expected invalid but was valid") case Invalid(errors) => errors.toNonEmptyList.toList diff --git a/lib/src/test/scala/helpers/ValidatedTestHelpers.scala b/lib/src/test/scala/helpers/ValidatedTestHelpers.scala index e30d6ebbf..d36b700c5 100644 --- a/lib/src/test/scala/helpers/ValidatedTestHelpers.scala +++ b/lib/src/test/scala/helpers/ValidatedTestHelpers.scala @@ -12,7 +12,7 @@ trait ValidatedTestHelpers { } } - def expectInvalid[T](r: ValidatedNec[T, ?]): Seq[T] = { + def expectInvalid[T, U](r: ValidatedNec[T, U]): Seq[T] = { r match { case Valid(_) => sys.error("Expected invalid but was valid") case Invalid(errors) => errors.toNonEmptyList.toList From ad1a4e7315c744013eb8e9bcddde0b5befb940de Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:19:40 -0400 Subject: [PATCH 48/95] wip --- core/test/core/OriginalValidatorSpec.scala | 4 ++-- core/test/core/SvcIrisHubSpec.scala | 2 +- core/test/core/TestHelper.scala | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/test/core/OriginalValidatorSpec.scala b/core/test/core/OriginalValidatorSpec.scala index 3d7938416..a5a597cbe 100644 --- a/core/test/core/OriginalValidatorSpec.scala +++ b/core/test/core/OriginalValidatorSpec.scala @@ -32,7 +32,7 @@ class OriginalValidatorSpec it("should validate valid swagger json with parameter of type array") { val filename = "simple-w-array.json" - val path = s"core/src/test/resources/$filename" + val path = s"test/resources/$filename" expectValid { validator.validate(readFile(path)) } @@ -40,7 +40,7 @@ class OriginalValidatorSpec it("should validate valid swagger json without parameter of type array") { val filename = "simple-without-array.json" - val path = s"core/src/test/resources/$filename" + val path = s"test/resources/$filename" expectValid { validator.validate(readFile(path)) } diff --git a/core/test/core/SvcIrisHubSpec.scala b/core/test/core/SvcIrisHubSpec.scala index 84386d4df..af87d8e49 100644 --- a/core/test/core/SvcIrisHubSpec.scala +++ b/core/test/core/SvcIrisHubSpec.scala @@ -10,7 +10,7 @@ import org.scalatest.matchers.should.Matchers class SvcIrisHubSpec extends AnyFunSpec with Matchers with ValidatedHelpers with ValidatedTestHelpers { private val Filenames: Seq[String] = Seq("svc-iris-hub-0-0-1.json") - private val Dir: String = "core/src/test/resources" + private val Dir: String = "core/test/resources" it("should parse valid json") { Filenames.foreach { name => diff --git a/core/test/core/TestHelper.scala b/core/test/core/TestHelper.scala index 24c53cca1..7ccdaad54 100644 --- a/core/test/core/TestHelper.scala +++ b/core/test/core/TestHelper.scala @@ -118,11 +118,11 @@ object TestHelper extends ValidatedHelpers with ValidatedTestHelpers { Files.write(outputPath, bytes) } - def readFile(path: String): String = FileUtils.readToString(new File(path)) + def readFile(path: String): String = FileUtils.readToString(new File("../" + path)) def parseFile(filename: String): ValidatedNec[String, Service] = { val fetcher = MockServiceFetcher() - if (filename == "spec/apibuilder-api.json") { + if (filename.indexOf("spec/apibuilder-api.json")>=0) { Seq(io.apibuilder.spec.v0.Constants.Version, "latest").foreach { version => fetcher.add(s"/apibuilder-spec/$version/service.json", specService) fetcher.add(s"http://app.apibuilder.io/apicollective/apibuilder-common/$version/service.json", commonService) From ce81f569732d5918116c310ab09f966aa322d2bc Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:23:30 -0400 Subject: [PATCH 49/95] wip --- .../GeneratorApibuilderSessionsDao.scala | 238 ++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 api/app/db/generated/GeneratorApibuilderSessionsDao.scala diff --git a/api/app/db/generated/GeneratorApibuilderSessionsDao.scala b/api/app/db/generated/GeneratorApibuilderSessionsDao.scala new file mode 100644 index 000000000..f6b90ff46 --- /dev/null +++ b/api/app/db/generated/GeneratorApibuilderSessionsDao.scala @@ -0,0 +1,238 @@ +package db.generated + +import anorm._ +import db.DbHelpers +import io.flow.postgresql.{OrderBy, Query} +import java.sql.Connection +import java.util.UUID +import javax.inject.{Inject, Singleton} +import org.joda.time.DateTime +import play.api.db.{Database, NamedDatabase} + +case class Session( + id: String, + userGuid: UUID, + expiresAt: DateTime, + createdAt: DateTime, + createdByGuid: UUID, + updatedAt: DateTime, + updatedByGuid: UUID, + deletedAt: Option[DateTime], + deletedByGuid: Option[UUID] +) { + + lazy val form: SessionForm = SessionForm( + id = id, + userGuid = userGuid, + expiresAt = expiresAt, + createdAt = createdAt, + createdByGuid = createdByGuid, + updatedAt = updatedAt, + updatedByGuid = updatedByGuid, + deletedAt = deletedAt, + deletedByGuid = deletedByGuid + ) + +} + +case class SessionForm( + id: String, + userGuid: UUID, + expiresAt: DateTime, + createdAt: DateTime, + createdByGuid: UUID, + updatedAt: DateTime, + updatedByGuid: UUID, + deletedAt: Option[DateTime], + deletedByGuid: Option[UUID] +) + +@Singleton +class SessionsDao @Inject() ( + @NamedDatabase("default") db: Database +) { + + private val dbHelpers = DbHelpers(db, "sessions") + + private val BaseQuery = Query(""" + | select sessions.id, + | sessions.user_guid, + | sessions.expires_at, + | sessions.created_at, + | sessions.created_by_guid, + | sessions.updated_at, + | sessions.updated_by_guid, + | sessions.deleted_at, + | sessions.deleted_by_guid, + | sessions.hash_code + | from sessions + """.stripMargin) + + private val InsertQuery = Query(""" + | insert into sessions + | (id, user_guid, expires_at, created_at, created_by_guid, updated_at, updated_by_guid, deleted_at, deleted_by_guid, hash_code) + | values + | ({id}, {user_guid}::uuid, {expires_at}::timestamptz, {created_at}::timestamptz, {created_by_guid}::uuid, {updated_at}::timestamptz, {updated_by_guid}::uuid, {deleted_at}::timestamptz, {deleted_by_guid}::uuid, {hash_code}::bigint) + """.stripMargin) + + private val UpdateQuery = Query(""" + | update sessions + | set user_guid = {user_guid}::uuid, + | expires_at = {expires_at}::timestamptz, + | created_at = {created_at}::timestamptz, + | created_by_guid = {created_by_guid}::uuid, + | updated_at = {updated_at}::timestamptz, + | updated_by_guid = {updated_by_guid}::uuid, + | deleted_at = {deleted_at}::timestamptz, + | deleted_by_guid = {deleted_by_guid}::uuid, + | hash_code = {hash_code}::bigint + | where id = {id} + | and (sessions.hash_code is null or sessions.hash_code != {hash_code}::bigint) + """.stripMargin) + + private def bindQuery(query: Query, form: SessionForm): Query = { + query. + bind("user_guid", form.userGuid). + bind("expires_at", form.expiresAt). + bind("created_at", form.createdAt). + bind("created_by_guid", form.createdByGuid). + bind("updated_at", form.updatedAt). + bind("updated_by_guid", form.updatedByGuid). + bind("deleted_at", form.deletedAt). + bind("deleted_by_guid", form.deletedByGuid). + bind("hash_code", form.hashCode()) + } + + def insert(updatedBy: UUID, form: SessionForm): Unit = { + db.withConnection { implicit c => + insert(c, updatedBy, form) + } + } + + def insert(implicit c: Connection, updatedBy: UUID, form: SessionForm): Unit = { + bindQuery(InsertQuery, form). + bind("id", form.id). + anormSql().execute() + } + + def updateIfChangedById(updatedBy: UUID, id: String, form: SessionForm): Unit ={ + if (!findById(id).map(_.form).contains(form)) { + updateById(updatedBy, id, form) + } + } + + def updateById(updatedBy: UUID, id: String, form: SessionForm): Unit = { + db.withConnection { implicit c => + updateById(c, updatedBy, id, form) + } + } + + def updateById(implicit c: Connection, updatedBy: UUID, id: String, form: SessionForm): Unit = { + bindQuery(UpdateQuery, form). + bind("id", id). + anormSql().execute() + } + + def update(updatedBy: UUID, existing: Session, form: SessionForm): Unit = { + db.withConnection { implicit c => + update(c, updatedBy, existing, form) + } + } + + def update(implicit c: Connection, updatedBy: UUID, existing: Session, form: SessionForm): Unit = { + updateById(c, updatedBy, existing.id, form) + } + + def delete(deletedBy: UUID, session: Session): Unit = { + dbHelpers.delete(deletedBy, session.id) + } + + def deleteById(deletedBy: UUID, id: String): Unit = { + db.withConnection { implicit c => + deleteById(c, deletedBy, id) + } + } + + def deleteById(c: java.sql.Connection, deletedBy: UUID, id: String): Unit = { + dbHelpers.delete(c, deletedBy, id) + } + + def findById(id: String): Option[Session] = { + db.withConnection { implicit c => + findByIdWithConnection(c, id) + } + } + + def findByIdWithConnection(c: java.sql.Connection, id: String): Option[Session] = { + findAllWithConnection(c, ids = Some(Seq(id)), limit = 1).headOption + } + + def findAll( + ids: Option[Seq[String]] = None, + userGuid: Option[UUID] = None, + limit: Long, + offset: Long = 0, + orderBy: OrderBy = OrderBy("sessions.id") + ) ( + implicit customQueryModifier: Query => Query = { q => q } + ): Seq[Session] = { + db.withConnection { implicit c => + findAllWithConnection( + c, + ids = ids, + userGuid = userGuid, + limit = limit, + offset = offset, + orderBy = orderBy + )(customQueryModifier) + } + } + + def findAllWithConnection( + c: java.sql.Connection, + ids: Option[Seq[String]] = None, + userGuid: Option[UUID] = None, + limit: Long, + offset: Long = 0, + orderBy: OrderBy = OrderBy("sessions.id") + ) ( + implicit customQueryModifier: Query => Query = { q => q } + ): Seq[Session] = { + customQueryModifier(BaseQuery). + optionalIn("sessions.id", ids). + equals("sessions.user_guid", userGuid). + limit(limit). + offset(offset). + orderBy(orderBy.sql). + as(SessionsDao.parser().*)(c) + } + +} + +object SessionsDao { + + def parser(): RowParser[Session] = { + SqlParser.str("id") ~ + SqlParser.get[UUID]("user_guid") ~ + SqlParser.get[DateTime]("expires_at") ~ + SqlParser.get[DateTime]("created_at") ~ + SqlParser.get[UUID]("created_by_guid") ~ + SqlParser.get[DateTime]("updated_at") ~ + SqlParser.get[UUID]("updated_by_guid") ~ + SqlParser.get[DateTime]("deleted_at").? ~ + SqlParser.get[UUID]("deleted_by_guid").? map { + case id ~ userGuid ~ expiresAt ~ createdAt ~ createdByGuid ~ updatedAt ~ updatedByGuid ~ deletedAt ~ deletedByGuid => Session( + id = id, + userGuid = userGuid, + expiresAt = expiresAt, + createdAt = createdAt, + createdByGuid = createdByGuid, + updatedAt = updatedAt, + updatedByGuid = updatedByGuid, + deletedAt = deletedAt, + deletedByGuid = deletedByGuid + ) + } + } + +} \ No newline at end of file From 27f388f5304b6da6a13fe68bb9dae1e7ce716cec Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:24:14 -0400 Subject: [PATCH 50/95] wip --- .apibuilder/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.apibuilder/config b/.apibuilder/config index 4c44d2a65..877d90e12 100644 --- a/.apibuilder/config +++ b/.apibuilder/config @@ -9,7 +9,7 @@ code: apibuilder-api-json: version: latest generators: - play_2_x_scala_3_json: core/src/main/scala/core/generated + play_2_x_scala_3_json: core/app/core/generated apibuilder-spec: version: latest generators: From 600cf13a442baa6b050027f30fc702f01ddcf17b Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:25:47 -0400 Subject: [PATCH 51/95] wip --- .../ApicollectiveApibuilderApiV0Conversions.scala | 11 ----------- .../ApicollectiveApibuilderCommonV0Conversions.scala | 11 ----------- ...picollectiveApibuilderGeneratorV0Conversions.scala | 11 ----------- .../ApicollectiveApibuilderSpecV0Conversions.scala | 11 ----------- 4 files changed, 44 deletions(-) diff --git a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala index 17cf18c4a..c537be518 100644 --- a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala @@ -57,17 +57,6 @@ package io.apibuilder.api.v0.anorm.conversions { object Standard { implicit val columnToJsObject: Column[play.api.libs.json.JsObject] = Util.parser { _.as[play.api.libs.json.JsObject] } implicit val columnToJsValue: Column[play.api.libs.json.JsValue] = Util.parser { _.as[play.api.libs.json.JsValue] } - implicit val columnToSeqBoolean: Column[Seq[Boolean]] = Util.parser { _.as[Seq[Boolean]] } - implicit val columnToSeqDouble: Column[Seq[Double]] = Util.parser { _.as[Seq[Double]] } - implicit val columnToSeqInt: Column[Seq[Int]] = Util.parser { _.as[Seq[Int]] } - implicit val columnToSeqLong: Column[Seq[Long]] = Util.parser { _.as[Seq[Long]] } - implicit val columnToSeqLocalDate: Column[Seq[_root_.org.joda.time.LocalDate]] = Util.parser { _.as[Seq[_root_.org.joda.time.LocalDate]] } - implicit val columnToSeqDateTime: Column[Seq[_root_.org.joda.time.DateTime]] = Util.parser { _.as[Seq[_root_.org.joda.time.DateTime]] } - implicit val columnToSeqBigDecimal: Column[Seq[BigDecimal]] = Util.parser { _.as[Seq[BigDecimal]] } - implicit val columnToSeqJsObject: Column[Seq[_root_.play.api.libs.json.JsObject]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsObject]] } - implicit val columnToSeqJsValue: Column[Seq[_root_.play.api.libs.json.JsValue]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsValue]] } - implicit val columnToSeqString: Column[Seq[String]] = Util.parser { _.as[Seq[String]] } - implicit val columnToSeqUUID: Column[Seq[_root_.java.util.UUID]] = Util.parser { _.as[Seq[_root_.java.util.UUID]] } } } \ No newline at end of file diff --git a/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala index 28932bba9..72d3d606d 100644 --- a/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala @@ -57,17 +57,6 @@ package io.apibuilder.common.v0.anorm.conversions { object Standard { implicit val columnToJsObject: Column[play.api.libs.json.JsObject] = Util.parser { _.as[play.api.libs.json.JsObject] } implicit val columnToJsValue: Column[play.api.libs.json.JsValue] = Util.parser { _.as[play.api.libs.json.JsValue] } - implicit val columnToSeqBoolean: Column[Seq[Boolean]] = Util.parser { _.as[Seq[Boolean]] } - implicit val columnToSeqDouble: Column[Seq[Double]] = Util.parser { _.as[Seq[Double]] } - implicit val columnToSeqInt: Column[Seq[Int]] = Util.parser { _.as[Seq[Int]] } - implicit val columnToSeqLong: Column[Seq[Long]] = Util.parser { _.as[Seq[Long]] } - implicit val columnToSeqLocalDate: Column[Seq[_root_.org.joda.time.LocalDate]] = Util.parser { _.as[Seq[_root_.org.joda.time.LocalDate]] } - implicit val columnToSeqDateTime: Column[Seq[_root_.org.joda.time.DateTime]] = Util.parser { _.as[Seq[_root_.org.joda.time.DateTime]] } - implicit val columnToSeqBigDecimal: Column[Seq[BigDecimal]] = Util.parser { _.as[Seq[BigDecimal]] } - implicit val columnToSeqJsObject: Column[Seq[_root_.play.api.libs.json.JsObject]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsObject]] } - implicit val columnToSeqJsValue: Column[Seq[_root_.play.api.libs.json.JsValue]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsValue]] } - implicit val columnToSeqString: Column[Seq[String]] = Util.parser { _.as[Seq[String]] } - implicit val columnToSeqUUID: Column[Seq[_root_.java.util.UUID]] = Util.parser { _.as[Seq[_root_.java.util.UUID]] } } } \ No newline at end of file diff --git a/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala index 12df32ce3..0477d6c6a 100644 --- a/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala @@ -57,17 +57,6 @@ package io.apibuilder.generator.v0.anorm.conversions { object Standard { implicit val columnToJsObject: Column[play.api.libs.json.JsObject] = Util.parser { _.as[play.api.libs.json.JsObject] } implicit val columnToJsValue: Column[play.api.libs.json.JsValue] = Util.parser { _.as[play.api.libs.json.JsValue] } - implicit val columnToSeqBoolean: Column[Seq[Boolean]] = Util.parser { _.as[Seq[Boolean]] } - implicit val columnToSeqDouble: Column[Seq[Double]] = Util.parser { _.as[Seq[Double]] } - implicit val columnToSeqInt: Column[Seq[Int]] = Util.parser { _.as[Seq[Int]] } - implicit val columnToSeqLong: Column[Seq[Long]] = Util.parser { _.as[Seq[Long]] } - implicit val columnToSeqLocalDate: Column[Seq[_root_.org.joda.time.LocalDate]] = Util.parser { _.as[Seq[_root_.org.joda.time.LocalDate]] } - implicit val columnToSeqDateTime: Column[Seq[_root_.org.joda.time.DateTime]] = Util.parser { _.as[Seq[_root_.org.joda.time.DateTime]] } - implicit val columnToSeqBigDecimal: Column[Seq[BigDecimal]] = Util.parser { _.as[Seq[BigDecimal]] } - implicit val columnToSeqJsObject: Column[Seq[_root_.play.api.libs.json.JsObject]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsObject]] } - implicit val columnToSeqJsValue: Column[Seq[_root_.play.api.libs.json.JsValue]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsValue]] } - implicit val columnToSeqString: Column[Seq[String]] = Util.parser { _.as[Seq[String]] } - implicit val columnToSeqUUID: Column[Seq[_root_.java.util.UUID]] = Util.parser { _.as[Seq[_root_.java.util.UUID]] } } } \ No newline at end of file diff --git a/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala index 2b5b78459..65a190826 100644 --- a/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala @@ -57,17 +57,6 @@ package io.apibuilder.spec.v0.anorm.conversions { object Standard { implicit val columnToJsObject: Column[play.api.libs.json.JsObject] = Util.parser { _.as[play.api.libs.json.JsObject] } implicit val columnToJsValue: Column[play.api.libs.json.JsValue] = Util.parser { _.as[play.api.libs.json.JsValue] } - implicit val columnToSeqBoolean: Column[Seq[Boolean]] = Util.parser { _.as[Seq[Boolean]] } - implicit val columnToSeqDouble: Column[Seq[Double]] = Util.parser { _.as[Seq[Double]] } - implicit val columnToSeqInt: Column[Seq[Int]] = Util.parser { _.as[Seq[Int]] } - implicit val columnToSeqLong: Column[Seq[Long]] = Util.parser { _.as[Seq[Long]] } - implicit val columnToSeqLocalDate: Column[Seq[_root_.org.joda.time.LocalDate]] = Util.parser { _.as[Seq[_root_.org.joda.time.LocalDate]] } - implicit val columnToSeqDateTime: Column[Seq[_root_.org.joda.time.DateTime]] = Util.parser { _.as[Seq[_root_.org.joda.time.DateTime]] } - implicit val columnToSeqBigDecimal: Column[Seq[BigDecimal]] = Util.parser { _.as[Seq[BigDecimal]] } - implicit val columnToSeqJsObject: Column[Seq[_root_.play.api.libs.json.JsObject]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsObject]] } - implicit val columnToSeqJsValue: Column[Seq[_root_.play.api.libs.json.JsValue]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsValue]] } - implicit val columnToSeqString: Column[Seq[String]] = Util.parser { _.as[Seq[String]] } - implicit val columnToSeqUUID: Column[Seq[_root_.java.util.UUID]] = Util.parser { _.as[Seq[_root_.java.util.UUID]] } } } \ No newline at end of file From 13c190d6e8d8a6f6c353365745578e8fd4e7ade6 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:27:12 -0400 Subject: [PATCH 52/95] wip --- api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala | 1 - .../generated/ApicollectiveApibuilderCommonV0Conversions.scala | 1 - .../ApicollectiveApibuilderGeneratorV0Conversions.scala | 1 - api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala | 1 - 4 files changed, 4 deletions(-) diff --git a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala index c537be518..ef6503d8c 100644 --- a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala @@ -55,7 +55,6 @@ package io.apibuilder.api.v0.anorm.conversions { } object Standard { - implicit val columnToJsObject: Column[play.api.libs.json.JsObject] = Util.parser { _.as[play.api.libs.json.JsObject] } implicit val columnToJsValue: Column[play.api.libs.json.JsValue] = Util.parser { _.as[play.api.libs.json.JsValue] } } diff --git a/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala index 72d3d606d..8a0734152 100644 --- a/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala @@ -55,7 +55,6 @@ package io.apibuilder.common.v0.anorm.conversions { } object Standard { - implicit val columnToJsObject: Column[play.api.libs.json.JsObject] = Util.parser { _.as[play.api.libs.json.JsObject] } implicit val columnToJsValue: Column[play.api.libs.json.JsValue] = Util.parser { _.as[play.api.libs.json.JsValue] } } diff --git a/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala index 0477d6c6a..ef3b8ae36 100644 --- a/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala @@ -55,7 +55,6 @@ package io.apibuilder.generator.v0.anorm.conversions { } object Standard { - implicit val columnToJsObject: Column[play.api.libs.json.JsObject] = Util.parser { _.as[play.api.libs.json.JsObject] } implicit val columnToJsValue: Column[play.api.libs.json.JsValue] = Util.parser { _.as[play.api.libs.json.JsValue] } } diff --git a/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala index 65a190826..289feda2a 100644 --- a/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala @@ -55,7 +55,6 @@ package io.apibuilder.spec.v0.anorm.conversions { } object Standard { - implicit val columnToJsObject: Column[play.api.libs.json.JsObject] = Util.parser { _.as[play.api.libs.json.JsObject] } implicit val columnToJsValue: Column[play.api.libs.json.JsValue] = Util.parser { _.as[play.api.libs.json.JsValue] } } From d91e0f5806812442bbdf52ae4eea3b9d580a5770 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:28:59 -0400 Subject: [PATCH 53/95] wip --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 8e3d40c94..62d8dbeee 100644 --- a/build.sbt +++ b/build.sbt @@ -111,6 +111,7 @@ lazy val api = project filters, jdbc, ws, + "com.typesafe.play" %% "play-guice" % "2.9.4", "com.google.inject" % "guice" % "5.1.0", "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0", "org.projectlombok" % "lombok" % "1.18.32" % "provided", From 6db26ddee5859a150a5b56d60dc8fae3a5410ffe Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:30:24 -0400 Subject: [PATCH 54/95] wip --- .../controllers/ApiBuilderController.scala | 16 +++++++------- api/app/controllers/Applications.scala | 4 ++-- api/app/controllers/Attributes.scala | 2 +- api/app/controllers/Code.scala | 22 +++++++++---------- api/app/controllers/Domains.scala | 2 +- api/app/controllers/GeneratorServices.scala | 2 +- api/app/controllers/Healthchecks.scala | 2 +- api/app/controllers/MembershipRequests.scala | 8 +++---- api/app/controllers/Memberships.scala | 6 ++--- api/app/controllers/Organizations.scala | 10 ++++----- api/app/controllers/Subscriptions.scala | 6 ++--- api/app/controllers/Tokens.scala | 6 ++--- api/app/controllers/Users.scala | 14 ++++++------ api/app/controllers/Validations.scala | 2 +- api/app/controllers/Versions.scala | 14 ++++++------ api/app/controllers/Watches.scala | 8 +++---- 16 files changed, 62 insertions(+), 62 deletions(-) diff --git a/api/app/controllers/ApiBuilderController.scala b/api/app/controllers/ApiBuilderController.scala index 1d601509e..46eddc75a 100644 --- a/api/app/controllers/ApiBuilderController.scala +++ b/api/app/controllers/ApiBuilderController.scala @@ -12,12 +12,12 @@ import play.api.mvc._ import scala.concurrent.{ExecutionContext, Future} -/** - * Main trait for controllers to implement. - * Extends the play base controller to wire up authentication to include: - * - anonymous / api key / session based access - * - utilities to check for organization role - */ +/Parameter[_][this]Parameter[_][this] + Parameter[_][this] Main trait for controllers to implement. + Parameter[_][this] Extends the play base controller to wire up authentication to include: + Parameter[_][this] - anonymous / api key / session based access + Parameter[_][this] - utilities to check for organization role + Parameter[_][this]/ trait ApiBuilderController extends BaseController { protected def apiBuilderControllerComponents: ApiBuilderControllerComponents @@ -58,7 +58,7 @@ trait ApiBuilderController extends BaseController { } } - private def withRole(org: Organization, user: User, roles: Seq[MembershipRole])(f: => Result): Result = { + Parameter[_] def withRole(org: Organization, user: User, roles: Seq[MembershipRole])(f: => Result): Result = { val actualRoles = membershipsDao.findByOrganizationAndUserAndRoles( Authorization.All, org, user, roles ).map(_.role) @@ -77,7 +77,7 @@ trait ApiBuilderController extends BaseController { } } - private def jsonError(message: String): JsValue = { + Parameter[_] def jsonError(message: String): JsValue = { Json.toJson( Validation.error( message diff --git a/api/app/controllers/Applications.scala b/api/app/controllers/Applications.scala index a2dcff356..ae77d3a04 100644 --- a/api/app/controllers/Applications.scala +++ b/api/app/controllers/Applications.scala @@ -27,7 +27,7 @@ class Applications @Inject() ( offset: Long = 0, sorting: Option[AppSortBy], ordering: Option[SortOrder] - ) = Identified { request => + ) = Identified.async {: _* request => val applications = applicationsDao.findAll( request.authorization, orgKey = Some(orgKey), @@ -92,7 +92,7 @@ class Applications @Inject() ( } } - def deleteByApplicationKey(orgKey: String, applicationKey: String) = Identified { request => + def deleteByApplicationKey(orgKey: String, applicationKey: String) = Identified.async {: _* request => withOrgMember(request.user, orgKey) { _ => applicationsDao.findByOrganizationKeyAndApplicationKey(request.authorization, orgKey, applicationKey).foreach { application => applicationsDao.softDelete(request.user, application) diff --git a/api/app/controllers/Attributes.scala b/api/app/controllers/Attributes.scala index 2c020f502..d86ba9e47 100644 --- a/api/app/controllers/Attributes.scala +++ b/api/app/controllers/Attributes.scala @@ -57,7 +57,7 @@ class Attributes @Inject() ( } } - def deleteByName(name: String) = Identified { request => + def deleteByName(name: String) = Identified.async {: _* request => attributesDao.findByName(name) match { case None => { NotFound diff --git a/api/app/controllers/Code.scala b/api/app/controllers/Code.scala index 4ed0e6e89..32e3fccb4 100644 --- a/api/app/controllers/Code.scala +++ b/api/app/controllers/Code.scala @@ -66,7 +66,7 @@ class Code @Inject() ( } } - private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global + Parameter[_] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def getByGeneratorKey( orgKey: String, @@ -131,8 +131,8 @@ class Code @Inject() ( } @nowarn - private def _invoke( - request: AnonymousRequest[?], + Parameter[_] def _invoke( + request: AnonymousFuture[_], params: CodeParams, data: InvocationFormData, generatorKey: String @@ -151,7 +151,7 @@ class Code @Inject() ( // TODO: Should we merge the org attributes into the provided invocation form? I think that // was the original intent, but not sure if it would impact anybody. For now going to log // the instance for which this results in a change. - /* + /Parameter[_][this] val updatedAttributes = orgAttributeUtil.merge(data.version.organization, gws.generator.attributes, data.invocationForm.attributes) if (updatedAttributes != data.invocationForm.attributes) { val newAttributes = updatedAttributes.filterNot { a => @@ -161,7 +161,7 @@ class Code @Inject() ( } else { println(s"Code.orgAttributes org[${data.version.organization.key}] newAttributes: NONE") } - */ + Parameter[_][this]/ recordInvocation(params, gws.generator.key) @@ -188,8 +188,8 @@ class Code @Inject() ( } } - private def invocationForm[T]( - request: AnonymousRequest[?], + Parameter[_] def invocationForm[T]( + request: AnonymousFuture[_], params: CodeParams ): Either[Seq[String], InvocationFormData] = { versionsDao.findVersion(request.authorization, params.orgKey, params.applicationKey, params.versionName) match { @@ -211,22 +211,22 @@ class Code @Inject() ( } } - private def withCodeForm(body: JsValue)(f: CodeForm => Future[Result]) = { + Parameter[_] def withCodeForm(body: JsValue)(f: CodeForm => Future[Result]) = { body.validate[CodeForm] match { case e: JsError => Future.successful(Conflict(Json.toJson(Validation.invalidJson(e)))) case s: JsSuccess[CodeForm] => f(s.get) } } - private def conflict(message: String): Result = { + Parameter[_] def conflict(message: String): Result = { conflict(Seq(message)) } - private def conflict(messages: Seq[String]): Result = { + Parameter[_] def conflict(messages: Seq[String]): Result = { Conflict(Json.toJson(Validation.errors(messages))) } - private def recordInvocation(params: CodeParams, generatorKey: String): Unit = { + Parameter[_] def recordInvocation(params: CodeParams, generatorKey: String): Unit = { generatorInvocationsDao.insert(Constants.DefaultUserGuid, GeneratorInvocationForm( key = generatorKey, organizationKey = Some(params.orgKey), diff --git a/api/app/controllers/Domains.scala b/api/app/controllers/Domains.scala index 1b4fc185d..3a9576f9b 100644 --- a/api/app/controllers/Domains.scala +++ b/api/app/controllers/Domains.scala @@ -40,7 +40,7 @@ class Domains @Inject() ( } } - def deleteByName(orgKey: String, name: String) = Identified { request => + def deleteByName(orgKey: String, name: String) = Identified.async {: _* request => withOrgAdmin(request.user, orgKey) { org => org.domains.find(_.name == name).foreach { domain => organizationDomainsDao.findAll(organizationGuid = Some(org.guid), domain = Some(domain.name)).foreach { orgDomain => diff --git a/api/app/controllers/GeneratorServices.scala b/api/app/controllers/GeneratorServices.scala index 6441c1289..95f1c21f5 100644 --- a/api/app/controllers/GeneratorServices.scala +++ b/api/app/controllers/GeneratorServices.scala @@ -78,7 +78,7 @@ class GeneratorServices @Inject() ( def deleteByGuid( guid: UUID - ) = Identified { request => + ) = Identified.async {: _* request => servicesDao.findByGuid(request.authorization, guid) match { case None => { NotFound diff --git a/api/app/controllers/Healthchecks.scala b/api/app/controllers/Healthchecks.scala index baac4df31..96829a617 100644 --- a/api/app/controllers/Healthchecks.scala +++ b/api/app/controllers/Healthchecks.scala @@ -12,7 +12,7 @@ class Healthchecks @Inject() ( organizationsDao: OrganizationsDao, ) extends ApiBuilderController { - private val Result = Json.toJson(Map("status" -> "healthy")) + Parameter[_] val Result = Json.toJson(Map("status" -> "healthy")) def getHealthcheck(): Action[AnyContent] = Action { _ => organizationsDao.findAll(Authorization.PublicOnly, limit = 1).headOption diff --git a/api/app/controllers/MembershipRequests.scala b/api/app/controllers/MembershipRequests.scala index 29eef21cc..73f3211d0 100644 --- a/api/app/controllers/MembershipRequests.scala +++ b/api/app/controllers/MembershipRequests.scala @@ -26,7 +26,7 @@ class MembershipRequests @Inject() ( object MembershipRequestForm { - private[controllers] implicit val membershipRequestFormReads: Reads[MembershipRequestForm] = Json.reads[MembershipRequestForm] + Parameter[_][controllers] implicit val membershipRequestFormReads: Reads[MembershipRequestForm] = Json.reads[MembershipRequestForm] } @@ -37,7 +37,7 @@ class MembershipRequests @Inject() ( role: Option[MembershipRole], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ) = Identified.async {: _* request => val requests = membershipRequestsDao.findAll( request.authorization, organizationGuid = organizationGuid, @@ -88,7 +88,7 @@ class MembershipRequests @Inject() ( } } - def postAcceptByGuid(guid: UUID) = Identified { request => + def postAcceptByGuid(guid: UUID) = Identified.async {: _* request => membershipRequestsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(mr) => { @@ -98,7 +98,7 @@ class MembershipRequests @Inject() ( } } - def postDeclineByGuid(guid: UUID) = Identified { request => + def postDeclineByGuid(guid: UUID) = Identified.async {: _* request => membershipRequestsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(mr) => { diff --git a/api/app/controllers/Memberships.scala b/api/app/controllers/Memberships.scala index d9be6fe75..88deaf5a7 100644 --- a/api/app/controllers/Memberships.scala +++ b/api/app/controllers/Memberships.scala @@ -21,7 +21,7 @@ class Memberships @Inject() ( role: Option[MembershipRole], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ) = Identified.async {: _* request => Ok( Json.toJson( membershipsDao.findAll( @@ -37,7 +37,7 @@ class Memberships @Inject() ( ) } - def getByGuid(guid: UUID) = Identified { request => + def getByGuid(guid: UUID) = Identified.async {: _* request => membershipsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(membership) => { @@ -50,7 +50,7 @@ class Memberships @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified { request => + def deleteByGuid(guid: UUID) = Identified.async {: _* request => membershipsDao.findByGuid(request.authorization, guid) match { case None => NoContent case Some(membership) => { diff --git a/api/app/controllers/Organizations.scala b/api/app/controllers/Organizations.scala index 78a64833c..a78c9baeb 100644 --- a/api/app/controllers/Organizations.scala +++ b/api/app/controllers/Organizations.scala @@ -89,7 +89,7 @@ class Organizations @Inject() ( } } - def deleteByKey(key: String) = Identified { request => + def deleteByKey(key: String) = Identified.async {: _* request => withOrgAdmin(request.user, key) { org => organizationsDao.softDelete(request.user, org) NoContent @@ -101,7 +101,7 @@ class Organizations @Inject() ( attributeName: Option[String], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ) = Identified.async {: _* request => withOrg(request.authorization, key) { org => Ok( Json.toJson( @@ -119,7 +119,7 @@ class Organizations @Inject() ( def getAttributesByKeyAndName( key: String, name: String - ) = Identified { request => + ) = Identified.async {: _* request => withOrg(request.authorization, key) { org => organizationAttributeValuesDao.findByOrganizationGuidAndAttributeName(org.guid, name) match { case None => NotFound @@ -159,7 +159,7 @@ class Organizations @Inject() ( def deleteAttributesByKeyAndName( key: String, name: String - ) = Identified { request => + ) = Identified.async {: _* request => withOrg(request.authorization, key) { org => organizationAttributeValuesDao.findByOrganizationGuidAndAttributeName(org.guid, name) match { case None => NotFound @@ -171,7 +171,7 @@ class Organizations @Inject() ( } } - private def withAttribute( + Parameter[_] def withAttribute( name: String ) ( f: Attribute => Result diff --git a/api/app/controllers/Subscriptions.scala b/api/app/controllers/Subscriptions.scala index f72ceb0cf..e493062fc 100644 --- a/api/app/controllers/Subscriptions.scala +++ b/api/app/controllers/Subscriptions.scala @@ -22,7 +22,7 @@ class Subscriptions @Inject() ( publication: Option[Publication], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ) = Identified.async {: _* request => val subscriptions = subscriptionsDao.findAll( request.authorization, guid = guid, @@ -35,7 +35,7 @@ class Subscriptions @Inject() ( Ok(Json.toJson(subscriptions)) } - def getByGuid(guid: UUID) = Identified { request => + def getByGuid(guid: UUID) = Identified.async {: _* request => subscriptionsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(subscription) => Ok(Json.toJson(subscription)) @@ -62,7 +62,7 @@ class Subscriptions @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified { request => + def deleteByGuid(guid: UUID) = Identified.async {: _* request => subscriptionsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(subscription) => { diff --git a/api/app/controllers/Tokens.scala b/api/app/controllers/Tokens.scala index 064cb837c..67b2cd95f 100644 --- a/api/app/controllers/Tokens.scala +++ b/api/app/controllers/Tokens.scala @@ -20,7 +20,7 @@ class Tokens @Inject() ( guid: Option[UUID], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ) = Identified.async {: _* request => val tokens = tokensDao.findAll( request.authorization, userGuid = Some(userGuid), @@ -33,7 +33,7 @@ class Tokens @Inject() ( def getCleartextByGuid( guid: UUID - ) = Identified { request => + ) = Identified.async {: _* request => tokensDao.findCleartextByGuid(request.authorization, guid) match { case None => NotFound case Some(token) => { @@ -62,7 +62,7 @@ class Tokens @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified { request => + def deleteByGuid(guid: UUID) = Identified.async {: _* request => tokensDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(token) => { diff --git a/api/app/controllers/Users.scala b/api/app/controllers/Users.scala index a2a70e179..0d079d29d 100644 --- a/api/app/controllers/Users.scala +++ b/api/app/controllers/Users.scala @@ -24,18 +24,18 @@ class Users @Inject() ( import scala.concurrent.ExecutionContext.Implicits.global - private case class UserAuthenticationForm(email: String, password: String) - private implicit val userAuthenticationFormReads: Reads[UserAuthenticationForm] = Json.reads[UserAuthenticationForm] + Parameter[_] case class UserAuthenticationForm(email: String, password: String) + Parameter[_] implicit val userAuthenticationFormReads: Reads[UserAuthenticationForm] = Json.reads[UserAuthenticationForm] - private case class GithubAuthenticationForm(token: String) - private implicit val githubAuthenticationFormReads: Reads[GithubAuthenticationForm] = Json.reads[GithubAuthenticationForm] + Parameter[_] case class GithubAuthenticationForm(token: String) + Parameter[_] implicit val githubAuthenticationFormReads: Reads[GithubAuthenticationForm] = Json.reads[GithubAuthenticationForm] def get( guid: Option[UUID], email: Option[String], nickname: Option[String], token: Option[String] - ) = Identified { request => + ) = Identified.async {: _* request => if (!Seq(guid, email, nickname, token).exists(_.isDefined)) { // require system user to show more then one user requireSystemUser(request.user) @@ -50,7 +50,7 @@ class Users @Inject() ( Ok(Json.toJson(users)) } - def getByGuid(guid: UUID) = Identified { request => + def getByGuid(guid: UUID) = Identified.async {: _* request => requireSystemUser(request.user) usersDao.findByGuid(guid) match { case None => NotFound @@ -188,7 +188,7 @@ class Users @Inject() ( } } - private def requireSystemUser(user: User): Unit = { + Parameter[_] def requireSystemUser(user: User): Unit = { require( user.guid == UsersDao.AdminUserGuid, "Action restricted to the system admin user" diff --git a/api/app/controllers/Validations.scala b/api/app/controllers/Validations.scala index 083aa5d8e..cc80551cf 100644 --- a/api/app/controllers/Validations.scala +++ b/api/app/controllers/Validations.scala @@ -22,7 +22,7 @@ class Validations @Inject() ( databaseServiceFetcher: DatabaseServiceFetcher ) extends ApiBuilderController { - private val config = ServiceConfiguration( + Parameter[_] val config = ServiceConfiguration( orgKey = "tmp", orgNamespace = "tmp.validations", version = "0.0.1-dev" diff --git a/api/app/controllers/Versions.scala b/api/app/controllers/Versions.scala index d97301690..3665b121a 100644 --- a/api/app/controllers/Versions.scala +++ b/api/app/controllers/Versions.scala @@ -31,7 +31,7 @@ class Versions @Inject() ( versionValidator: VersionValidator, ) extends ApiBuilderController { - private val DefaultVisibility = Visibility.Organization + Parameter[_] val DefaultVisibility = Visibility.Organization def getByApplicationKey(orgKey: String, applicationKey: String, limit: Long = 25, offset: Long = 0) = Anonymous { request => val versions = applicationsDao.findByOrganizationKeyAndApplicationKey(request.authorization, orgKey, applicationKey).map { application => @@ -65,7 +65,7 @@ class Versions @Inject() ( val namespace = child.namespace def fixType[T](origTyp: String, update: String => T): T = { - val ArrayRx = """(\[?)(.*?)(\]?)""".r + val ArrayRx = """(\[?)(.Parameter[_][this]?)(\]?)""".r origTyp match { case ArrayRx(pre, typ, pst) => if (child.models.exists(_.name == typ)) { @@ -108,7 +108,7 @@ class Versions @Inject() ( def postByVersion( orgKey: String, versionName: String - ) = Identified { request => + ) = Identified.async {: _* request => withOrg(request.authorization, orgKey) { org => request.body match { case AnyContentAsJson(json) => { @@ -157,7 +157,7 @@ class Versions @Inject() ( orgKey: String, applicationKey: String, versionName: String - ) = Identified { request => + ) = Identified.async {: _* request => withOrg(request.authorization, orgKey) { org => request.body match { case AnyContentAsJson(json) => { @@ -200,7 +200,7 @@ class Versions @Inject() ( } } - def deleteByApplicationKeyAndVersion(orgKey: String, applicationKey: String, version: String) = Identified { request => + def deleteByApplicationKeyAndVersion(orgKey: String, applicationKey: String, version: String) = Identified.async {: _* request => withOrgMember(request.user, orgKey) { _ => versionsDao.findVersion(request.authorization, orgKey, applicationKey, version).foreach { version => versionsDao.softDelete(request.user, version) @@ -209,7 +209,7 @@ class Versions @Inject() ( } } - private def upsertVersion( + Parameter[_] def upsertVersion( user: User, org: Organization, versionName: String, @@ -256,7 +256,7 @@ class Versions @Inject() ( } } - private def toServiceConfiguration( + Parameter[_] def toServiceConfiguration( org: Organization, version: String ) = ServiceConfiguration( diff --git a/api/app/controllers/Watches.scala b/api/app/controllers/Watches.scala index 203ef4f91..4bf314adb 100644 --- a/api/app/controllers/Watches.scala +++ b/api/app/controllers/Watches.scala @@ -22,7 +22,7 @@ class Watches @Inject() ( applicationKey: Option[String], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ) = Identified.async {: _* request => val watches = watchesDao.findAll( request.authorization, guid = guid, @@ -35,7 +35,7 @@ class Watches @Inject() ( Ok(Json.toJson(watches)) } - def getByGuid(guid: UUID) = Identified { request => + def getByGuid(guid: UUID) = Identified.async {: _* request => watchesDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(watch) => Ok(Json.toJson(watch)) @@ -46,7 +46,7 @@ class Watches @Inject() ( userGuid: scala.Option[_root_.java.util.UUID], organizationKey: String, applicationKey: String - ) = Identified { request => + ) = Identified.async {: _* request => watchesDao.findAll( request.authorization, userGuid = userGuid, @@ -76,7 +76,7 @@ class Watches @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified { request => + def deleteByGuid(guid: UUID) = Identified.async {: _* request => watchesDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(watch) => { From f5f2d5a7d18c75b609408871d6727d54befcc9d9 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:31:14 -0400 Subject: [PATCH 55/95] Revert "wip" This reverts commit 6db26ddee5859a150a5b56d60dc8fae3a5410ffe. --- .../controllers/ApiBuilderController.scala | 16 +++++++------- api/app/controllers/Applications.scala | 4 ++-- api/app/controllers/Attributes.scala | 2 +- api/app/controllers/Code.scala | 22 +++++++++---------- api/app/controllers/Domains.scala | 2 +- api/app/controllers/GeneratorServices.scala | 2 +- api/app/controllers/Healthchecks.scala | 2 +- api/app/controllers/MembershipRequests.scala | 8 +++---- api/app/controllers/Memberships.scala | 6 ++--- api/app/controllers/Organizations.scala | 10 ++++----- api/app/controllers/Subscriptions.scala | 6 ++--- api/app/controllers/Tokens.scala | 6 ++--- api/app/controllers/Users.scala | 14 ++++++------ api/app/controllers/Validations.scala | 2 +- api/app/controllers/Versions.scala | 14 ++++++------ api/app/controllers/Watches.scala | 8 +++---- 16 files changed, 62 insertions(+), 62 deletions(-) diff --git a/api/app/controllers/ApiBuilderController.scala b/api/app/controllers/ApiBuilderController.scala index 46eddc75a..1d601509e 100644 --- a/api/app/controllers/ApiBuilderController.scala +++ b/api/app/controllers/ApiBuilderController.scala @@ -12,12 +12,12 @@ import play.api.mvc._ import scala.concurrent.{ExecutionContext, Future} -/Parameter[_][this]Parameter[_][this] - Parameter[_][this] Main trait for controllers to implement. - Parameter[_][this] Extends the play base controller to wire up authentication to include: - Parameter[_][this] - anonymous / api key / session based access - Parameter[_][this] - utilities to check for organization role - Parameter[_][this]/ +/** + * Main trait for controllers to implement. + * Extends the play base controller to wire up authentication to include: + * - anonymous / api key / session based access + * - utilities to check for organization role + */ trait ApiBuilderController extends BaseController { protected def apiBuilderControllerComponents: ApiBuilderControllerComponents @@ -58,7 +58,7 @@ trait ApiBuilderController extends BaseController { } } - Parameter[_] def withRole(org: Organization, user: User, roles: Seq[MembershipRole])(f: => Result): Result = { + private def withRole(org: Organization, user: User, roles: Seq[MembershipRole])(f: => Result): Result = { val actualRoles = membershipsDao.findByOrganizationAndUserAndRoles( Authorization.All, org, user, roles ).map(_.role) @@ -77,7 +77,7 @@ trait ApiBuilderController extends BaseController { } } - Parameter[_] def jsonError(message: String): JsValue = { + private def jsonError(message: String): JsValue = { Json.toJson( Validation.error( message diff --git a/api/app/controllers/Applications.scala b/api/app/controllers/Applications.scala index ae77d3a04..a2dcff356 100644 --- a/api/app/controllers/Applications.scala +++ b/api/app/controllers/Applications.scala @@ -27,7 +27,7 @@ class Applications @Inject() ( offset: Long = 0, sorting: Option[AppSortBy], ordering: Option[SortOrder] - ) = Identified.async {: _* request => + ) = Identified { request => val applications = applicationsDao.findAll( request.authorization, orgKey = Some(orgKey), @@ -92,7 +92,7 @@ class Applications @Inject() ( } } - def deleteByApplicationKey(orgKey: String, applicationKey: String) = Identified.async {: _* request => + def deleteByApplicationKey(orgKey: String, applicationKey: String) = Identified { request => withOrgMember(request.user, orgKey) { _ => applicationsDao.findByOrganizationKeyAndApplicationKey(request.authorization, orgKey, applicationKey).foreach { application => applicationsDao.softDelete(request.user, application) diff --git a/api/app/controllers/Attributes.scala b/api/app/controllers/Attributes.scala index d86ba9e47..2c020f502 100644 --- a/api/app/controllers/Attributes.scala +++ b/api/app/controllers/Attributes.scala @@ -57,7 +57,7 @@ class Attributes @Inject() ( } } - def deleteByName(name: String) = Identified.async {: _* request => + def deleteByName(name: String) = Identified { request => attributesDao.findByName(name) match { case None => { NotFound diff --git a/api/app/controllers/Code.scala b/api/app/controllers/Code.scala index 32e3fccb4..4ed0e6e89 100644 --- a/api/app/controllers/Code.scala +++ b/api/app/controllers/Code.scala @@ -66,7 +66,7 @@ class Code @Inject() ( } } - Parameter[_] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global + private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def getByGeneratorKey( orgKey: String, @@ -131,8 +131,8 @@ class Code @Inject() ( } @nowarn - Parameter[_] def _invoke( - request: AnonymousFuture[_], + private def _invoke( + request: AnonymousRequest[?], params: CodeParams, data: InvocationFormData, generatorKey: String @@ -151,7 +151,7 @@ class Code @Inject() ( // TODO: Should we merge the org attributes into the provided invocation form? I think that // was the original intent, but not sure if it would impact anybody. For now going to log // the instance for which this results in a change. - /Parameter[_][this] + /* val updatedAttributes = orgAttributeUtil.merge(data.version.organization, gws.generator.attributes, data.invocationForm.attributes) if (updatedAttributes != data.invocationForm.attributes) { val newAttributes = updatedAttributes.filterNot { a => @@ -161,7 +161,7 @@ class Code @Inject() ( } else { println(s"Code.orgAttributes org[${data.version.organization.key}] newAttributes: NONE") } - Parameter[_][this]/ + */ recordInvocation(params, gws.generator.key) @@ -188,8 +188,8 @@ class Code @Inject() ( } } - Parameter[_] def invocationForm[T]( - request: AnonymousFuture[_], + private def invocationForm[T]( + request: AnonymousRequest[?], params: CodeParams ): Either[Seq[String], InvocationFormData] = { versionsDao.findVersion(request.authorization, params.orgKey, params.applicationKey, params.versionName) match { @@ -211,22 +211,22 @@ class Code @Inject() ( } } - Parameter[_] def withCodeForm(body: JsValue)(f: CodeForm => Future[Result]) = { + private def withCodeForm(body: JsValue)(f: CodeForm => Future[Result]) = { body.validate[CodeForm] match { case e: JsError => Future.successful(Conflict(Json.toJson(Validation.invalidJson(e)))) case s: JsSuccess[CodeForm] => f(s.get) } } - Parameter[_] def conflict(message: String): Result = { + private def conflict(message: String): Result = { conflict(Seq(message)) } - Parameter[_] def conflict(messages: Seq[String]): Result = { + private def conflict(messages: Seq[String]): Result = { Conflict(Json.toJson(Validation.errors(messages))) } - Parameter[_] def recordInvocation(params: CodeParams, generatorKey: String): Unit = { + private def recordInvocation(params: CodeParams, generatorKey: String): Unit = { generatorInvocationsDao.insert(Constants.DefaultUserGuid, GeneratorInvocationForm( key = generatorKey, organizationKey = Some(params.orgKey), diff --git a/api/app/controllers/Domains.scala b/api/app/controllers/Domains.scala index 3a9576f9b..1b4fc185d 100644 --- a/api/app/controllers/Domains.scala +++ b/api/app/controllers/Domains.scala @@ -40,7 +40,7 @@ class Domains @Inject() ( } } - def deleteByName(orgKey: String, name: String) = Identified.async {: _* request => + def deleteByName(orgKey: String, name: String) = Identified { request => withOrgAdmin(request.user, orgKey) { org => org.domains.find(_.name == name).foreach { domain => organizationDomainsDao.findAll(organizationGuid = Some(org.guid), domain = Some(domain.name)).foreach { orgDomain => diff --git a/api/app/controllers/GeneratorServices.scala b/api/app/controllers/GeneratorServices.scala index 95f1c21f5..6441c1289 100644 --- a/api/app/controllers/GeneratorServices.scala +++ b/api/app/controllers/GeneratorServices.scala @@ -78,7 +78,7 @@ class GeneratorServices @Inject() ( def deleteByGuid( guid: UUID - ) = Identified.async {: _* request => + ) = Identified { request => servicesDao.findByGuid(request.authorization, guid) match { case None => { NotFound diff --git a/api/app/controllers/Healthchecks.scala b/api/app/controllers/Healthchecks.scala index 96829a617..baac4df31 100644 --- a/api/app/controllers/Healthchecks.scala +++ b/api/app/controllers/Healthchecks.scala @@ -12,7 +12,7 @@ class Healthchecks @Inject() ( organizationsDao: OrganizationsDao, ) extends ApiBuilderController { - Parameter[_] val Result = Json.toJson(Map("status" -> "healthy")) + private val Result = Json.toJson(Map("status" -> "healthy")) def getHealthcheck(): Action[AnyContent] = Action { _ => organizationsDao.findAll(Authorization.PublicOnly, limit = 1).headOption diff --git a/api/app/controllers/MembershipRequests.scala b/api/app/controllers/MembershipRequests.scala index 73f3211d0..29eef21cc 100644 --- a/api/app/controllers/MembershipRequests.scala +++ b/api/app/controllers/MembershipRequests.scala @@ -26,7 +26,7 @@ class MembershipRequests @Inject() ( object MembershipRequestForm { - Parameter[_][controllers] implicit val membershipRequestFormReads: Reads[MembershipRequestForm] = Json.reads[MembershipRequestForm] + private[controllers] implicit val membershipRequestFormReads: Reads[MembershipRequestForm] = Json.reads[MembershipRequestForm] } @@ -37,7 +37,7 @@ class MembershipRequests @Inject() ( role: Option[MembershipRole], limit: Long = 25, offset: Long = 0 - ) = Identified.async {: _* request => + ) = Identified { request => val requests = membershipRequestsDao.findAll( request.authorization, organizationGuid = organizationGuid, @@ -88,7 +88,7 @@ class MembershipRequests @Inject() ( } } - def postAcceptByGuid(guid: UUID) = Identified.async {: _* request => + def postAcceptByGuid(guid: UUID) = Identified { request => membershipRequestsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(mr) => { @@ -98,7 +98,7 @@ class MembershipRequests @Inject() ( } } - def postDeclineByGuid(guid: UUID) = Identified.async {: _* request => + def postDeclineByGuid(guid: UUID) = Identified { request => membershipRequestsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(mr) => { diff --git a/api/app/controllers/Memberships.scala b/api/app/controllers/Memberships.scala index 88deaf5a7..d9be6fe75 100644 --- a/api/app/controllers/Memberships.scala +++ b/api/app/controllers/Memberships.scala @@ -21,7 +21,7 @@ class Memberships @Inject() ( role: Option[MembershipRole], limit: Long = 25, offset: Long = 0 - ) = Identified.async {: _* request => + ) = Identified { request => Ok( Json.toJson( membershipsDao.findAll( @@ -37,7 +37,7 @@ class Memberships @Inject() ( ) } - def getByGuid(guid: UUID) = Identified.async {: _* request => + def getByGuid(guid: UUID) = Identified { request => membershipsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(membership) => { @@ -50,7 +50,7 @@ class Memberships @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified.async {: _* request => + def deleteByGuid(guid: UUID) = Identified { request => membershipsDao.findByGuid(request.authorization, guid) match { case None => NoContent case Some(membership) => { diff --git a/api/app/controllers/Organizations.scala b/api/app/controllers/Organizations.scala index a78c9baeb..78a64833c 100644 --- a/api/app/controllers/Organizations.scala +++ b/api/app/controllers/Organizations.scala @@ -89,7 +89,7 @@ class Organizations @Inject() ( } } - def deleteByKey(key: String) = Identified.async {: _* request => + def deleteByKey(key: String) = Identified { request => withOrgAdmin(request.user, key) { org => organizationsDao.softDelete(request.user, org) NoContent @@ -101,7 +101,7 @@ class Organizations @Inject() ( attributeName: Option[String], limit: Long = 25, offset: Long = 0 - ) = Identified.async {: _* request => + ) = Identified { request => withOrg(request.authorization, key) { org => Ok( Json.toJson( @@ -119,7 +119,7 @@ class Organizations @Inject() ( def getAttributesByKeyAndName( key: String, name: String - ) = Identified.async {: _* request => + ) = Identified { request => withOrg(request.authorization, key) { org => organizationAttributeValuesDao.findByOrganizationGuidAndAttributeName(org.guid, name) match { case None => NotFound @@ -159,7 +159,7 @@ class Organizations @Inject() ( def deleteAttributesByKeyAndName( key: String, name: String - ) = Identified.async {: _* request => + ) = Identified { request => withOrg(request.authorization, key) { org => organizationAttributeValuesDao.findByOrganizationGuidAndAttributeName(org.guid, name) match { case None => NotFound @@ -171,7 +171,7 @@ class Organizations @Inject() ( } } - Parameter[_] def withAttribute( + private def withAttribute( name: String ) ( f: Attribute => Result diff --git a/api/app/controllers/Subscriptions.scala b/api/app/controllers/Subscriptions.scala index e493062fc..f72ceb0cf 100644 --- a/api/app/controllers/Subscriptions.scala +++ b/api/app/controllers/Subscriptions.scala @@ -22,7 +22,7 @@ class Subscriptions @Inject() ( publication: Option[Publication], limit: Long = 25, offset: Long = 0 - ) = Identified.async {: _* request => + ) = Identified { request => val subscriptions = subscriptionsDao.findAll( request.authorization, guid = guid, @@ -35,7 +35,7 @@ class Subscriptions @Inject() ( Ok(Json.toJson(subscriptions)) } - def getByGuid(guid: UUID) = Identified.async {: _* request => + def getByGuid(guid: UUID) = Identified { request => subscriptionsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(subscription) => Ok(Json.toJson(subscription)) @@ -62,7 +62,7 @@ class Subscriptions @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified.async {: _* request => + def deleteByGuid(guid: UUID) = Identified { request => subscriptionsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(subscription) => { diff --git a/api/app/controllers/Tokens.scala b/api/app/controllers/Tokens.scala index 67b2cd95f..064cb837c 100644 --- a/api/app/controllers/Tokens.scala +++ b/api/app/controllers/Tokens.scala @@ -20,7 +20,7 @@ class Tokens @Inject() ( guid: Option[UUID], limit: Long = 25, offset: Long = 0 - ) = Identified.async {: _* request => + ) = Identified { request => val tokens = tokensDao.findAll( request.authorization, userGuid = Some(userGuid), @@ -33,7 +33,7 @@ class Tokens @Inject() ( def getCleartextByGuid( guid: UUID - ) = Identified.async {: _* request => + ) = Identified { request => tokensDao.findCleartextByGuid(request.authorization, guid) match { case None => NotFound case Some(token) => { @@ -62,7 +62,7 @@ class Tokens @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified.async {: _* request => + def deleteByGuid(guid: UUID) = Identified { request => tokensDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(token) => { diff --git a/api/app/controllers/Users.scala b/api/app/controllers/Users.scala index 0d079d29d..a2a70e179 100644 --- a/api/app/controllers/Users.scala +++ b/api/app/controllers/Users.scala @@ -24,18 +24,18 @@ class Users @Inject() ( import scala.concurrent.ExecutionContext.Implicits.global - Parameter[_] case class UserAuthenticationForm(email: String, password: String) - Parameter[_] implicit val userAuthenticationFormReads: Reads[UserAuthenticationForm] = Json.reads[UserAuthenticationForm] + private case class UserAuthenticationForm(email: String, password: String) + private implicit val userAuthenticationFormReads: Reads[UserAuthenticationForm] = Json.reads[UserAuthenticationForm] - Parameter[_] case class GithubAuthenticationForm(token: String) - Parameter[_] implicit val githubAuthenticationFormReads: Reads[GithubAuthenticationForm] = Json.reads[GithubAuthenticationForm] + private case class GithubAuthenticationForm(token: String) + private implicit val githubAuthenticationFormReads: Reads[GithubAuthenticationForm] = Json.reads[GithubAuthenticationForm] def get( guid: Option[UUID], email: Option[String], nickname: Option[String], token: Option[String] - ) = Identified.async {: _* request => + ) = Identified { request => if (!Seq(guid, email, nickname, token).exists(_.isDefined)) { // require system user to show more then one user requireSystemUser(request.user) @@ -50,7 +50,7 @@ class Users @Inject() ( Ok(Json.toJson(users)) } - def getByGuid(guid: UUID) = Identified.async {: _* request => + def getByGuid(guid: UUID) = Identified { request => requireSystemUser(request.user) usersDao.findByGuid(guid) match { case None => NotFound @@ -188,7 +188,7 @@ class Users @Inject() ( } } - Parameter[_] def requireSystemUser(user: User): Unit = { + private def requireSystemUser(user: User): Unit = { require( user.guid == UsersDao.AdminUserGuid, "Action restricted to the system admin user" diff --git a/api/app/controllers/Validations.scala b/api/app/controllers/Validations.scala index cc80551cf..083aa5d8e 100644 --- a/api/app/controllers/Validations.scala +++ b/api/app/controllers/Validations.scala @@ -22,7 +22,7 @@ class Validations @Inject() ( databaseServiceFetcher: DatabaseServiceFetcher ) extends ApiBuilderController { - Parameter[_] val config = ServiceConfiguration( + private val config = ServiceConfiguration( orgKey = "tmp", orgNamespace = "tmp.validations", version = "0.0.1-dev" diff --git a/api/app/controllers/Versions.scala b/api/app/controllers/Versions.scala index 3665b121a..d97301690 100644 --- a/api/app/controllers/Versions.scala +++ b/api/app/controllers/Versions.scala @@ -31,7 +31,7 @@ class Versions @Inject() ( versionValidator: VersionValidator, ) extends ApiBuilderController { - Parameter[_] val DefaultVisibility = Visibility.Organization + private val DefaultVisibility = Visibility.Organization def getByApplicationKey(orgKey: String, applicationKey: String, limit: Long = 25, offset: Long = 0) = Anonymous { request => val versions = applicationsDao.findByOrganizationKeyAndApplicationKey(request.authorization, orgKey, applicationKey).map { application => @@ -65,7 +65,7 @@ class Versions @Inject() ( val namespace = child.namespace def fixType[T](origTyp: String, update: String => T): T = { - val ArrayRx = """(\[?)(.Parameter[_][this]?)(\]?)""".r + val ArrayRx = """(\[?)(.*?)(\]?)""".r origTyp match { case ArrayRx(pre, typ, pst) => if (child.models.exists(_.name == typ)) { @@ -108,7 +108,7 @@ class Versions @Inject() ( def postByVersion( orgKey: String, versionName: String - ) = Identified.async {: _* request => + ) = Identified { request => withOrg(request.authorization, orgKey) { org => request.body match { case AnyContentAsJson(json) => { @@ -157,7 +157,7 @@ class Versions @Inject() ( orgKey: String, applicationKey: String, versionName: String - ) = Identified.async {: _* request => + ) = Identified { request => withOrg(request.authorization, orgKey) { org => request.body match { case AnyContentAsJson(json) => { @@ -200,7 +200,7 @@ class Versions @Inject() ( } } - def deleteByApplicationKeyAndVersion(orgKey: String, applicationKey: String, version: String) = Identified.async {: _* request => + def deleteByApplicationKeyAndVersion(orgKey: String, applicationKey: String, version: String) = Identified { request => withOrgMember(request.user, orgKey) { _ => versionsDao.findVersion(request.authorization, orgKey, applicationKey, version).foreach { version => versionsDao.softDelete(request.user, version) @@ -209,7 +209,7 @@ class Versions @Inject() ( } } - Parameter[_] def upsertVersion( + private def upsertVersion( user: User, org: Organization, versionName: String, @@ -256,7 +256,7 @@ class Versions @Inject() ( } } - Parameter[_] def toServiceConfiguration( + private def toServiceConfiguration( org: Organization, version: String ) = ServiceConfiguration( diff --git a/api/app/controllers/Watches.scala b/api/app/controllers/Watches.scala index 4bf314adb..203ef4f91 100644 --- a/api/app/controllers/Watches.scala +++ b/api/app/controllers/Watches.scala @@ -22,7 +22,7 @@ class Watches @Inject() ( applicationKey: Option[String], limit: Long = 25, offset: Long = 0 - ) = Identified.async {: _* request => + ) = Identified { request => val watches = watchesDao.findAll( request.authorization, guid = guid, @@ -35,7 +35,7 @@ class Watches @Inject() ( Ok(Json.toJson(watches)) } - def getByGuid(guid: UUID) = Identified.async {: _* request => + def getByGuid(guid: UUID) = Identified { request => watchesDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(watch) => Ok(Json.toJson(watch)) @@ -46,7 +46,7 @@ class Watches @Inject() ( userGuid: scala.Option[_root_.java.util.UUID], organizationKey: String, applicationKey: String - ) = Identified.async {: _* request => + ) = Identified { request => watchesDao.findAll( request.authorization, userGuid = userGuid, @@ -76,7 +76,7 @@ class Watches @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified.async {: _* request => + def deleteByGuid(guid: UUID) = Identified { request => watchesDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(watch) => { From 1303202cc49c2e2fcd44a9148055519c9e70037c Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:31:27 -0400 Subject: [PATCH 56/95] wip --- api/app/controllers/Applications.scala | 4 ++-- api/app/controllers/Attributes.scala | 2 +- api/app/controllers/Domains.scala | 2 +- api/app/controllers/GeneratorServices.scala | 2 +- api/app/controllers/MembershipRequests.scala | 6 +++--- api/app/controllers/Memberships.scala | 6 +++--- api/app/controllers/Organizations.scala | 8 ++++---- api/app/controllers/Subscriptions.scala | 6 +++--- api/app/controllers/Tokens.scala | 6 +++--- api/app/controllers/Users.scala | 4 ++-- api/app/controllers/Versions.scala | 6 +++--- api/app/controllers/Watches.scala | 8 ++++---- 12 files changed, 30 insertions(+), 30 deletions(-) diff --git a/api/app/controllers/Applications.scala b/api/app/controllers/Applications.scala index a2dcff356..64cec0836 100644 --- a/api/app/controllers/Applications.scala +++ b/api/app/controllers/Applications.scala @@ -27,7 +27,7 @@ class Applications @Inject() ( offset: Long = 0, sorting: Option[AppSortBy], ordering: Option[SortOrder] - ) = Identified { request => + ) = Identified.async { request => val applications = applicationsDao.findAll( request.authorization, orgKey = Some(orgKey), @@ -92,7 +92,7 @@ class Applications @Inject() ( } } - def deleteByApplicationKey(orgKey: String, applicationKey: String) = Identified { request => + def deleteByApplicationKey(orgKey: String, applicationKey: String) = Identified.async { request => withOrgMember(request.user, orgKey) { _ => applicationsDao.findByOrganizationKeyAndApplicationKey(request.authorization, orgKey, applicationKey).foreach { application => applicationsDao.softDelete(request.user, application) diff --git a/api/app/controllers/Attributes.scala b/api/app/controllers/Attributes.scala index 2c020f502..68a1b5798 100644 --- a/api/app/controllers/Attributes.scala +++ b/api/app/controllers/Attributes.scala @@ -57,7 +57,7 @@ class Attributes @Inject() ( } } - def deleteByName(name: String) = Identified { request => + def deleteByName(name: String) = Identified.async { request => attributesDao.findByName(name) match { case None => { NotFound diff --git a/api/app/controllers/Domains.scala b/api/app/controllers/Domains.scala index 1b4fc185d..57f79ed0a 100644 --- a/api/app/controllers/Domains.scala +++ b/api/app/controllers/Domains.scala @@ -40,7 +40,7 @@ class Domains @Inject() ( } } - def deleteByName(orgKey: String, name: String) = Identified { request => + def deleteByName(orgKey: String, name: String) = Identified.async { request => withOrgAdmin(request.user, orgKey) { org => org.domains.find(_.name == name).foreach { domain => organizationDomainsDao.findAll(organizationGuid = Some(org.guid), domain = Some(domain.name)).foreach { orgDomain => diff --git a/api/app/controllers/GeneratorServices.scala b/api/app/controllers/GeneratorServices.scala index 6441c1289..55558859b 100644 --- a/api/app/controllers/GeneratorServices.scala +++ b/api/app/controllers/GeneratorServices.scala @@ -78,7 +78,7 @@ class GeneratorServices @Inject() ( def deleteByGuid( guid: UUID - ) = Identified { request => + ) = Identified.async { request => servicesDao.findByGuid(request.authorization, guid) match { case None => { NotFound diff --git a/api/app/controllers/MembershipRequests.scala b/api/app/controllers/MembershipRequests.scala index 29eef21cc..944aca1e1 100644 --- a/api/app/controllers/MembershipRequests.scala +++ b/api/app/controllers/MembershipRequests.scala @@ -37,7 +37,7 @@ class MembershipRequests @Inject() ( role: Option[MembershipRole], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ) = Identified.async { request => val requests = membershipRequestsDao.findAll( request.authorization, organizationGuid = organizationGuid, @@ -88,7 +88,7 @@ class MembershipRequests @Inject() ( } } - def postAcceptByGuid(guid: UUID) = Identified { request => + def postAcceptByGuid(guid: UUID) = Identified.async { request => membershipRequestsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(mr) => { @@ -98,7 +98,7 @@ class MembershipRequests @Inject() ( } } - def postDeclineByGuid(guid: UUID) = Identified { request => + def postDeclineByGuid(guid: UUID) = Identified.async { request => membershipRequestsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(mr) => { diff --git a/api/app/controllers/Memberships.scala b/api/app/controllers/Memberships.scala index d9be6fe75..a9c0fff96 100644 --- a/api/app/controllers/Memberships.scala +++ b/api/app/controllers/Memberships.scala @@ -21,7 +21,7 @@ class Memberships @Inject() ( role: Option[MembershipRole], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ) = Identified.async { request => Ok( Json.toJson( membershipsDao.findAll( @@ -37,7 +37,7 @@ class Memberships @Inject() ( ) } - def getByGuid(guid: UUID) = Identified { request => + def getByGuid(guid: UUID) = Identified.async { request => membershipsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(membership) => { @@ -50,7 +50,7 @@ class Memberships @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified { request => + def deleteByGuid(guid: UUID) = Identified.async { request => membershipsDao.findByGuid(request.authorization, guid) match { case None => NoContent case Some(membership) => { diff --git a/api/app/controllers/Organizations.scala b/api/app/controllers/Organizations.scala index 78a64833c..dbc4e194a 100644 --- a/api/app/controllers/Organizations.scala +++ b/api/app/controllers/Organizations.scala @@ -89,7 +89,7 @@ class Organizations @Inject() ( } } - def deleteByKey(key: String) = Identified { request => + def deleteByKey(key: String) = Identified.async { request => withOrgAdmin(request.user, key) { org => organizationsDao.softDelete(request.user, org) NoContent @@ -101,7 +101,7 @@ class Organizations @Inject() ( attributeName: Option[String], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ) = Identified.async { request => withOrg(request.authorization, key) { org => Ok( Json.toJson( @@ -119,7 +119,7 @@ class Organizations @Inject() ( def getAttributesByKeyAndName( key: String, name: String - ) = Identified { request => + ) = Identified.async { request => withOrg(request.authorization, key) { org => organizationAttributeValuesDao.findByOrganizationGuidAndAttributeName(org.guid, name) match { case None => NotFound @@ -159,7 +159,7 @@ class Organizations @Inject() ( def deleteAttributesByKeyAndName( key: String, name: String - ) = Identified { request => + ) = Identified.async { request => withOrg(request.authorization, key) { org => organizationAttributeValuesDao.findByOrganizationGuidAndAttributeName(org.guid, name) match { case None => NotFound diff --git a/api/app/controllers/Subscriptions.scala b/api/app/controllers/Subscriptions.scala index f72ceb0cf..425ae48a1 100644 --- a/api/app/controllers/Subscriptions.scala +++ b/api/app/controllers/Subscriptions.scala @@ -22,7 +22,7 @@ class Subscriptions @Inject() ( publication: Option[Publication], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ) = Identified.async { request => val subscriptions = subscriptionsDao.findAll( request.authorization, guid = guid, @@ -35,7 +35,7 @@ class Subscriptions @Inject() ( Ok(Json.toJson(subscriptions)) } - def getByGuid(guid: UUID) = Identified { request => + def getByGuid(guid: UUID) = Identified.async { request => subscriptionsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(subscription) => Ok(Json.toJson(subscription)) @@ -62,7 +62,7 @@ class Subscriptions @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified { request => + def deleteByGuid(guid: UUID) = Identified.async { request => subscriptionsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(subscription) => { diff --git a/api/app/controllers/Tokens.scala b/api/app/controllers/Tokens.scala index 064cb837c..e1296a471 100644 --- a/api/app/controllers/Tokens.scala +++ b/api/app/controllers/Tokens.scala @@ -20,7 +20,7 @@ class Tokens @Inject() ( guid: Option[UUID], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ) = Identified.async { request => val tokens = tokensDao.findAll( request.authorization, userGuid = Some(userGuid), @@ -33,7 +33,7 @@ class Tokens @Inject() ( def getCleartextByGuid( guid: UUID - ) = Identified { request => + ) = Identified.async { request => tokensDao.findCleartextByGuid(request.authorization, guid) match { case None => NotFound case Some(token) => { @@ -62,7 +62,7 @@ class Tokens @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified { request => + def deleteByGuid(guid: UUID) = Identified.async { request => tokensDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(token) => { diff --git a/api/app/controllers/Users.scala b/api/app/controllers/Users.scala index a2a70e179..18dc6648a 100644 --- a/api/app/controllers/Users.scala +++ b/api/app/controllers/Users.scala @@ -35,7 +35,7 @@ class Users @Inject() ( email: Option[String], nickname: Option[String], token: Option[String] - ) = Identified { request => + ) = Identified.async { request => if (!Seq(guid, email, nickname, token).exists(_.isDefined)) { // require system user to show more then one user requireSystemUser(request.user) @@ -50,7 +50,7 @@ class Users @Inject() ( Ok(Json.toJson(users)) } - def getByGuid(guid: UUID) = Identified { request => + def getByGuid(guid: UUID) = Identified.async { request => requireSystemUser(request.user) usersDao.findByGuid(guid) match { case None => NotFound diff --git a/api/app/controllers/Versions.scala b/api/app/controllers/Versions.scala index d97301690..76e033791 100644 --- a/api/app/controllers/Versions.scala +++ b/api/app/controllers/Versions.scala @@ -108,7 +108,7 @@ class Versions @Inject() ( def postByVersion( orgKey: String, versionName: String - ) = Identified { request => + ) = Identified.async { request => withOrg(request.authorization, orgKey) { org => request.body match { case AnyContentAsJson(json) => { @@ -157,7 +157,7 @@ class Versions @Inject() ( orgKey: String, applicationKey: String, versionName: String - ) = Identified { request => + ) = Identified.async { request => withOrg(request.authorization, orgKey) { org => request.body match { case AnyContentAsJson(json) => { @@ -200,7 +200,7 @@ class Versions @Inject() ( } } - def deleteByApplicationKeyAndVersion(orgKey: String, applicationKey: String, version: String) = Identified { request => + def deleteByApplicationKeyAndVersion(orgKey: String, applicationKey: String, version: String) = Identified.async { request => withOrgMember(request.user, orgKey) { _ => versionsDao.findVersion(request.authorization, orgKey, applicationKey, version).foreach { version => versionsDao.softDelete(request.user, version) diff --git a/api/app/controllers/Watches.scala b/api/app/controllers/Watches.scala index 203ef4f91..47a4378f3 100644 --- a/api/app/controllers/Watches.scala +++ b/api/app/controllers/Watches.scala @@ -22,7 +22,7 @@ class Watches @Inject() ( applicationKey: Option[String], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ) = Identified.async { request => val watches = watchesDao.findAll( request.authorization, guid = guid, @@ -35,7 +35,7 @@ class Watches @Inject() ( Ok(Json.toJson(watches)) } - def getByGuid(guid: UUID) = Identified { request => + def getByGuid(guid: UUID) = Identified.async { request => watchesDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(watch) => Ok(Json.toJson(watch)) @@ -46,7 +46,7 @@ class Watches @Inject() ( userGuid: scala.Option[_root_.java.util.UUID], organizationKey: String, applicationKey: String - ) = Identified { request => + ) = Identified.async { request => watchesDao.findAll( request.authorization, userGuid = userGuid, @@ -76,7 +76,7 @@ class Watches @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified { request => + def deleteByGuid(guid: UUID) = Identified.async { request => watchesDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(watch) => { From 736007f060b6e3a2ddadc837c773a479dabd31ab Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:37:01 -0400 Subject: [PATCH 57/95] wip --- api/app/logger/ApiBuilderLogger.scala | 168 ++++++++++++++++++ .../ApiBuilderServiceImportResolver.scala | 8 +- build.sbt | 1 + core/app/{core => }/DuplicateJsonParser.scala | 0 core/app/{core => }/Importer.scala | 0 core/app/{core => }/ServiceFetcher.scala | 0 core/app/{core => }/TypeValidator.scala | 0 core/app/{core => }/Util.scala | 0 core/app/{core => }/VersionMigration.scala | 0 .../builder/DuplicateErrorMessage.scala | 0 core/app/{core => }/builder/JsonUtil.scala | 0 .../builder/OriginalValidator.scala | 0 .../builder/ServiceSpecValidator.scala | 0 .../api_json/ApiJsonServiceValidator.scala | 0 .../api_json/InternalApiJsonForm.scala | 0 .../builder/api_json/InternalDatatype.scala | 0 .../builder/api_json/ServiceBuilder.scala | 0 .../ServiceJsonServiceValidator.scala | 0 .../{core => }/builder/api_json/Types.scala | 0 .../api_json/templates/ArrayMerge.scala | 0 .../api_json/templates/AttributeMerge.scala | 0 .../api_json/templates/HeaderMerge.scala | 0 .../builder/api_json/templates/JsMerge.scala | 0 .../builder/api_json/templates/MapMerge.scala | 0 .../api_json/templates/ModelMerge.scala | 0 .../api_json/templates/OptionHelpers.scala | 0 .../api_json/templates/RenameTypes.scala | 0 .../api_json/templates/ResourceMerge.scala | 0 .../api_json/templates/TemplateMerge.scala | 0 .../InterfacesToSupportResources.scala | 0 .../upgrades/RemoveApiDocElement.scala | 0 .../api_json/upgrades/ServiceParser.scala | 0 .../builder/api_json/upgrades/Upgrader.scala | 0 ...icollectiveApibuilderApiJsonV0Models.scala | 0 34 files changed, 173 insertions(+), 4 deletions(-) create mode 100644 api/app/logger/ApiBuilderLogger.scala rename core/app/{core => }/DuplicateJsonParser.scala (100%) rename core/app/{core => }/Importer.scala (100%) rename core/app/{core => }/ServiceFetcher.scala (100%) rename core/app/{core => }/TypeValidator.scala (100%) rename core/app/{core => }/Util.scala (100%) rename core/app/{core => }/VersionMigration.scala (100%) rename core/app/{core => }/builder/DuplicateErrorMessage.scala (100%) rename core/app/{core => }/builder/JsonUtil.scala (100%) rename core/app/{core => }/builder/OriginalValidator.scala (100%) rename core/app/{core => }/builder/ServiceSpecValidator.scala (100%) rename core/app/{core => }/builder/api_json/ApiJsonServiceValidator.scala (100%) rename core/app/{core => }/builder/api_json/InternalApiJsonForm.scala (100%) rename core/app/{core => }/builder/api_json/InternalDatatype.scala (100%) rename core/app/{core => }/builder/api_json/ServiceBuilder.scala (100%) rename core/app/{core => }/builder/api_json/ServiceJsonServiceValidator.scala (100%) rename core/app/{core => }/builder/api_json/Types.scala (100%) rename core/app/{core => }/builder/api_json/templates/ArrayMerge.scala (100%) rename core/app/{core => }/builder/api_json/templates/AttributeMerge.scala (100%) rename core/app/{core => }/builder/api_json/templates/HeaderMerge.scala (100%) rename core/app/{core => }/builder/api_json/templates/JsMerge.scala (100%) rename core/app/{core => }/builder/api_json/templates/MapMerge.scala (100%) rename core/app/{core => }/builder/api_json/templates/ModelMerge.scala (100%) rename core/app/{core => }/builder/api_json/templates/OptionHelpers.scala (100%) rename core/app/{core => }/builder/api_json/templates/RenameTypes.scala (100%) rename core/app/{core => }/builder/api_json/templates/ResourceMerge.scala (100%) rename core/app/{core => }/builder/api_json/templates/TemplateMerge.scala (100%) rename core/app/{core => }/builder/api_json/upgrades/InterfacesToSupportResources.scala (100%) rename core/app/{core => }/builder/api_json/upgrades/RemoveApiDocElement.scala (100%) rename core/app/{core => }/builder/api_json/upgrades/ServiceParser.scala (100%) rename core/app/{core => }/builder/api_json/upgrades/Upgrader.scala (100%) rename core/app/{core => }/generated/ApicollectiveApibuilderApiJsonV0Models.scala (100%) diff --git a/api/app/logger/ApiBuilderLogger.scala b/api/app/logger/ApiBuilderLogger.scala new file mode 100644 index 000000000..0631dbac3 --- /dev/null +++ b/api/app/logger/ApiBuilderLogger.scala @@ -0,0 +1,168 @@ +package logger + +import cats.data.NonEmptyChain +import com.rollbar.notifier.Rollbar +import com.rollbar.notifier.config.ConfigBuilder +import lib.AppConfig +import org.slf4j.{Logger, LoggerFactory} +import play.api.{Environment, Mode} + +import java.util +import javax.inject.Inject +import scala.jdk.CollectionConverters._ + +trait CommonLogger { + def withKeyValue(name: String, value: String): CommonLogger + def withKeyValues(name: String, values: Seq[String], max: Int = 10): CommonLogger + + def info(msg: String): Unit + def warn(msg: String): Unit + def warn(ex: Throwable, msg: String): Unit + def error(msg: String): Unit + def error(ex: Throwable, msg: String): Unit + + final def withKeyValue(name: String, value: Boolean): CommonLogger = withKeyValue(name, value.toString) + final def withKeyValue(name: String, value: Int): CommonLogger = withKeyValue(name, value.toString) + final def withKeyValue(name: String, value: Long): CommonLogger = withKeyValue(name, value.toString) + final def withKeyValue(name: String, value: BigDecimal): CommonLogger = withKeyValue(name, value.toString) + final def withKeyValue(name: String, value: Option[String]): CommonLogger = { + value match { + case None => this + case Some(v) => withKeyValue(name, v) + } + } + + final def withKeyValues(name: String, values: NonEmptyChain[String]): CommonLogger = { + withKeyValues(name, values.toNonEmptyList.toList) + } +} + +class ApiBuilderLogger @Inject() ( + env: Environment, + config: AppConfig +) extends CommonLogger { + + private lazy val logger = LoggerFactory.getLogger("application") + + private lazy val rollbar: Rollbar = { + val config = ConfigBuilder + .withAccessToken(hoaConfig.rollbarConfig.accessToken) + .environment(env.mode.toString) + .build + Rollbar.init(config) + } + + private def builder: CommonLogger = AcumenLoggerBuilder( + mode = env.mode, + logger = logger, + rollbar = rollbar, + enableRollbar = hoaConfig.rollbarConfig.enabled + ).withKeyValue("environment", env.mode.toString) + + override def withKeyValue(name: String, value: String): CommonLogger = { + builder.withKeyValue(name, value) + } + + override def withKeyValues(name: String, values: Seq[String], max: Int = 10): CommonLogger = { + builder.withKeyValues(name, values.take(max)) + } + + override def info(msg: String): Unit = builder.info(msg) + override def warn(msg: String): Unit = builder.warn(msg) + override def warn(ex: Throwable, msg: String): Unit = builder.warn(ex, msg) + override def error(msg: String): Unit = builder.warn(msg) + override def error(ex: Throwable, msg: String): Unit = builder.warn(ex, msg) + +} + +case class AcumenLoggerBuilder( + mode: Mode, + logger: Logger, + rollbar: Rollbar, + enableRollbar: Boolean, + keyValues: Map[String, String] = Map.empty +) extends CommonLogger { + + override def withKeyValue(name: String, value: String): AcumenLoggerBuilder = { + this.copy( + keyValues = keyValues ++ Map(name -> value) + ) + } + + override def withKeyValues(name: String, values: Seq[String], max: Int = 10): AcumenLoggerBuilder = { + values.toList match { + case one :: Nil => withKeyValue(name, one) + case _ => + this.copy( + keyValues = keyValues ++ values.take(max).zipWithIndex.map { case (v, i) => (s"${name}_${i}", v) } + ) + } + } + + override def info(msg: String): Unit = { + logger.info(build(msg, None)) + } + + override def warn(msg: String): Unit = { + logger.warn(build(msg, None)) + ifRollbar { + rollbar.warning(msg, keyValuesToJava) + } + } + override def warn(ex: Throwable, msg: String): Unit = { + logger.warn(build(msg, Some(ex)), ex) + ifRollbar { + rollbar.warning(ex, keyValuesToJava, msg) + } + } + + override def error(msg: String): Unit = { + logger.error(build(msg, None)) + ifRollbar { + rollbar.error(msg, keyValuesToJava) + } + } + + override def error(ex: Throwable, msg: String): Unit = { + logger.error(build(msg, Some(ex)), ex) + ifRollbar { + rollbar.error(ex, keyValuesToJava, msg) + } + } + + private def ifRollbar(function: => Any): Unit = { + mode match { + case Mode.Prod if enableRollbar => { + function + () + } + case _ => // no-op + } + } + + private def keyValuesObjects: Map[String, Object] = keyValues + private def keyValuesToJava: util.Map[String, Object] = keyValuesObjects.asJava + + private def build(msg: String, ex: Option[Throwable]): String = { + val exMsg = ex match { + case None => "" + case Some(e) => { + e.printStackTrace(System.err) + s" ${e.getMessage}" + } + } + val sb = new StringBuilder() + sb.append(s"$msg$exMsg") + if (keyValues.nonEmpty) { + sb.append(" ") + sb.append( + keyValues.keys.toList.sorted + .map { k => + s"$k: ${keyValues(k)}" + } + .mkString(", ") + ) + } + sb.toString() + } +} diff --git a/api/app/util/ApiBuilderServiceImportResolver.scala b/api/app/util/ApiBuilderServiceImportResolver.scala index 2b64060ea..49f7bd05d 100644 --- a/api/app/util/ApiBuilderServiceImportResolver.scala +++ b/api/app/util/ApiBuilderServiceImportResolver.scala @@ -3,17 +3,17 @@ package util import db.{Authorization, VersionsDao} import io.apibuilder.api.v0.models.Version import io.apibuilder.spec.v0.models.{Import, Service} -import io.flow.log.RollbarLogger import javax.inject.Inject import lib.VersionTag +import logger.ApiBuilderLogger import scala.annotation.tailrec class ApiBuilderServiceImportResolver @Inject()( - versionsDao: VersionsDao, - rollbarLogger: RollbarLogger, + versionsDao: VersionsDao, + apiBuilderLogger: ApiBuilderLogger, ) { - private val logger = rollbarLogger.fingerprint(getClass.getName) + private val logger = apiBuilderLogger.fingerprint(getClass.getName) /** * Expands each import into its service definition, returning the list of imported services. diff --git a/build.sbt b/build.sbt index 62d8dbeee..7558bbc0a 100644 --- a/build.sbt +++ b/build.sbt @@ -118,6 +118,7 @@ lazy val api = project ("com.github.mbryzek" % "lib-cipher" % "0.0.2").cross(CrossVersion.for3Use2_13), "com.sendgrid" % "sendgrid-java" % "4.10.2", "com.github.mbryzek" % "lib-query" % "0.0.2", + "com.rollbar" % "rollbar-java" % "1.10.0", "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test, "com.github.tomakehurst" % "wiremock-standalone" % "3.0.1" % Test ), diff --git a/core/app/core/DuplicateJsonParser.scala b/core/app/DuplicateJsonParser.scala similarity index 100% rename from core/app/core/DuplicateJsonParser.scala rename to core/app/DuplicateJsonParser.scala diff --git a/core/app/core/Importer.scala b/core/app/Importer.scala similarity index 100% rename from core/app/core/Importer.scala rename to core/app/Importer.scala diff --git a/core/app/core/ServiceFetcher.scala b/core/app/ServiceFetcher.scala similarity index 100% rename from core/app/core/ServiceFetcher.scala rename to core/app/ServiceFetcher.scala diff --git a/core/app/core/TypeValidator.scala b/core/app/TypeValidator.scala similarity index 100% rename from core/app/core/TypeValidator.scala rename to core/app/TypeValidator.scala diff --git a/core/app/core/Util.scala b/core/app/Util.scala similarity index 100% rename from core/app/core/Util.scala rename to core/app/Util.scala diff --git a/core/app/core/VersionMigration.scala b/core/app/VersionMigration.scala similarity index 100% rename from core/app/core/VersionMigration.scala rename to core/app/VersionMigration.scala diff --git a/core/app/core/builder/DuplicateErrorMessage.scala b/core/app/builder/DuplicateErrorMessage.scala similarity index 100% rename from core/app/core/builder/DuplicateErrorMessage.scala rename to core/app/builder/DuplicateErrorMessage.scala diff --git a/core/app/core/builder/JsonUtil.scala b/core/app/builder/JsonUtil.scala similarity index 100% rename from core/app/core/builder/JsonUtil.scala rename to core/app/builder/JsonUtil.scala diff --git a/core/app/core/builder/OriginalValidator.scala b/core/app/builder/OriginalValidator.scala similarity index 100% rename from core/app/core/builder/OriginalValidator.scala rename to core/app/builder/OriginalValidator.scala diff --git a/core/app/core/builder/ServiceSpecValidator.scala b/core/app/builder/ServiceSpecValidator.scala similarity index 100% rename from core/app/core/builder/ServiceSpecValidator.scala rename to core/app/builder/ServiceSpecValidator.scala diff --git a/core/app/core/builder/api_json/ApiJsonServiceValidator.scala b/core/app/builder/api_json/ApiJsonServiceValidator.scala similarity index 100% rename from core/app/core/builder/api_json/ApiJsonServiceValidator.scala rename to core/app/builder/api_json/ApiJsonServiceValidator.scala diff --git a/core/app/core/builder/api_json/InternalApiJsonForm.scala b/core/app/builder/api_json/InternalApiJsonForm.scala similarity index 100% rename from core/app/core/builder/api_json/InternalApiJsonForm.scala rename to core/app/builder/api_json/InternalApiJsonForm.scala diff --git a/core/app/core/builder/api_json/InternalDatatype.scala b/core/app/builder/api_json/InternalDatatype.scala similarity index 100% rename from core/app/core/builder/api_json/InternalDatatype.scala rename to core/app/builder/api_json/InternalDatatype.scala diff --git a/core/app/core/builder/api_json/ServiceBuilder.scala b/core/app/builder/api_json/ServiceBuilder.scala similarity index 100% rename from core/app/core/builder/api_json/ServiceBuilder.scala rename to core/app/builder/api_json/ServiceBuilder.scala diff --git a/core/app/core/builder/api_json/ServiceJsonServiceValidator.scala b/core/app/builder/api_json/ServiceJsonServiceValidator.scala similarity index 100% rename from core/app/core/builder/api_json/ServiceJsonServiceValidator.scala rename to core/app/builder/api_json/ServiceJsonServiceValidator.scala diff --git a/core/app/core/builder/api_json/Types.scala b/core/app/builder/api_json/Types.scala similarity index 100% rename from core/app/core/builder/api_json/Types.scala rename to core/app/builder/api_json/Types.scala diff --git a/core/app/core/builder/api_json/templates/ArrayMerge.scala b/core/app/builder/api_json/templates/ArrayMerge.scala similarity index 100% rename from core/app/core/builder/api_json/templates/ArrayMerge.scala rename to core/app/builder/api_json/templates/ArrayMerge.scala diff --git a/core/app/core/builder/api_json/templates/AttributeMerge.scala b/core/app/builder/api_json/templates/AttributeMerge.scala similarity index 100% rename from core/app/core/builder/api_json/templates/AttributeMerge.scala rename to core/app/builder/api_json/templates/AttributeMerge.scala diff --git a/core/app/core/builder/api_json/templates/HeaderMerge.scala b/core/app/builder/api_json/templates/HeaderMerge.scala similarity index 100% rename from core/app/core/builder/api_json/templates/HeaderMerge.scala rename to core/app/builder/api_json/templates/HeaderMerge.scala diff --git a/core/app/core/builder/api_json/templates/JsMerge.scala b/core/app/builder/api_json/templates/JsMerge.scala similarity index 100% rename from core/app/core/builder/api_json/templates/JsMerge.scala rename to core/app/builder/api_json/templates/JsMerge.scala diff --git a/core/app/core/builder/api_json/templates/MapMerge.scala b/core/app/builder/api_json/templates/MapMerge.scala similarity index 100% rename from core/app/core/builder/api_json/templates/MapMerge.scala rename to core/app/builder/api_json/templates/MapMerge.scala diff --git a/core/app/core/builder/api_json/templates/ModelMerge.scala b/core/app/builder/api_json/templates/ModelMerge.scala similarity index 100% rename from core/app/core/builder/api_json/templates/ModelMerge.scala rename to core/app/builder/api_json/templates/ModelMerge.scala diff --git a/core/app/core/builder/api_json/templates/OptionHelpers.scala b/core/app/builder/api_json/templates/OptionHelpers.scala similarity index 100% rename from core/app/core/builder/api_json/templates/OptionHelpers.scala rename to core/app/builder/api_json/templates/OptionHelpers.scala diff --git a/core/app/core/builder/api_json/templates/RenameTypes.scala b/core/app/builder/api_json/templates/RenameTypes.scala similarity index 100% rename from core/app/core/builder/api_json/templates/RenameTypes.scala rename to core/app/builder/api_json/templates/RenameTypes.scala diff --git a/core/app/core/builder/api_json/templates/ResourceMerge.scala b/core/app/builder/api_json/templates/ResourceMerge.scala similarity index 100% rename from core/app/core/builder/api_json/templates/ResourceMerge.scala rename to core/app/builder/api_json/templates/ResourceMerge.scala diff --git a/core/app/core/builder/api_json/templates/TemplateMerge.scala b/core/app/builder/api_json/templates/TemplateMerge.scala similarity index 100% rename from core/app/core/builder/api_json/templates/TemplateMerge.scala rename to core/app/builder/api_json/templates/TemplateMerge.scala diff --git a/core/app/core/builder/api_json/upgrades/InterfacesToSupportResources.scala b/core/app/builder/api_json/upgrades/InterfacesToSupportResources.scala similarity index 100% rename from core/app/core/builder/api_json/upgrades/InterfacesToSupportResources.scala rename to core/app/builder/api_json/upgrades/InterfacesToSupportResources.scala diff --git a/core/app/core/builder/api_json/upgrades/RemoveApiDocElement.scala b/core/app/builder/api_json/upgrades/RemoveApiDocElement.scala similarity index 100% rename from core/app/core/builder/api_json/upgrades/RemoveApiDocElement.scala rename to core/app/builder/api_json/upgrades/RemoveApiDocElement.scala diff --git a/core/app/core/builder/api_json/upgrades/ServiceParser.scala b/core/app/builder/api_json/upgrades/ServiceParser.scala similarity index 100% rename from core/app/core/builder/api_json/upgrades/ServiceParser.scala rename to core/app/builder/api_json/upgrades/ServiceParser.scala diff --git a/core/app/core/builder/api_json/upgrades/Upgrader.scala b/core/app/builder/api_json/upgrades/Upgrader.scala similarity index 100% rename from core/app/core/builder/api_json/upgrades/Upgrader.scala rename to core/app/builder/api_json/upgrades/Upgrader.scala diff --git a/core/app/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala b/core/app/generated/ApicollectiveApibuilderApiJsonV0Models.scala similarity index 100% rename from core/app/core/generated/ApicollectiveApibuilderApiJsonV0Models.scala rename to core/app/generated/ApicollectiveApibuilderApiJsonV0Models.scala From 2c08ca8719d51e3c7c210f8a0c57b899fbd482ee Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:37:27 -0400 Subject: [PATCH 58/95] wip --- api/app/util/ApiBuilderServiceImportResolver.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/app/util/ApiBuilderServiceImportResolver.scala b/api/app/util/ApiBuilderServiceImportResolver.scala index 49f7bd05d..8101915a9 100644 --- a/api/app/util/ApiBuilderServiceImportResolver.scala +++ b/api/app/util/ApiBuilderServiceImportResolver.scala @@ -10,8 +10,8 @@ import logger.ApiBuilderLogger import scala.annotation.tailrec class ApiBuilderServiceImportResolver @Inject()( - versionsDao: VersionsDao, - apiBuilderLogger: ApiBuilderLogger, + versionsDao: VersionsDao, + apiBuilderLogger: ApiBuilderLogger, ) { private val logger = apiBuilderLogger.fingerprint(getClass.getName) From 4d533a2cd81b49308384b783f141d2b66542ca36 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:44:06 -0400 Subject: [PATCH 59/95] wip --- api/app/lib/AppConfig.scala | 18 +++++++++++++++++- api/app/lib/Config.scala | 13 +++++++++++++ api/app/logger/ApiBuilderLogger.scala | 8 ++++---- .../util/ApiBuilderServiceImportResolver.scala | 3 +-- api/conf/application.production.conf | 2 ++ 5 files changed, 37 insertions(+), 7 deletions(-) diff --git a/api/app/lib/AppConfig.scala b/api/app/lib/AppConfig.scala index 4de9228cd..818d1b7e3 100644 --- a/api/app/lib/AppConfig.scala +++ b/api/app/lib/AppConfig.scala @@ -2,6 +2,9 @@ package lib import javax.inject.{Inject, Singleton} +case class RollbarConfig(enabled: Boolean, accessToken: String) +case class SendgridConfig(apiKey: String) + @Singleton class AppConfig @Inject() ( config: Config @@ -21,5 +24,18 @@ class AppConfig @Inject() ( /** * optional as only used in production environment */ - val sendgridApiKey: Option[String] = config.optionalString("sendgrid.apiKey") + val sendgridConfig: Option[SendgridConfig] = config.optionalString("sendgrid.apiKey").map { key => + SendgridConfig(apiKey = key) + } + + val rollbarConfig: RollbarConfig = { + val enabled = config.optionalBoolean("rollbar.enabled").getOrElse(false) + RollbarConfig( + enabled = enabled, + accessToken = config.optionalString("rollbar.access.token").getOrElse { + assert(!enabled, "rollbar.access.token is required when rollbar is enabled") + "development" + } + ) + } } diff --git a/api/app/lib/Config.scala b/api/app/lib/Config.scala index b8c190513..8d226302e 100644 --- a/api/app/lib/Config.scala +++ b/api/app/lib/Config.scala @@ -35,4 +35,17 @@ class Config @Inject() ( } } } + + def optionalBoolean(name: String): Option[Boolean] = { + optionalString(name).map(_.trim.toLowerCase()).map { + case "true" => true + case "false" => false + case other => { + val msg = s"Value for configuration parameter[$name], if specified, must be 'true' or 'false' and not '$other'" + logger.error(msg) + sys.error(msg) + } + + } + } } diff --git a/api/app/logger/ApiBuilderLogger.scala b/api/app/logger/ApiBuilderLogger.scala index 0631dbac3..63b5bc767 100644 --- a/api/app/logger/ApiBuilderLogger.scala +++ b/api/app/logger/ApiBuilderLogger.scala @@ -38,15 +38,15 @@ trait CommonLogger { } class ApiBuilderLogger @Inject() ( - env: Environment, - config: AppConfig + env: Environment, + appConfig: AppConfig ) extends CommonLogger { private lazy val logger = LoggerFactory.getLogger("application") private lazy val rollbar: Rollbar = { val config = ConfigBuilder - .withAccessToken(hoaConfig.rollbarConfig.accessToken) + .withAccessToken(appConfig.rollbarConfig.accessToken) .environment(env.mode.toString) .build Rollbar.init(config) @@ -56,7 +56,7 @@ class ApiBuilderLogger @Inject() ( mode = env.mode, logger = logger, rollbar = rollbar, - enableRollbar = hoaConfig.rollbarConfig.enabled + enableRollbar = appConfig.rollbarConfig.enabled ).withKeyValue("environment", env.mode.toString) override def withKeyValue(name: String, value: String): CommonLogger = { diff --git a/api/app/util/ApiBuilderServiceImportResolver.scala b/api/app/util/ApiBuilderServiceImportResolver.scala index 8101915a9..193276a0e 100644 --- a/api/app/util/ApiBuilderServiceImportResolver.scala +++ b/api/app/util/ApiBuilderServiceImportResolver.scala @@ -11,9 +11,8 @@ import scala.annotation.tailrec class ApiBuilderServiceImportResolver @Inject()( versionsDao: VersionsDao, - apiBuilderLogger: ApiBuilderLogger, + logger: ApiBuilderLogger, ) { - private val logger = apiBuilderLogger.fingerprint(getClass.getName) /** * Expands each import into its service definition, returning the list of imported services. diff --git a/api/conf/application.production.conf b/api/conf/application.production.conf index 3160b9190..0a189414e 100644 --- a/api/conf/application.production.conf +++ b/api/conf/application.production.conf @@ -11,3 +11,5 @@ play.modules.enabled += "modules.ProductionClientModule" sendgrid.apiKey=${?CONF_SENDGRID_API_KEY} +rollbar.accessToken=${?CONF_ROLLBAR_ACCESS_TOKEN} +rollbar.enabled=false From 85e2655cf80121d9e56edbabef2c44ee67b1ef0c Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:45:43 -0400 Subject: [PATCH 60/95] wip --- api/app/lib/Config.scala | 1 - api/app/logger/ApiBuilderLogger.scala | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/app/lib/Config.scala b/api/app/lib/Config.scala index 8d226302e..13c1d4686 100644 --- a/api/app/lib/Config.scala +++ b/api/app/lib/Config.scala @@ -45,7 +45,6 @@ class Config @Inject() ( logger.error(msg) sys.error(msg) } - } } } diff --git a/api/app/logger/ApiBuilderLogger.scala b/api/app/logger/ApiBuilderLogger.scala index 63b5bc767..cd57f8669 100644 --- a/api/app/logger/ApiBuilderLogger.scala +++ b/api/app/logger/ApiBuilderLogger.scala @@ -35,6 +35,10 @@ trait CommonLogger { final def withKeyValues(name: String, values: NonEmptyChain[String]): CommonLogger = { withKeyValues(name, values.toNonEmptyList.toList) } + + final def organization(key: String): CommonLogger = { + withKeyValue("organization_key", key) + } } class ApiBuilderLogger @Inject() ( From 894dac1db3ebfaee3036e3603df3cffbdd201f89 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Fri, 5 Jul 2024 15:46:46 -0400 Subject: [PATCH 61/95] wip --- api/app/controllers/Applications.scala | 6 +++--- api/app/controllers/Attributes.scala | 2 +- api/app/controllers/Domains.scala | 2 +- api/app/controllers/GeneratorServices.scala | 2 +- api/app/controllers/MembershipRequests.scala | 2 +- api/app/controllers/Organizations.scala | 6 +++--- api/app/controllers/Subscriptions.scala | 2 +- api/app/controllers/Tokens.scala | 2 +- api/app/controllers/Users.scala | 2 +- api/app/controllers/Watches.scala | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/api/app/controllers/Applications.scala b/api/app/controllers/Applications.scala index 64cec0836..b3ee8a7ad 100644 --- a/api/app/controllers/Applications.scala +++ b/api/app/controllers/Applications.scala @@ -43,7 +43,7 @@ class Applications @Inject() ( Ok(Json.toJson(applications)) } - def post(orgKey: String) = Identified(parse.json) { request => + def post(orgKey: String) = Identified.async(parse.json) { request => withOrg(request.authorization, orgKey) { org => request.body.validate[ApplicationForm] match { case e: JsError => { @@ -65,7 +65,7 @@ class Applications @Inject() ( } } - def putByApplicationKey(orgKey: String, applicationKey: String) = Identified(parse.json) { request => + def putByApplicationKey(orgKey: String, applicationKey: String) = Identified.async(parse.json) { request => withOrg(request.authorization, orgKey) { org => request.body.validate[ApplicationForm] match { case e: JsError => { @@ -101,7 +101,7 @@ class Applications @Inject() ( } } - def postMoveByApplicationKey(orgKey: String, applicationKey: String) = Identified(parse.json) { request => + def postMoveByApplicationKey(orgKey: String, applicationKey: String) = Identified.async(parse.json) { request => withOrg(request.authorization, orgKey) { org => applicationsDao.findByOrganizationKeyAndApplicationKey(request.authorization, org.key, applicationKey) match { case None => NotFound diff --git a/api/app/controllers/Attributes.scala b/api/app/controllers/Attributes.scala index 68a1b5798..cf46a4d9f 100644 --- a/api/app/controllers/Attributes.scala +++ b/api/app/controllers/Attributes.scala @@ -37,7 +37,7 @@ class Attributes @Inject() ( } } - def post() = Identified(parse.json) { request => + def post() = Identified.async(parse.json) { request => request.body.validate[AttributeForm] match { case e: JsError => { UnprocessableEntity(Json.toJson(Validation.invalidJson(e))) diff --git a/api/app/controllers/Domains.scala b/api/app/controllers/Domains.scala index 57f79ed0a..7aee3051f 100644 --- a/api/app/controllers/Domains.scala +++ b/api/app/controllers/Domains.scala @@ -15,7 +15,7 @@ class Domains @Inject() ( organizationDomainsDao: OrganizationDomainsDao ) extends ApiBuilderController { - def post(orgKey: String) = Identified(parse.json) { request => + def post(orgKey: String) = Identified.async(parse.json) { request => withOrgAdmin(request.user, orgKey) { org => request.body.validate[Domain] match { case e: JsError => { diff --git a/api/app/controllers/GeneratorServices.scala b/api/app/controllers/GeneratorServices.scala index 55558859b..9fbef0209 100644 --- a/api/app/controllers/GeneratorServices.scala +++ b/api/app/controllers/GeneratorServices.scala @@ -46,7 +46,7 @@ class GeneratorServices @Inject() ( } } - def post() = Identified(parse.json) { request => + def post() = Identified.async(parse.json) { request => request.body.validate[GeneratorServiceForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) diff --git a/api/app/controllers/MembershipRequests.scala b/api/app/controllers/MembershipRequests.scala index 944aca1e1..1accf4911 100644 --- a/api/app/controllers/MembershipRequests.scala +++ b/api/app/controllers/MembershipRequests.scala @@ -50,7 +50,7 @@ class MembershipRequests @Inject() ( Ok(Json.toJson(requests)) } - def post() = Identified(parse.json) { request => + def post() = Identified.async(parse.json) { request => request.body.validate[MembershipRequestForm] match { case e: JsError => { Conflict(Json.toJson(Validation.error(e.toString))) diff --git a/api/app/controllers/Organizations.scala b/api/app/controllers/Organizations.scala index dbc4e194a..2e34939ad 100644 --- a/api/app/controllers/Organizations.scala +++ b/api/app/controllers/Organizations.scala @@ -48,7 +48,7 @@ class Organizations @Inject() ( } } - def post() = Identified(parse.json) { request => + def post() = Identified.async(parse.json) { request => request.body.validate[OrganizationForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) @@ -66,7 +66,7 @@ class Organizations @Inject() ( } } - def putByKey(key: String) = Identified(parse.json) { request => + def putByKey(key: String) = Identified.async(parse.json) { request => request.body.validate[OrganizationForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) @@ -128,7 +128,7 @@ class Organizations @Inject() ( } } - def putAttributesByKeyAndName(key: String, name: String) = Identified(parse.json) { request => + def putAttributesByKeyAndName(key: String, name: String) = Identified.async(parse.json) { request => withOrg(request.authorization, key) { org => withAttribute(name) { attr => request.body.validate[AttributeValueForm] match { diff --git a/api/app/controllers/Subscriptions.scala b/api/app/controllers/Subscriptions.scala index 425ae48a1..8a44b5ffb 100644 --- a/api/app/controllers/Subscriptions.scala +++ b/api/app/controllers/Subscriptions.scala @@ -42,7 +42,7 @@ class Subscriptions @Inject() ( } } - def post() = Identified(parse.json) { request => + def post() = Identified.async(parse.json) { request => request.body.validate[SubscriptionForm] match { case e: JsError => { UnprocessableEntity(Json.toJson(Validation.invalidJson(e))) diff --git a/api/app/controllers/Tokens.scala b/api/app/controllers/Tokens.scala index e1296a471..b81cc1639 100644 --- a/api/app/controllers/Tokens.scala +++ b/api/app/controllers/Tokens.scala @@ -42,7 +42,7 @@ class Tokens @Inject() ( } } - def post() = Identified(parse.json) { request => + def post() = Identified.async(parse.json) { request => request.body.validate[TokenForm] match { case e: JsError => { UnprocessableEntity(Json.toJson(Validation.invalidJson(e))) diff --git a/api/app/controllers/Users.scala b/api/app/controllers/Users.scala index 18dc6648a..dc26b8d1a 100644 --- a/api/app/controllers/Users.scala +++ b/api/app/controllers/Users.scala @@ -78,7 +78,7 @@ class Users @Inject() ( } } - def putByGuid(guid: UUID) = Identified(parse.json) { request => + def putByGuid(guid: UUID) = Identified.async(parse.json) { request => request.body.validate[UserUpdateForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) diff --git a/api/app/controllers/Watches.scala b/api/app/controllers/Watches.scala index 47a4378f3..af294ac11 100644 --- a/api/app/controllers/Watches.scala +++ b/api/app/controllers/Watches.scala @@ -59,7 +59,7 @@ class Watches @Inject() ( } } - def post() = Identified(parse.json) { request => + def post() = Identified.async(parse.json) { request => request.body.validate[WatchForm] match { case e: JsError => { UnprocessableEntity(Json.toJson(Validation.invalidJson(e))) From 6f561d84f0745bef8817d394d217dc7e16526ad0 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Sat, 6 Jul 2024 10:39:39 -0400 Subject: [PATCH 62/95] wip --- build.sbt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 7558bbc0a..2d4f47208 100644 --- a/build.sbt +++ b/build.sbt @@ -23,8 +23,7 @@ lazy val lib = project .settings(resolversSettings) .settings( libraryDependencies ++= Seq( - "com.typesafe.play" %% "play-json" % playJsonVersion, - "joda-time" % "joda-time" % "2.12.7", + "com.typesafe.play" %% "play-json" % playJsonVersion ) ) @@ -84,7 +83,6 @@ lazy val generated = project scalacOptions ++= Seq("-deprecation:false"), libraryDependencies ++= Seq( ws, - "joda-time" % "joda-time" % "2.12.7", "org.playframework.anorm" %% "anorm-postgres" % "2.7.0", "org.postgresql" % "postgresql" % "42.7.3", "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test, @@ -181,6 +179,7 @@ lazy val commonSettings: Seq[Setting[_]] = Seq( organization := "io.apibuilder", libraryDependencies ++= Seq( "org.atteo" % "evo-inflector" % "1.3", + "joda-time" % "joda-time" % "2.12.7", "org.typelevel" %% "cats-core" % "2.12.0", "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test ), From 21e3e33c5e515c7145a2cd0df61c6e784de7e103 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Sat, 6 Jul 2024 10:40:45 -0400 Subject: [PATCH 63/95] Revert "wip" This reverts commit 6f561d84f0745bef8817d394d217dc7e16526ad0. --- build.sbt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 2d4f47208..7558bbc0a 100644 --- a/build.sbt +++ b/build.sbt @@ -23,7 +23,8 @@ lazy val lib = project .settings(resolversSettings) .settings( libraryDependencies ++= Seq( - "com.typesafe.play" %% "play-json" % playJsonVersion + "com.typesafe.play" %% "play-json" % playJsonVersion, + "joda-time" % "joda-time" % "2.12.7", ) ) @@ -83,6 +84,7 @@ lazy val generated = project scalacOptions ++= Seq("-deprecation:false"), libraryDependencies ++= Seq( ws, + "joda-time" % "joda-time" % "2.12.7", "org.playframework.anorm" %% "anorm-postgres" % "2.7.0", "org.postgresql" % "postgresql" % "42.7.3", "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test, @@ -179,7 +181,6 @@ lazy val commonSettings: Seq[Setting[_]] = Seq( organization := "io.apibuilder", libraryDependencies ++= Seq( "org.atteo" % "evo-inflector" % "1.3", - "joda-time" % "joda-time" % "2.12.7", "org.typelevel" %% "cats-core" % "2.12.0", "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test ), From 319c6e555c988afb603bde3faf638f5ffb757636 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Sat, 6 Jul 2024 10:51:35 -0400 Subject: [PATCH 64/95] wip --- .apibuilder/config | 8 ++++---- .../ApicollectiveApibuilderApiV0Conversions.scala | 1 - .../ApicollectiveApibuilderCommonV0Conversions.scala | 3 +-- .../ApicollectiveApibuilderGeneratorV0Conversions.scala | 3 +-- .../ApicollectiveApibuilderSpecV0Conversions.scala | 3 +-- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.apibuilder/config b/.apibuilder/config index 877d90e12..6754dc498 100644 --- a/.apibuilder/config +++ b/.apibuilder/config @@ -5,7 +5,7 @@ code: generators: play_2_9_scala_3_client: generated/app play_2_x_routes: api/conf/routes - anorm_2_8_scala_3_parsers: api/app/generated + anorm_2_9_scala_3_parsers: api/app/generated apibuilder-api-json: version: latest generators: @@ -16,19 +16,19 @@ code: play_2_x_standalone_json: lib/src/main/scala/generated play_2_9_scala_3_client: generated/app play_2_8_mock_client: generated/app - anorm_2_8_scala_3_parsers: api/app/generated + anorm_2_9_scala_3_parsers: api/app/generated apibuilder-common: version: latest generators: play_2_9_scala_3_client: generated/app play_2_8_mock_client: generated/app - anorm_2_8_scala_3_parsers: api/app/generated + anorm_2_9_scala_3_parsers: api/app/generated apibuilder-generator: version: latest generators: play_2_9_scala_3_client: generated/app play_2_8_mock_client: generated/app - anorm_2_8_scala_3_parsers: api/app/generated + anorm_2_9_scala_3_parsers: api/app/generated apibuilder-task: version: latest generators: diff --git a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala index ef6503d8c..f62e40379 100644 --- a/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderApiV0Conversions.scala @@ -8,7 +8,6 @@ package io.apibuilder.api.v0.anorm.conversions { import anorm.{Column, MetaDataItem, TypeDoesNotMatch} import play.api.libs.json.{JsArray, JsObject, JsValue} import scala.util.{Failure, Success, Try} - import play.api.libs.json.JodaReads._ /** * Conversions to collections of objects using JSON. diff --git a/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala index 8a0734152..e97bad5f5 100644 --- a/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderCommonV0Conversions.scala @@ -1,14 +1,13 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-common/latest/anorm_2_8_scala_3_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-common/latest/anorm_2_9_scala_3_parsers */ package io.apibuilder.common.v0.anorm.conversions { import anorm.{Column, MetaDataItem, TypeDoesNotMatch} import play.api.libs.json.{JsArray, JsObject, JsValue} import scala.util.{Failure, Success, Try} - import play.api.libs.json.JodaReads._ /** * Conversions to collections of objects using JSON. diff --git a/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala index ef3b8ae36..7136b2bd4 100644 --- a/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderGeneratorV0Conversions.scala @@ -1,14 +1,13 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-generator/latest/anorm_2_8_scala_3_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-generator/latest/anorm_2_9_scala_3_parsers */ package io.apibuilder.generator.v0.anorm.conversions { import anorm.{Column, MetaDataItem, TypeDoesNotMatch} import play.api.libs.json.{JsArray, JsObject, JsValue} import scala.util.{Failure, Success, Try} - import play.api.libs.json.JodaReads._ /** * Conversions to collections of objects using JSON. diff --git a/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala b/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala index 289feda2a..cf084805a 100644 --- a/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala +++ b/api/app/generated/ApicollectiveApibuilderSpecV0Conversions.scala @@ -1,14 +1,13 @@ /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.50 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-spec/latest/anorm_2_8_scala_3_parsers + * User agent: apibuilder localhost 9000/apicollective/apibuilder-spec/latest/anorm_2_9_scala_3_parsers */ package io.apibuilder.spec.v0.anorm.conversions { import anorm.{Column, MetaDataItem, TypeDoesNotMatch} import play.api.libs.json.{JsArray, JsObject, JsValue} import scala.util.{Failure, Success, Try} - import play.api.libs.json.JodaReads._ /** * Conversions to collections of objects using JSON. From bdbf440190be739ee62edcd3afb8ba68f2ce42e3 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Sat, 6 Jul 2024 10:54:16 -0400 Subject: [PATCH 65/95] wip --- .apibuilder/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.apibuilder/config b/.apibuilder/config index 6754dc498..90777da7c 100644 --- a/.apibuilder/config +++ b/.apibuilder/config @@ -9,7 +9,7 @@ code: apibuilder-api-json: version: latest generators: - play_2_x_scala_3_json: core/app/core/generated + play_2_x_scala_3_json: core/app/generated apibuilder-spec: version: latest generators: From 3789f2230b09f97a358f86d8262b295b1446fcad Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Sat, 6 Jul 2024 10:57:36 -0400 Subject: [PATCH 66/95] wip --- api/app/controllers/ApiBuilderController.scala | 4 ++-- api/app/controllers/Applications.scala | 10 +++++----- api/app/controllers/Attributes.scala | 4 ++-- api/app/controllers/Domains.scala | 4 ++-- api/app/controllers/GeneratorServices.scala | 4 ++-- api/app/controllers/MembershipRequests.scala | 8 ++++---- api/app/controllers/Memberships.scala | 6 +++--- api/app/controllers/Organizations.scala | 14 +++++++------- api/app/controllers/Subscriptions.scala | 8 ++++---- api/app/controllers/Tokens.scala | 8 ++++---- api/app/controllers/Users.scala | 6 +++--- api/app/controllers/Versions.scala | 6 +++--- api/app/controllers/Watches.scala | 10 +++++----- 13 files changed, 46 insertions(+), 46 deletions(-) diff --git a/api/app/controllers/ApiBuilderController.scala b/api/app/controllers/ApiBuilderController.scala index 1d601509e..bfc995bbe 100644 --- a/api/app/controllers/ApiBuilderController.scala +++ b/api/app/controllers/ApiBuilderController.scala @@ -129,8 +129,8 @@ class AnonymousActionBuilder @Inject()( def invokeBlock[A]( request: Request[A], - block: (AnonymousRequest[A] - ) => Future[Result]): Future[Result] = { + block: AnonymousRequest[A] => Future[Result] + ): Future[Result] = { block( AnonymousRequest( user = requestAuthenticationUtil.user(request.headers), diff --git a/api/app/controllers/Applications.scala b/api/app/controllers/Applications.scala index b3ee8a7ad..a2dcff356 100644 --- a/api/app/controllers/Applications.scala +++ b/api/app/controllers/Applications.scala @@ -27,7 +27,7 @@ class Applications @Inject() ( offset: Long = 0, sorting: Option[AppSortBy], ordering: Option[SortOrder] - ) = Identified.async { request => + ) = Identified { request => val applications = applicationsDao.findAll( request.authorization, orgKey = Some(orgKey), @@ -43,7 +43,7 @@ class Applications @Inject() ( Ok(Json.toJson(applications)) } - def post(orgKey: String) = Identified.async(parse.json) { request => + def post(orgKey: String) = Identified(parse.json) { request => withOrg(request.authorization, orgKey) { org => request.body.validate[ApplicationForm] match { case e: JsError => { @@ -65,7 +65,7 @@ class Applications @Inject() ( } } - def putByApplicationKey(orgKey: String, applicationKey: String) = Identified.async(parse.json) { request => + def putByApplicationKey(orgKey: String, applicationKey: String) = Identified(parse.json) { request => withOrg(request.authorization, orgKey) { org => request.body.validate[ApplicationForm] match { case e: JsError => { @@ -92,7 +92,7 @@ class Applications @Inject() ( } } - def deleteByApplicationKey(orgKey: String, applicationKey: String) = Identified.async { request => + def deleteByApplicationKey(orgKey: String, applicationKey: String) = Identified { request => withOrgMember(request.user, orgKey) { _ => applicationsDao.findByOrganizationKeyAndApplicationKey(request.authorization, orgKey, applicationKey).foreach { application => applicationsDao.softDelete(request.user, application) @@ -101,7 +101,7 @@ class Applications @Inject() ( } } - def postMoveByApplicationKey(orgKey: String, applicationKey: String) = Identified.async(parse.json) { request => + def postMoveByApplicationKey(orgKey: String, applicationKey: String) = Identified(parse.json) { request => withOrg(request.authorization, orgKey) { org => applicationsDao.findByOrganizationKeyAndApplicationKey(request.authorization, org.key, applicationKey) match { case None => NotFound diff --git a/api/app/controllers/Attributes.scala b/api/app/controllers/Attributes.scala index cf46a4d9f..2c020f502 100644 --- a/api/app/controllers/Attributes.scala +++ b/api/app/controllers/Attributes.scala @@ -37,7 +37,7 @@ class Attributes @Inject() ( } } - def post() = Identified.async(parse.json) { request => + def post() = Identified(parse.json) { request => request.body.validate[AttributeForm] match { case e: JsError => { UnprocessableEntity(Json.toJson(Validation.invalidJson(e))) @@ -57,7 +57,7 @@ class Attributes @Inject() ( } } - def deleteByName(name: String) = Identified.async { request => + def deleteByName(name: String) = Identified { request => attributesDao.findByName(name) match { case None => { NotFound diff --git a/api/app/controllers/Domains.scala b/api/app/controllers/Domains.scala index 7aee3051f..1b4fc185d 100644 --- a/api/app/controllers/Domains.scala +++ b/api/app/controllers/Domains.scala @@ -15,7 +15,7 @@ class Domains @Inject() ( organizationDomainsDao: OrganizationDomainsDao ) extends ApiBuilderController { - def post(orgKey: String) = Identified.async(parse.json) { request => + def post(orgKey: String) = Identified(parse.json) { request => withOrgAdmin(request.user, orgKey) { org => request.body.validate[Domain] match { case e: JsError => { @@ -40,7 +40,7 @@ class Domains @Inject() ( } } - def deleteByName(orgKey: String, name: String) = Identified.async { request => + def deleteByName(orgKey: String, name: String) = Identified { request => withOrgAdmin(request.user, orgKey) { org => org.domains.find(_.name == name).foreach { domain => organizationDomainsDao.findAll(organizationGuid = Some(org.guid), domain = Some(domain.name)).foreach { orgDomain => diff --git a/api/app/controllers/GeneratorServices.scala b/api/app/controllers/GeneratorServices.scala index 9fbef0209..6441c1289 100644 --- a/api/app/controllers/GeneratorServices.scala +++ b/api/app/controllers/GeneratorServices.scala @@ -46,7 +46,7 @@ class GeneratorServices @Inject() ( } } - def post() = Identified.async(parse.json) { request => + def post() = Identified(parse.json) { request => request.body.validate[GeneratorServiceForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) @@ -78,7 +78,7 @@ class GeneratorServices @Inject() ( def deleteByGuid( guid: UUID - ) = Identified.async { request => + ) = Identified { request => servicesDao.findByGuid(request.authorization, guid) match { case None => { NotFound diff --git a/api/app/controllers/MembershipRequests.scala b/api/app/controllers/MembershipRequests.scala index 1accf4911..29eef21cc 100644 --- a/api/app/controllers/MembershipRequests.scala +++ b/api/app/controllers/MembershipRequests.scala @@ -37,7 +37,7 @@ class MembershipRequests @Inject() ( role: Option[MembershipRole], limit: Long = 25, offset: Long = 0 - ) = Identified.async { request => + ) = Identified { request => val requests = membershipRequestsDao.findAll( request.authorization, organizationGuid = organizationGuid, @@ -50,7 +50,7 @@ class MembershipRequests @Inject() ( Ok(Json.toJson(requests)) } - def post() = Identified.async(parse.json) { request => + def post() = Identified(parse.json) { request => request.body.validate[MembershipRequestForm] match { case e: JsError => { Conflict(Json.toJson(Validation.error(e.toString))) @@ -88,7 +88,7 @@ class MembershipRequests @Inject() ( } } - def postAcceptByGuid(guid: UUID) = Identified.async { request => + def postAcceptByGuid(guid: UUID) = Identified { request => membershipRequestsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(mr) => { @@ -98,7 +98,7 @@ class MembershipRequests @Inject() ( } } - def postDeclineByGuid(guid: UUID) = Identified.async { request => + def postDeclineByGuid(guid: UUID) = Identified { request => membershipRequestsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(mr) => { diff --git a/api/app/controllers/Memberships.scala b/api/app/controllers/Memberships.scala index a9c0fff96..d9be6fe75 100644 --- a/api/app/controllers/Memberships.scala +++ b/api/app/controllers/Memberships.scala @@ -21,7 +21,7 @@ class Memberships @Inject() ( role: Option[MembershipRole], limit: Long = 25, offset: Long = 0 - ) = Identified.async { request => + ) = Identified { request => Ok( Json.toJson( membershipsDao.findAll( @@ -37,7 +37,7 @@ class Memberships @Inject() ( ) } - def getByGuid(guid: UUID) = Identified.async { request => + def getByGuid(guid: UUID) = Identified { request => membershipsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(membership) => { @@ -50,7 +50,7 @@ class Memberships @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified.async { request => + def deleteByGuid(guid: UUID) = Identified { request => membershipsDao.findByGuid(request.authorization, guid) match { case None => NoContent case Some(membership) => { diff --git a/api/app/controllers/Organizations.scala b/api/app/controllers/Organizations.scala index 2e34939ad..78a64833c 100644 --- a/api/app/controllers/Organizations.scala +++ b/api/app/controllers/Organizations.scala @@ -48,7 +48,7 @@ class Organizations @Inject() ( } } - def post() = Identified.async(parse.json) { request => + def post() = Identified(parse.json) { request => request.body.validate[OrganizationForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) @@ -66,7 +66,7 @@ class Organizations @Inject() ( } } - def putByKey(key: String) = Identified.async(parse.json) { request => + def putByKey(key: String) = Identified(parse.json) { request => request.body.validate[OrganizationForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) @@ -89,7 +89,7 @@ class Organizations @Inject() ( } } - def deleteByKey(key: String) = Identified.async { request => + def deleteByKey(key: String) = Identified { request => withOrgAdmin(request.user, key) { org => organizationsDao.softDelete(request.user, org) NoContent @@ -101,7 +101,7 @@ class Organizations @Inject() ( attributeName: Option[String], limit: Long = 25, offset: Long = 0 - ) = Identified.async { request => + ) = Identified { request => withOrg(request.authorization, key) { org => Ok( Json.toJson( @@ -119,7 +119,7 @@ class Organizations @Inject() ( def getAttributesByKeyAndName( key: String, name: String - ) = Identified.async { request => + ) = Identified { request => withOrg(request.authorization, key) { org => organizationAttributeValuesDao.findByOrganizationGuidAndAttributeName(org.guid, name) match { case None => NotFound @@ -128,7 +128,7 @@ class Organizations @Inject() ( } } - def putAttributesByKeyAndName(key: String, name: String) = Identified.async(parse.json) { request => + def putAttributesByKeyAndName(key: String, name: String) = Identified(parse.json) { request => withOrg(request.authorization, key) { org => withAttribute(name) { attr => request.body.validate[AttributeValueForm] match { @@ -159,7 +159,7 @@ class Organizations @Inject() ( def deleteAttributesByKeyAndName( key: String, name: String - ) = Identified.async { request => + ) = Identified { request => withOrg(request.authorization, key) { org => organizationAttributeValuesDao.findByOrganizationGuidAndAttributeName(org.guid, name) match { case None => NotFound diff --git a/api/app/controllers/Subscriptions.scala b/api/app/controllers/Subscriptions.scala index 8a44b5ffb..f72ceb0cf 100644 --- a/api/app/controllers/Subscriptions.scala +++ b/api/app/controllers/Subscriptions.scala @@ -22,7 +22,7 @@ class Subscriptions @Inject() ( publication: Option[Publication], limit: Long = 25, offset: Long = 0 - ) = Identified.async { request => + ) = Identified { request => val subscriptions = subscriptionsDao.findAll( request.authorization, guid = guid, @@ -35,14 +35,14 @@ class Subscriptions @Inject() ( Ok(Json.toJson(subscriptions)) } - def getByGuid(guid: UUID) = Identified.async { request => + def getByGuid(guid: UUID) = Identified { request => subscriptionsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(subscription) => Ok(Json.toJson(subscription)) } } - def post() = Identified.async(parse.json) { request => + def post() = Identified(parse.json) { request => request.body.validate[SubscriptionForm] match { case e: JsError => { UnprocessableEntity(Json.toJson(Validation.invalidJson(e))) @@ -62,7 +62,7 @@ class Subscriptions @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified.async { request => + def deleteByGuid(guid: UUID) = Identified { request => subscriptionsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(subscription) => { diff --git a/api/app/controllers/Tokens.scala b/api/app/controllers/Tokens.scala index b81cc1639..064cb837c 100644 --- a/api/app/controllers/Tokens.scala +++ b/api/app/controllers/Tokens.scala @@ -20,7 +20,7 @@ class Tokens @Inject() ( guid: Option[UUID], limit: Long = 25, offset: Long = 0 - ) = Identified.async { request => + ) = Identified { request => val tokens = tokensDao.findAll( request.authorization, userGuid = Some(userGuid), @@ -33,7 +33,7 @@ class Tokens @Inject() ( def getCleartextByGuid( guid: UUID - ) = Identified.async { request => + ) = Identified { request => tokensDao.findCleartextByGuid(request.authorization, guid) match { case None => NotFound case Some(token) => { @@ -42,7 +42,7 @@ class Tokens @Inject() ( } } - def post() = Identified.async(parse.json) { request => + def post() = Identified(parse.json) { request => request.body.validate[TokenForm] match { case e: JsError => { UnprocessableEntity(Json.toJson(Validation.invalidJson(e))) @@ -62,7 +62,7 @@ class Tokens @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified.async { request => + def deleteByGuid(guid: UUID) = Identified { request => tokensDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(token) => { diff --git a/api/app/controllers/Users.scala b/api/app/controllers/Users.scala index dc26b8d1a..a2a70e179 100644 --- a/api/app/controllers/Users.scala +++ b/api/app/controllers/Users.scala @@ -35,7 +35,7 @@ class Users @Inject() ( email: Option[String], nickname: Option[String], token: Option[String] - ) = Identified.async { request => + ) = Identified { request => if (!Seq(guid, email, nickname, token).exists(_.isDefined)) { // require system user to show more then one user requireSystemUser(request.user) @@ -50,7 +50,7 @@ class Users @Inject() ( Ok(Json.toJson(users)) } - def getByGuid(guid: UUID) = Identified.async { request => + def getByGuid(guid: UUID) = Identified { request => requireSystemUser(request.user) usersDao.findByGuid(guid) match { case None => NotFound @@ -78,7 +78,7 @@ class Users @Inject() ( } } - def putByGuid(guid: UUID) = Identified.async(parse.json) { request => + def putByGuid(guid: UUID) = Identified(parse.json) { request => request.body.validate[UserUpdateForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) diff --git a/api/app/controllers/Versions.scala b/api/app/controllers/Versions.scala index 76e033791..d97301690 100644 --- a/api/app/controllers/Versions.scala +++ b/api/app/controllers/Versions.scala @@ -108,7 +108,7 @@ class Versions @Inject() ( def postByVersion( orgKey: String, versionName: String - ) = Identified.async { request => + ) = Identified { request => withOrg(request.authorization, orgKey) { org => request.body match { case AnyContentAsJson(json) => { @@ -157,7 +157,7 @@ class Versions @Inject() ( orgKey: String, applicationKey: String, versionName: String - ) = Identified.async { request => + ) = Identified { request => withOrg(request.authorization, orgKey) { org => request.body match { case AnyContentAsJson(json) => { @@ -200,7 +200,7 @@ class Versions @Inject() ( } } - def deleteByApplicationKeyAndVersion(orgKey: String, applicationKey: String, version: String) = Identified.async { request => + def deleteByApplicationKeyAndVersion(orgKey: String, applicationKey: String, version: String) = Identified { request => withOrgMember(request.user, orgKey) { _ => versionsDao.findVersion(request.authorization, orgKey, applicationKey, version).foreach { version => versionsDao.softDelete(request.user, version) diff --git a/api/app/controllers/Watches.scala b/api/app/controllers/Watches.scala index af294ac11..203ef4f91 100644 --- a/api/app/controllers/Watches.scala +++ b/api/app/controllers/Watches.scala @@ -22,7 +22,7 @@ class Watches @Inject() ( applicationKey: Option[String], limit: Long = 25, offset: Long = 0 - ) = Identified.async { request => + ) = Identified { request => val watches = watchesDao.findAll( request.authorization, guid = guid, @@ -35,7 +35,7 @@ class Watches @Inject() ( Ok(Json.toJson(watches)) } - def getByGuid(guid: UUID) = Identified.async { request => + def getByGuid(guid: UUID) = Identified { request => watchesDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(watch) => Ok(Json.toJson(watch)) @@ -46,7 +46,7 @@ class Watches @Inject() ( userGuid: scala.Option[_root_.java.util.UUID], organizationKey: String, applicationKey: String - ) = Identified.async { request => + ) = Identified { request => watchesDao.findAll( request.authorization, userGuid = userGuid, @@ -59,7 +59,7 @@ class Watches @Inject() ( } } - def post() = Identified.async(parse.json) { request => + def post() = Identified(parse.json) { request => request.body.validate[WatchForm] match { case e: JsError => { UnprocessableEntity(Json.toJson(Validation.invalidJson(e))) @@ -76,7 +76,7 @@ class Watches @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified.async { request => + def deleteByGuid(guid: UUID) = Identified { request => watchesDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(watch) => { From 702bdb1eff8e746b82bd57c1aa323e3625b50e1a Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Sat, 6 Jul 2024 10:58:08 -0400 Subject: [PATCH 67/95] wip --- .apibuilder/config | 1 - ...ApicollectiveApibuilderSpecV0Parsers.scala | 862 ------------------ 2 files changed, 863 deletions(-) delete mode 100644 api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala diff --git a/.apibuilder/config b/.apibuilder/config index 90777da7c..cbd5ffea9 100644 --- a/.apibuilder/config +++ b/.apibuilder/config @@ -16,7 +16,6 @@ code: play_2_x_standalone_json: lib/src/main/scala/generated play_2_9_scala_3_client: generated/app play_2_8_mock_client: generated/app - anorm_2_9_scala_3_parsers: api/app/generated apibuilder-common: version: latest generators: diff --git a/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala deleted file mode 100644 index d812c5869..000000000 --- a/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala +++ /dev/null @@ -1,862 +0,0 @@ -/** - * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.50 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-spec/latest/anorm_2_8_scala_3_parsers - */ -import anorm._ - -package io.apibuilder.spec.v0.anorm.parsers { - - import io.apibuilder.spec.v0.anorm.conversions.Standard._ - - import io.apibuilder.spec.v0.anorm.conversions.Types._ - - object Method { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Method] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser(name: String = "method", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.Method] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case value => io.apibuilder.spec.v0.models.Method(value) - } - } - - } - - object ParameterLocation { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.ParameterLocation] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser(name: String = "parameter_location", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.ParameterLocation] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case value => io.apibuilder.spec.v0.models.ParameterLocation(value) - } - } - - } - - object ResponseCodeOption { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.ResponseCodeOption] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser(name: String = "response_code_option", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.ResponseCodeOption] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case value => io.apibuilder.spec.v0.models.ResponseCodeOption(value) - } - } - - } - - object Annotation { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Annotation] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - description: String = "description", - deprecationPrefix: String = "deprecation", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Annotation] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? map { - case name ~ description ~ deprecation => { - io.apibuilder.spec.v0.models.Annotation( - name = name, - description = description, - deprecation = deprecation - ) - } - } - } - - } - - object Apidoc { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Apidoc] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - version: String = "version", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Apidoc] = { - SqlParser.str(prefixOpt.getOrElse("") + version) map { - case version => { - io.apibuilder.spec.v0.models.Apidoc( - version = version - ) - } - } - } - - } - - object Application { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Application] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - key: String = "key", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Application] = { - SqlParser.str(prefixOpt.getOrElse("") + key) map { - case key => { - io.apibuilder.spec.v0.models.Application( - key = key - ) - } - } - } - - } - - object Attribute { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Attribute] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - value: String = "value", - description: String = "description", - deprecationPrefix: String = "deprecation", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Attribute] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.get[_root_.play.api.libs.json.JsObject](prefixOpt.getOrElse("") + value) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? map { - case name ~ value ~ description ~ deprecation => { - io.apibuilder.spec.v0.models.Attribute( - name = name, - value = value, - description = description, - deprecation = deprecation - ) - } - } - } - - } - - object Body { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Body] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - `type`: String = "type", - description: String = "description", - deprecationPrefix: String = "deprecation", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Body] = { - SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { - case typeInstance ~ description ~ deprecation ~ attributes => { - io.apibuilder.spec.v0.models.Body( - `type` = typeInstance, - description = description, - deprecation = deprecation, - attributes = attributes - ) - } - } - } - - } - - object Contact { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Contact] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - url: String = "url", - email: String = "email", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Contact] = { - SqlParser.str(prefixOpt.getOrElse("") + name).? ~ - SqlParser.str(prefixOpt.getOrElse("") + url).? ~ - SqlParser.str(prefixOpt.getOrElse("") + email).? map { - case name ~ url ~ email => { - io.apibuilder.spec.v0.models.Contact( - name = name, - url = url, - email = email - ) - } - } - } - - } - - object Deprecation { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Deprecation] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - description: String = "description", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Deprecation] = { - SqlParser.str(prefixOpt.getOrElse("") + description).? map { - case description => { - io.apibuilder.spec.v0.models.Deprecation( - description = description - ) - } - } - } - - } - - object Enum { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Enum] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - plural: String = "plural", - description: String = "description", - deprecationPrefix: String = "deprecation", - values: String = "values", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Enum] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + plural) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.EnumValue]](prefixOpt.getOrElse("") + values) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { - case name ~ plural ~ description ~ deprecation ~ values ~ attributes => { - io.apibuilder.spec.v0.models.Enum( - name = name, - plural = plural, - description = description, - deprecation = deprecation, - values = values, - attributes = attributes - ) - } - } - } - - } - - object EnumValue { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.EnumValue] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - description: String = "description", - deprecationPrefix: String = "deprecation", - attributes: String = "attributes", - value: String = "value", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.EnumValue] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ - SqlParser.str(prefixOpt.getOrElse("") + value).? map { - case name ~ description ~ deprecation ~ attributes ~ value => { - io.apibuilder.spec.v0.models.EnumValue( - name = name, - description = description, - deprecation = deprecation, - attributes = attributes, - value = value - ) - } - } - } - - } - - object Field { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Field] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - `type`: String = "type", - description: String = "description", - deprecationPrefix: String = "deprecation", - default: String = "default", - required: String = "required", - minimum: String = "minimum", - maximum: String = "maximum", - example: String = "example", - attributes: String = "attributes", - annotations: String = "annotations", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Field] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.str(prefixOpt.getOrElse("") + default).? ~ - SqlParser.bool(prefixOpt.getOrElse("") + required) ~ - SqlParser.long(prefixOpt.getOrElse("") + minimum).? ~ - SqlParser.long(prefixOpt.getOrElse("") + maximum).? ~ - SqlParser.str(prefixOpt.getOrElse("") + example).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + annotations) map { - case name ~ typeInstance ~ description ~ deprecation ~ default ~ required ~ minimum ~ maximum ~ example ~ attributes ~ annotations => { - io.apibuilder.spec.v0.models.Field( - name = name, - `type` = typeInstance, - description = description, - deprecation = deprecation, - default = default, - required = required, - minimum = minimum, - maximum = maximum, - example = example, - attributes = attributes, - annotations = annotations - ) - } - } - } - - } - - object Header { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Header] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - `type`: String = "type", - description: String = "description", - deprecationPrefix: String = "deprecation", - required: String = "required", - default: String = "default", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Header] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.bool(prefixOpt.getOrElse("") + required) ~ - SqlParser.str(prefixOpt.getOrElse("") + default).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { - case name ~ typeInstance ~ description ~ deprecation ~ required ~ default ~ attributes => { - io.apibuilder.spec.v0.models.Header( - name = name, - `type` = typeInstance, - description = description, - deprecation = deprecation, - required = required, - default = default, - attributes = attributes - ) - } - } - } - - } - - object Import { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Import] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - uri: String = "uri", - namespace: String = "namespace", - organizationPrefix: String = "organization", - applicationPrefix: String = "application", - version: String = "version", - enums: String = "enums", - interfaces: String = "interfaces", - unions: String = "unions", - models: String = "models", - annotations: String = "annotations", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Import] = { - SqlParser.str(prefixOpt.getOrElse("") + uri) ~ - SqlParser.str(prefixOpt.getOrElse("") + namespace) ~ - io.apibuilder.spec.v0.anorm.parsers.Organization.parserWithPrefix(prefixOpt.getOrElse("") + organizationPrefix) ~ - io.apibuilder.spec.v0.anorm.parsers.Application.parserWithPrefix(prefixOpt.getOrElse("") + applicationPrefix) ~ - SqlParser.str(prefixOpt.getOrElse("") + version) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + enums) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + interfaces) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + unions) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + models) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Annotation]](prefixOpt.getOrElse("") + annotations) map { - case uri ~ namespace ~ organization ~ application ~ version ~ enums ~ interfaces ~ unions ~ models ~ annotations => { - io.apibuilder.spec.v0.models.Import( - uri = uri, - namespace = namespace, - organization = organization, - application = application, - version = version, - enums = enums, - interfaces = interfaces, - unions = unions, - models = models, - annotations = annotations - ) - } - } - } - - } - - object Info { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Info] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - licensePrefix: String = "license", - contactPrefix: String = "contact", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Info] = { - io.apibuilder.spec.v0.anorm.parsers.License.parserWithPrefix(prefixOpt.getOrElse("") + licensePrefix).? ~ - io.apibuilder.spec.v0.anorm.parsers.Contact.parserWithPrefix(prefixOpt.getOrElse("") + contactPrefix).? map { - case license ~ contact => { - io.apibuilder.spec.v0.models.Info( - license = license, - contact = contact - ) - } - } - } - - } - - object Interface { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Interface] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - plural: String = "plural", - description: String = "description", - deprecationPrefix: String = "deprecation", - fields: String = "fields", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Interface] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + plural) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Field]](prefixOpt.getOrElse("") + fields) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { - case name ~ plural ~ description ~ deprecation ~ fields ~ attributes => { - io.apibuilder.spec.v0.models.Interface( - name = name, - plural = plural, - description = description, - deprecation = deprecation, - fields = fields, - attributes = attributes - ) - } - } - } - - } - - object License { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.License] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - url: String = "url", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.License] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + url).? map { - case name ~ url => { - io.apibuilder.spec.v0.models.License( - name = name, - url = url - ) - } - } - } - - } - - object Model { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Model] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - plural: String = "plural", - description: String = "description", - deprecationPrefix: String = "deprecation", - fields: String = "fields", - attributes: String = "attributes", - interfaces: String = "interfaces", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Model] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + plural) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Field]](prefixOpt.getOrElse("") + fields) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + interfaces) map { - case name ~ plural ~ description ~ deprecation ~ fields ~ attributes ~ interfaces => { - io.apibuilder.spec.v0.models.Model( - name = name, - plural = plural, - description = description, - deprecation = deprecation, - fields = fields, - attributes = attributes, - interfaces = interfaces - ) - } - } - } - - } - - object Operation { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Operation] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - method: String = "method", - path: String = "path", - description: String = "description", - deprecationPrefix: String = "deprecation", - bodyPrefix: String = "body", - parameters: String = "parameters", - responses: String = "responses", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Operation] = { - io.apibuilder.spec.v0.anorm.parsers.Method.parser(prefixOpt.getOrElse("") + method) ~ - SqlParser.str(prefixOpt.getOrElse("") + path) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - io.apibuilder.spec.v0.anorm.parsers.Body.parserWithPrefix(prefixOpt.getOrElse("") + bodyPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Parameter]](prefixOpt.getOrElse("") + parameters) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Response]](prefixOpt.getOrElse("") + responses) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { - case method ~ path ~ description ~ deprecation ~ body ~ parameters ~ responses ~ attributes => { - io.apibuilder.spec.v0.models.Operation( - method = method, - path = path, - description = description, - deprecation = deprecation, - body = body, - parameters = parameters, - responses = responses, - attributes = attributes - ) - } - } - } - - } - - object Organization { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Organization] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - key: String = "key", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Organization] = { - SqlParser.str(prefixOpt.getOrElse("") + key) map { - case key => { - io.apibuilder.spec.v0.models.Organization( - key = key - ) - } - } - } - - } - - object Parameter { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Parameter] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - `type`: String = "type", - location: String = "location", - description: String = "description", - deprecationPrefix: String = "deprecation", - required: String = "required", - default: String = "default", - minimum: String = "minimum", - maximum: String = "maximum", - example: String = "example", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Parameter] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ - io.apibuilder.spec.v0.anorm.parsers.ParameterLocation.parser(prefixOpt.getOrElse("") + location) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.bool(prefixOpt.getOrElse("") + required) ~ - SqlParser.str(prefixOpt.getOrElse("") + default).? ~ - SqlParser.long(prefixOpt.getOrElse("") + minimum).? ~ - SqlParser.long(prefixOpt.getOrElse("") + maximum).? ~ - SqlParser.str(prefixOpt.getOrElse("") + example).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes).? map { - case name ~ typeInstance ~ location ~ description ~ deprecation ~ required ~ default ~ minimum ~ maximum ~ example ~ attributes => { - io.apibuilder.spec.v0.models.Parameter( - name = name, - `type` = typeInstance, - location = location, - description = description, - deprecation = deprecation, - required = required, - default = default, - minimum = minimum, - maximum = maximum, - example = example, - attributes = attributes - ) - } - } - } - - } - - object Resource { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Resource] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - `type`: String = "type", - plural: String = "plural", - path: String = "path", - description: String = "description", - deprecationPrefix: String = "deprecation", - operations: String = "operations", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Resource] = { - SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ - SqlParser.str(prefixOpt.getOrElse("") + plural) ~ - SqlParser.str(prefixOpt.getOrElse("") + path).? ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Operation]](prefixOpt.getOrElse("") + operations) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { - case typeInstance ~ plural ~ path ~ description ~ deprecation ~ operations ~ attributes => { - io.apibuilder.spec.v0.models.Resource( - `type` = typeInstance, - plural = plural, - path = path, - description = description, - deprecation = deprecation, - operations = operations, - attributes = attributes - ) - } - } - } - - } - - object Response { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Response] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - codePrefix: String = "code", - `type`: String = "type", - headers: String = "headers", - description: String = "description", - deprecationPrefix: String = "deprecation", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Response] = { - io.apibuilder.spec.v0.anorm.parsers.ResponseCode.parserWithPrefix(prefixOpt.getOrElse("") + codePrefix) ~ - SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Header]](prefixOpt.getOrElse("") + headers).? ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes).? map { - case code ~ typeInstance ~ headers ~ description ~ deprecation ~ attributes => { - io.apibuilder.spec.v0.models.Response( - code = code, - `type` = typeInstance, - headers = headers, - description = description, - deprecation = deprecation, - attributes = attributes - ) - } - } - } - - } - - object Service { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Service] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - apidocPrefix: String = "apidoc", - name: String = "name", - organizationPrefix: String = "organization", - applicationPrefix: String = "application", - namespace: String = "namespace", - version: String = "version", - baseUrl: String = "base_url", - description: String = "description", - infoPrefix: String = "info", - headers: String = "headers", - imports: String = "imports", - enums: String = "enums", - interfaces: String = "interfaces", - unions: String = "unions", - models: String = "models", - resources: String = "resources", - attributes: String = "attributes", - annotations: String = "annotations", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Service] = { - io.apibuilder.spec.v0.anorm.parsers.Apidoc.parserWithPrefix(prefixOpt.getOrElse("") + apidocPrefix).? ~ - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - io.apibuilder.spec.v0.anorm.parsers.Organization.parserWithPrefix(prefixOpt.getOrElse("") + organizationPrefix) ~ - io.apibuilder.spec.v0.anorm.parsers.Application.parserWithPrefix(prefixOpt.getOrElse("") + applicationPrefix) ~ - SqlParser.str(prefixOpt.getOrElse("") + namespace) ~ - SqlParser.str(prefixOpt.getOrElse("") + version) ~ - SqlParser.str(prefixOpt.getOrElse("") + baseUrl).? ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Info.parserWithPrefix(prefixOpt.getOrElse("") + infoPrefix) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Header]](prefixOpt.getOrElse("") + headers) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Import]](prefixOpt.getOrElse("") + imports) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Enum]](prefixOpt.getOrElse("") + enums) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Interface]](prefixOpt.getOrElse("") + interfaces) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Union]](prefixOpt.getOrElse("") + unions) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Model]](prefixOpt.getOrElse("") + models) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Resource]](prefixOpt.getOrElse("") + resources) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Annotation]](prefixOpt.getOrElse("") + annotations) map { - case apidoc ~ name ~ organization ~ application ~ namespace ~ version ~ baseUrl ~ description ~ info ~ headers ~ imports ~ enums ~ interfaces ~ unions ~ models ~ resources ~ attributes ~ annotations => { - io.apibuilder.spec.v0.models.Service( - apidoc = apidoc, - name = name, - organization = organization, - application = application, - namespace = namespace, - version = version, - baseUrl = baseUrl, - description = description, - info = info, - headers = headers, - imports = imports, - enums = enums, - interfaces = interfaces, - unions = unions, - models = models, - resources = resources, - attributes = attributes, - annotations = annotations - ) - } - } - } - - } - - object Union { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Union] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - plural: String = "plural", - discriminator: String = "discriminator", - description: String = "description", - deprecationPrefix: String = "deprecation", - types: String = "types", - attributes: String = "attributes", - interfaces: String = "interfaces", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Union] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + plural) ~ - SqlParser.str(prefixOpt.getOrElse("") + discriminator).? ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.UnionType]](prefixOpt.getOrElse("") + types) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + interfaces) map { - case name ~ plural ~ discriminator ~ description ~ deprecation ~ types ~ attributes ~ interfaces => { - io.apibuilder.spec.v0.models.Union( - name = name, - plural = plural, - discriminator = discriminator, - description = description, - deprecation = deprecation, - types = types, - attributes = attributes, - interfaces = interfaces - ) - } - } - } - - } - - object UnionType { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.UnionType] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - `type`: String = "type", - description: String = "description", - deprecationPrefix: String = "deprecation", - attributes: String = "attributes", - default: String = "default", - discriminatorValue: String = "discriminator_value", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.UnionType] = { - SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ - SqlParser.bool(prefixOpt.getOrElse("") + default).? ~ - SqlParser.str(prefixOpt.getOrElse("") + discriminatorValue).? map { - case typeInstance ~ description ~ deprecation ~ attributes ~ default ~ discriminatorValue => { - io.apibuilder.spec.v0.models.UnionType( - `type` = typeInstance, - description = description, - deprecation = deprecation, - attributes = attributes, - default = default, - discriminatorValue = discriminatorValue - ) - } - } - } - - } - - object ResponseCode { - - def parserWithPrefix(prefix: String, sep: String = "_") = { - SqlParser.int(s"$prefix${sep}response_code").map(io.apibuilder.spec.v0.models.ResponseCodeInt.apply) | - io.apibuilder.spec.v0.anorm.parsers.ResponseCodeOption.parser("response_code", Some(s"$prefix$sep")) - } - - def parser() = { - SqlParser.int("response_code").map(io.apibuilder.spec.v0.models.ResponseCodeInt.apply) | - io.apibuilder.spec.v0.anorm.parsers.ResponseCodeOption.parser("response_code") - } - - } - -} \ No newline at end of file From d44841a27516f27b52222c7597c35555d4878e11 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Sat, 6 Jul 2024 10:58:28 -0400 Subject: [PATCH 68/95] Revert "wip" This reverts commit 702bdb1eff8e746b82bd57c1aa323e3625b50e1a. --- .apibuilder/config | 1 + ...ApicollectiveApibuilderSpecV0Parsers.scala | 862 ++++++++++++++++++ 2 files changed, 863 insertions(+) create mode 100644 api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala diff --git a/.apibuilder/config b/.apibuilder/config index cbd5ffea9..90777da7c 100644 --- a/.apibuilder/config +++ b/.apibuilder/config @@ -16,6 +16,7 @@ code: play_2_x_standalone_json: lib/src/main/scala/generated play_2_9_scala_3_client: generated/app play_2_8_mock_client: generated/app + anorm_2_9_scala_3_parsers: api/app/generated apibuilder-common: version: latest generators: diff --git a/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala new file mode 100644 index 000000000..d812c5869 --- /dev/null +++ b/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala @@ -0,0 +1,862 @@ +/** + * Generated by API Builder - https://www.apibuilder.io + * Service version: 0.16.50 + * User agent: apibuilder localhost 9000/apicollective/apibuilder-spec/latest/anorm_2_8_scala_3_parsers + */ +import anorm._ + +package io.apibuilder.spec.v0.anorm.parsers { + + import io.apibuilder.spec.v0.anorm.conversions.Standard._ + + import io.apibuilder.spec.v0.anorm.conversions.Types._ + + object Method { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Method] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser(name: String = "method", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.Method] = { + SqlParser.str(prefixOpt.getOrElse("") + name) map { + case value => io.apibuilder.spec.v0.models.Method(value) + } + } + + } + + object ParameterLocation { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.ParameterLocation] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser(name: String = "parameter_location", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.ParameterLocation] = { + SqlParser.str(prefixOpt.getOrElse("") + name) map { + case value => io.apibuilder.spec.v0.models.ParameterLocation(value) + } + } + + } + + object ResponseCodeOption { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.ResponseCodeOption] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser(name: String = "response_code_option", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.ResponseCodeOption] = { + SqlParser.str(prefixOpt.getOrElse("") + name) map { + case value => io.apibuilder.spec.v0.models.ResponseCodeOption(value) + } + } + + } + + object Annotation { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Annotation] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + name: String = "name", + description: String = "description", + deprecationPrefix: String = "deprecation", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Annotation] = { + SqlParser.str(prefixOpt.getOrElse("") + name) ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? map { + case name ~ description ~ deprecation => { + io.apibuilder.spec.v0.models.Annotation( + name = name, + description = description, + deprecation = deprecation + ) + } + } + } + + } + + object Apidoc { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Apidoc] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + version: String = "version", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Apidoc] = { + SqlParser.str(prefixOpt.getOrElse("") + version) map { + case version => { + io.apibuilder.spec.v0.models.Apidoc( + version = version + ) + } + } + } + + } + + object Application { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Application] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + key: String = "key", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Application] = { + SqlParser.str(prefixOpt.getOrElse("") + key) map { + case key => { + io.apibuilder.spec.v0.models.Application( + key = key + ) + } + } + } + + } + + object Attribute { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Attribute] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + name: String = "name", + value: String = "value", + description: String = "description", + deprecationPrefix: String = "deprecation", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Attribute] = { + SqlParser.str(prefixOpt.getOrElse("") + name) ~ + SqlParser.get[_root_.play.api.libs.json.JsObject](prefixOpt.getOrElse("") + value) ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? map { + case name ~ value ~ description ~ deprecation => { + io.apibuilder.spec.v0.models.Attribute( + name = name, + value = value, + description = description, + deprecation = deprecation + ) + } + } + } + + } + + object Body { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Body] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + `type`: String = "type", + description: String = "description", + deprecationPrefix: String = "deprecation", + attributes: String = "attributes", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Body] = { + SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { + case typeInstance ~ description ~ deprecation ~ attributes => { + io.apibuilder.spec.v0.models.Body( + `type` = typeInstance, + description = description, + deprecation = deprecation, + attributes = attributes + ) + } + } + } + + } + + object Contact { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Contact] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + name: String = "name", + url: String = "url", + email: String = "email", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Contact] = { + SqlParser.str(prefixOpt.getOrElse("") + name).? ~ + SqlParser.str(prefixOpt.getOrElse("") + url).? ~ + SqlParser.str(prefixOpt.getOrElse("") + email).? map { + case name ~ url ~ email => { + io.apibuilder.spec.v0.models.Contact( + name = name, + url = url, + email = email + ) + } + } + } + + } + + object Deprecation { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Deprecation] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + description: String = "description", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Deprecation] = { + SqlParser.str(prefixOpt.getOrElse("") + description).? map { + case description => { + io.apibuilder.spec.v0.models.Deprecation( + description = description + ) + } + } + } + + } + + object Enum { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Enum] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + name: String = "name", + plural: String = "plural", + description: String = "description", + deprecationPrefix: String = "deprecation", + values: String = "values", + attributes: String = "attributes", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Enum] = { + SqlParser.str(prefixOpt.getOrElse("") + name) ~ + SqlParser.str(prefixOpt.getOrElse("") + plural) ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.EnumValue]](prefixOpt.getOrElse("") + values) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { + case name ~ plural ~ description ~ deprecation ~ values ~ attributes => { + io.apibuilder.spec.v0.models.Enum( + name = name, + plural = plural, + description = description, + deprecation = deprecation, + values = values, + attributes = attributes + ) + } + } + } + + } + + object EnumValue { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.EnumValue] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + name: String = "name", + description: String = "description", + deprecationPrefix: String = "deprecation", + attributes: String = "attributes", + value: String = "value", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.EnumValue] = { + SqlParser.str(prefixOpt.getOrElse("") + name) ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ + SqlParser.str(prefixOpt.getOrElse("") + value).? map { + case name ~ description ~ deprecation ~ attributes ~ value => { + io.apibuilder.spec.v0.models.EnumValue( + name = name, + description = description, + deprecation = deprecation, + attributes = attributes, + value = value + ) + } + } + } + + } + + object Field { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Field] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + name: String = "name", + `type`: String = "type", + description: String = "description", + deprecationPrefix: String = "deprecation", + default: String = "default", + required: String = "required", + minimum: String = "minimum", + maximum: String = "maximum", + example: String = "example", + attributes: String = "attributes", + annotations: String = "annotations", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Field] = { + SqlParser.str(prefixOpt.getOrElse("") + name) ~ + SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ + SqlParser.str(prefixOpt.getOrElse("") + default).? ~ + SqlParser.bool(prefixOpt.getOrElse("") + required) ~ + SqlParser.long(prefixOpt.getOrElse("") + minimum).? ~ + SqlParser.long(prefixOpt.getOrElse("") + maximum).? ~ + SqlParser.str(prefixOpt.getOrElse("") + example).? ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ + SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + annotations) map { + case name ~ typeInstance ~ description ~ deprecation ~ default ~ required ~ minimum ~ maximum ~ example ~ attributes ~ annotations => { + io.apibuilder.spec.v0.models.Field( + name = name, + `type` = typeInstance, + description = description, + deprecation = deprecation, + default = default, + required = required, + minimum = minimum, + maximum = maximum, + example = example, + attributes = attributes, + annotations = annotations + ) + } + } + } + + } + + object Header { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Header] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + name: String = "name", + `type`: String = "type", + description: String = "description", + deprecationPrefix: String = "deprecation", + required: String = "required", + default: String = "default", + attributes: String = "attributes", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Header] = { + SqlParser.str(prefixOpt.getOrElse("") + name) ~ + SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ + SqlParser.bool(prefixOpt.getOrElse("") + required) ~ + SqlParser.str(prefixOpt.getOrElse("") + default).? ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { + case name ~ typeInstance ~ description ~ deprecation ~ required ~ default ~ attributes => { + io.apibuilder.spec.v0.models.Header( + name = name, + `type` = typeInstance, + description = description, + deprecation = deprecation, + required = required, + default = default, + attributes = attributes + ) + } + } + } + + } + + object Import { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Import] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + uri: String = "uri", + namespace: String = "namespace", + organizationPrefix: String = "organization", + applicationPrefix: String = "application", + version: String = "version", + enums: String = "enums", + interfaces: String = "interfaces", + unions: String = "unions", + models: String = "models", + annotations: String = "annotations", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Import] = { + SqlParser.str(prefixOpt.getOrElse("") + uri) ~ + SqlParser.str(prefixOpt.getOrElse("") + namespace) ~ + io.apibuilder.spec.v0.anorm.parsers.Organization.parserWithPrefix(prefixOpt.getOrElse("") + organizationPrefix) ~ + io.apibuilder.spec.v0.anorm.parsers.Application.parserWithPrefix(prefixOpt.getOrElse("") + applicationPrefix) ~ + SqlParser.str(prefixOpt.getOrElse("") + version) ~ + SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + enums) ~ + SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + interfaces) ~ + SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + unions) ~ + SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + models) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Annotation]](prefixOpt.getOrElse("") + annotations) map { + case uri ~ namespace ~ organization ~ application ~ version ~ enums ~ interfaces ~ unions ~ models ~ annotations => { + io.apibuilder.spec.v0.models.Import( + uri = uri, + namespace = namespace, + organization = organization, + application = application, + version = version, + enums = enums, + interfaces = interfaces, + unions = unions, + models = models, + annotations = annotations + ) + } + } + } + + } + + object Info { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Info] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + licensePrefix: String = "license", + contactPrefix: String = "contact", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Info] = { + io.apibuilder.spec.v0.anorm.parsers.License.parserWithPrefix(prefixOpt.getOrElse("") + licensePrefix).? ~ + io.apibuilder.spec.v0.anorm.parsers.Contact.parserWithPrefix(prefixOpt.getOrElse("") + contactPrefix).? map { + case license ~ contact => { + io.apibuilder.spec.v0.models.Info( + license = license, + contact = contact + ) + } + } + } + + } + + object Interface { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Interface] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + name: String = "name", + plural: String = "plural", + description: String = "description", + deprecationPrefix: String = "deprecation", + fields: String = "fields", + attributes: String = "attributes", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Interface] = { + SqlParser.str(prefixOpt.getOrElse("") + name) ~ + SqlParser.str(prefixOpt.getOrElse("") + plural) ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Field]](prefixOpt.getOrElse("") + fields) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { + case name ~ plural ~ description ~ deprecation ~ fields ~ attributes => { + io.apibuilder.spec.v0.models.Interface( + name = name, + plural = plural, + description = description, + deprecation = deprecation, + fields = fields, + attributes = attributes + ) + } + } + } + + } + + object License { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.License] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + name: String = "name", + url: String = "url", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.License] = { + SqlParser.str(prefixOpt.getOrElse("") + name) ~ + SqlParser.str(prefixOpt.getOrElse("") + url).? map { + case name ~ url => { + io.apibuilder.spec.v0.models.License( + name = name, + url = url + ) + } + } + } + + } + + object Model { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Model] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + name: String = "name", + plural: String = "plural", + description: String = "description", + deprecationPrefix: String = "deprecation", + fields: String = "fields", + attributes: String = "attributes", + interfaces: String = "interfaces", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Model] = { + SqlParser.str(prefixOpt.getOrElse("") + name) ~ + SqlParser.str(prefixOpt.getOrElse("") + plural) ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Field]](prefixOpt.getOrElse("") + fields) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ + SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + interfaces) map { + case name ~ plural ~ description ~ deprecation ~ fields ~ attributes ~ interfaces => { + io.apibuilder.spec.v0.models.Model( + name = name, + plural = plural, + description = description, + deprecation = deprecation, + fields = fields, + attributes = attributes, + interfaces = interfaces + ) + } + } + } + + } + + object Operation { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Operation] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + method: String = "method", + path: String = "path", + description: String = "description", + deprecationPrefix: String = "deprecation", + bodyPrefix: String = "body", + parameters: String = "parameters", + responses: String = "responses", + attributes: String = "attributes", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Operation] = { + io.apibuilder.spec.v0.anorm.parsers.Method.parser(prefixOpt.getOrElse("") + method) ~ + SqlParser.str(prefixOpt.getOrElse("") + path) ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ + io.apibuilder.spec.v0.anorm.parsers.Body.parserWithPrefix(prefixOpt.getOrElse("") + bodyPrefix).? ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Parameter]](prefixOpt.getOrElse("") + parameters) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Response]](prefixOpt.getOrElse("") + responses) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { + case method ~ path ~ description ~ deprecation ~ body ~ parameters ~ responses ~ attributes => { + io.apibuilder.spec.v0.models.Operation( + method = method, + path = path, + description = description, + deprecation = deprecation, + body = body, + parameters = parameters, + responses = responses, + attributes = attributes + ) + } + } + } + + } + + object Organization { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Organization] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + key: String = "key", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Organization] = { + SqlParser.str(prefixOpt.getOrElse("") + key) map { + case key => { + io.apibuilder.spec.v0.models.Organization( + key = key + ) + } + } + } + + } + + object Parameter { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Parameter] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + name: String = "name", + `type`: String = "type", + location: String = "location", + description: String = "description", + deprecationPrefix: String = "deprecation", + required: String = "required", + default: String = "default", + minimum: String = "minimum", + maximum: String = "maximum", + example: String = "example", + attributes: String = "attributes", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Parameter] = { + SqlParser.str(prefixOpt.getOrElse("") + name) ~ + SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ + io.apibuilder.spec.v0.anorm.parsers.ParameterLocation.parser(prefixOpt.getOrElse("") + location) ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ + SqlParser.bool(prefixOpt.getOrElse("") + required) ~ + SqlParser.str(prefixOpt.getOrElse("") + default).? ~ + SqlParser.long(prefixOpt.getOrElse("") + minimum).? ~ + SqlParser.long(prefixOpt.getOrElse("") + maximum).? ~ + SqlParser.str(prefixOpt.getOrElse("") + example).? ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes).? map { + case name ~ typeInstance ~ location ~ description ~ deprecation ~ required ~ default ~ minimum ~ maximum ~ example ~ attributes => { + io.apibuilder.spec.v0.models.Parameter( + name = name, + `type` = typeInstance, + location = location, + description = description, + deprecation = deprecation, + required = required, + default = default, + minimum = minimum, + maximum = maximum, + example = example, + attributes = attributes + ) + } + } + } + + } + + object Resource { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Resource] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + `type`: String = "type", + plural: String = "plural", + path: String = "path", + description: String = "description", + deprecationPrefix: String = "deprecation", + operations: String = "operations", + attributes: String = "attributes", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Resource] = { + SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ + SqlParser.str(prefixOpt.getOrElse("") + plural) ~ + SqlParser.str(prefixOpt.getOrElse("") + path).? ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Operation]](prefixOpt.getOrElse("") + operations) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { + case typeInstance ~ plural ~ path ~ description ~ deprecation ~ operations ~ attributes => { + io.apibuilder.spec.v0.models.Resource( + `type` = typeInstance, + plural = plural, + path = path, + description = description, + deprecation = deprecation, + operations = operations, + attributes = attributes + ) + } + } + } + + } + + object Response { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Response] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + codePrefix: String = "code", + `type`: String = "type", + headers: String = "headers", + description: String = "description", + deprecationPrefix: String = "deprecation", + attributes: String = "attributes", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Response] = { + io.apibuilder.spec.v0.anorm.parsers.ResponseCode.parserWithPrefix(prefixOpt.getOrElse("") + codePrefix) ~ + SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Header]](prefixOpt.getOrElse("") + headers).? ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes).? map { + case code ~ typeInstance ~ headers ~ description ~ deprecation ~ attributes => { + io.apibuilder.spec.v0.models.Response( + code = code, + `type` = typeInstance, + headers = headers, + description = description, + deprecation = deprecation, + attributes = attributes + ) + } + } + } + + } + + object Service { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Service] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + apidocPrefix: String = "apidoc", + name: String = "name", + organizationPrefix: String = "organization", + applicationPrefix: String = "application", + namespace: String = "namespace", + version: String = "version", + baseUrl: String = "base_url", + description: String = "description", + infoPrefix: String = "info", + headers: String = "headers", + imports: String = "imports", + enums: String = "enums", + interfaces: String = "interfaces", + unions: String = "unions", + models: String = "models", + resources: String = "resources", + attributes: String = "attributes", + annotations: String = "annotations", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Service] = { + io.apibuilder.spec.v0.anorm.parsers.Apidoc.parserWithPrefix(prefixOpt.getOrElse("") + apidocPrefix).? ~ + SqlParser.str(prefixOpt.getOrElse("") + name) ~ + io.apibuilder.spec.v0.anorm.parsers.Organization.parserWithPrefix(prefixOpt.getOrElse("") + organizationPrefix) ~ + io.apibuilder.spec.v0.anorm.parsers.Application.parserWithPrefix(prefixOpt.getOrElse("") + applicationPrefix) ~ + SqlParser.str(prefixOpt.getOrElse("") + namespace) ~ + SqlParser.str(prefixOpt.getOrElse("") + version) ~ + SqlParser.str(prefixOpt.getOrElse("") + baseUrl).? ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Info.parserWithPrefix(prefixOpt.getOrElse("") + infoPrefix) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Header]](prefixOpt.getOrElse("") + headers) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Import]](prefixOpt.getOrElse("") + imports) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Enum]](prefixOpt.getOrElse("") + enums) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Interface]](prefixOpt.getOrElse("") + interfaces) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Union]](prefixOpt.getOrElse("") + unions) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Model]](prefixOpt.getOrElse("") + models) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Resource]](prefixOpt.getOrElse("") + resources) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Annotation]](prefixOpt.getOrElse("") + annotations) map { + case apidoc ~ name ~ organization ~ application ~ namespace ~ version ~ baseUrl ~ description ~ info ~ headers ~ imports ~ enums ~ interfaces ~ unions ~ models ~ resources ~ attributes ~ annotations => { + io.apibuilder.spec.v0.models.Service( + apidoc = apidoc, + name = name, + organization = organization, + application = application, + namespace = namespace, + version = version, + baseUrl = baseUrl, + description = description, + info = info, + headers = headers, + imports = imports, + enums = enums, + interfaces = interfaces, + unions = unions, + models = models, + resources = resources, + attributes = attributes, + annotations = annotations + ) + } + } + } + + } + + object Union { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Union] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + name: String = "name", + plural: String = "plural", + discriminator: String = "discriminator", + description: String = "description", + deprecationPrefix: String = "deprecation", + types: String = "types", + attributes: String = "attributes", + interfaces: String = "interfaces", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.Union] = { + SqlParser.str(prefixOpt.getOrElse("") + name) ~ + SqlParser.str(prefixOpt.getOrElse("") + plural) ~ + SqlParser.str(prefixOpt.getOrElse("") + discriminator).? ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.UnionType]](prefixOpt.getOrElse("") + types) ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ + SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + interfaces) map { + case name ~ plural ~ discriminator ~ description ~ deprecation ~ types ~ attributes ~ interfaces => { + io.apibuilder.spec.v0.models.Union( + name = name, + plural = plural, + discriminator = discriminator, + description = description, + deprecation = deprecation, + types = types, + attributes = attributes, + interfaces = interfaces + ) + } + } + } + + } + + object UnionType { + + def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.UnionType] = parser(prefixOpt = Some(s"$prefix$sep")) + + def parser( + `type`: String = "type", + description: String = "description", + deprecationPrefix: String = "deprecation", + attributes: String = "attributes", + default: String = "default", + discriminatorValue: String = "discriminator_value", + prefixOpt: Option[String] = None + ): RowParser[io.apibuilder.spec.v0.models.UnionType] = { + SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ + SqlParser.str(prefixOpt.getOrElse("") + description).? ~ + io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ + SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ + SqlParser.bool(prefixOpt.getOrElse("") + default).? ~ + SqlParser.str(prefixOpt.getOrElse("") + discriminatorValue).? map { + case typeInstance ~ description ~ deprecation ~ attributes ~ default ~ discriminatorValue => { + io.apibuilder.spec.v0.models.UnionType( + `type` = typeInstance, + description = description, + deprecation = deprecation, + attributes = attributes, + default = default, + discriminatorValue = discriminatorValue + ) + } + } + } + + } + + object ResponseCode { + + def parserWithPrefix(prefix: String, sep: String = "_") = { + SqlParser.int(s"$prefix${sep}response_code").map(io.apibuilder.spec.v0.models.ResponseCodeInt.apply) | + io.apibuilder.spec.v0.anorm.parsers.ResponseCodeOption.parser("response_code", Some(s"$prefix$sep")) + } + + def parser() = { + SqlParser.int("response_code").map(io.apibuilder.spec.v0.models.ResponseCodeInt.apply) | + io.apibuilder.spec.v0.anorm.parsers.ResponseCodeOption.parser("response_code") + } + + } + +} \ No newline at end of file From 19b6bd74d85fc144bf06df15dd136e541cea7038 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Sat, 6 Jul 2024 11:23:26 -0400 Subject: [PATCH 69/95] wip --- api/app/controllers/ApiBuilderController.scala | 4 ++-- api/app/controllers/Applications.scala | 14 +++++++------- api/app/controllers/Attributes.scala | 8 ++++---- api/app/controllers/Authentications.scala | 2 +- .../BatchDownloadApplications.scala | 6 ++++-- api/app/controllers/Changes.scala | 2 +- api/app/controllers/Domains.scala | 4 ++-- .../EmailVerificationConfirmationForms.scala | 2 +- api/app/controllers/GeneratorServices.scala | 8 ++++---- .../controllers/GeneratorWithServices.scala | 4 ++-- api/app/controllers/Items.scala | 4 ++-- api/app/controllers/MembershipRequests.scala | 13 +++++++------ api/app/controllers/Memberships.scala | 9 +++++---- api/app/controllers/Organizations.scala | 18 +++++++++--------- .../controllers/PasswordResetRequests.scala | 2 +- api/app/controllers/PasswordResets.scala | 2 +- api/app/controllers/Subscriptions.scala | 8 ++++---- api/app/controllers/Tokens.scala | 8 ++++---- api/app/controllers/Users.scala | 17 +++++++++-------- api/app/controllers/Versions.scala | 12 ++++++------ api/app/controllers/Watches.scala | 10 +++++----- 21 files changed, 81 insertions(+), 76 deletions(-) diff --git a/api/app/controllers/ApiBuilderController.scala b/api/app/controllers/ApiBuilderController.scala index bfc995bbe..37301cc92 100644 --- a/api/app/controllers/ApiBuilderController.scala +++ b/api/app/controllers/ApiBuilderController.scala @@ -149,8 +149,8 @@ class IdentifiedActionBuilder @Inject()( def invokeBlock[A]( request: Request[A], - block: (IdentifiedRequest[A] - ) => Future[Result]): Future[Result] = { + block: IdentifiedRequest[A] => Future[Result] + ): Future[Result] = { requestAuthenticationUtil.user(request.headers) match { case None => Future.successful(Results.Unauthorized) case Some(user) => block(IdentifiedRequest(user, request)) diff --git a/api/app/controllers/Applications.scala b/api/app/controllers/Applications.scala index a2dcff356..a65c2d034 100644 --- a/api/app/controllers/Applications.scala +++ b/api/app/controllers/Applications.scala @@ -27,7 +27,7 @@ class Applications @Inject() ( offset: Long = 0, sorting: Option[AppSortBy], ordering: Option[SortOrder] - ) = Identified { request => + ): Action[AnyContent] = Identified { request => val applications = applicationsDao.findAll( request.authorization, orgKey = Some(orgKey), @@ -43,7 +43,7 @@ class Applications @Inject() ( Ok(Json.toJson(applications)) } - def post(orgKey: String) = Identified(parse.json) { request => + def post(orgKey: String): Action[JsValue] = Identified(parse.json) { request => withOrg(request.authorization, orgKey) { org => request.body.validate[ApplicationForm] match { case e: JsError => { @@ -65,7 +65,7 @@ class Applications @Inject() ( } } - def putByApplicationKey(orgKey: String, applicationKey: String) = Identified(parse.json) { request => + def putByApplicationKey(orgKey: String, applicationKey: String): Action[JsValue] = Identified(parse.json) { request => withOrg(request.authorization, orgKey) { org => request.body.validate[ApplicationForm] match { case e: JsError => { @@ -92,7 +92,7 @@ class Applications @Inject() ( } } - def deleteByApplicationKey(orgKey: String, applicationKey: String) = Identified { request => + def deleteByApplicationKey(orgKey: String, applicationKey: String): Action[AnyContent] = Identified { request => withOrgMember(request.user, orgKey) { _ => applicationsDao.findByOrganizationKeyAndApplicationKey(request.authorization, orgKey, applicationKey).foreach { application => applicationsDao.softDelete(request.user, application) @@ -101,7 +101,7 @@ class Applications @Inject() ( } } - def postMoveByApplicationKey(orgKey: String, applicationKey: String) = Identified(parse.json) { request => + def postMoveByApplicationKey(orgKey: String, applicationKey: String): Action[JsValue] = Identified(parse.json) { request => withOrg(request.authorization, orgKey) { org => applicationsDao.findByOrganizationKeyAndApplicationKey(request.authorization, org.key, applicationKey) match { case None => NotFound @@ -133,7 +133,7 @@ class Applications @Inject() ( applicationKey: String, limit: Long = 25, offset: Long = 0 - ) = Anonymous { request => + ): Action[AnyContent] = Anonymous { request => applicationsDao.findByOrganizationKeyAndApplicationKey(request.authorization, orgKey, applicationKey) match { case None => NotFound case Some(application) => { @@ -153,7 +153,7 @@ class Applications @Inject() ( applicationKey: String, limit: Long = 25, offset: Long = 0 - ) = Anonymous { request => + ): Action[AnyContent] = Anonymous { request => applicationsDao.findByOrganizationKeyAndApplicationKey(request.authorization, orgKey, applicationKey) match { case None => NotFound case Some(application) => { diff --git a/api/app/controllers/Attributes.scala b/api/app/controllers/Attributes.scala index 2c020f502..39e175b99 100644 --- a/api/app/controllers/Attributes.scala +++ b/api/app/controllers/Attributes.scala @@ -20,7 +20,7 @@ class Attributes @Inject() ( name: Option[String], limit: Long = 25, offset: Long = 0 - ) = Anonymous { _ => + ): Action[AnyContent] = Anonymous { _ => val attributes = attributesDao.findAll( guid = guid, name = name, @@ -30,14 +30,14 @@ class Attributes @Inject() ( Ok(Json.toJson(attributes)) } - def getByName(name: String) = Action { _ => + def getByName(name: String): Action[AnyContent] = Action { _ => attributesDao.findByName(name) match { case None => NotFound case Some(attribute) => Ok(Json.toJson(attribute)) } } - def post() = Identified(parse.json) { request => + def post(): Action[JsValue] = Identified(parse.json) { request => request.body.validate[AttributeForm] match { case e: JsError => { UnprocessableEntity(Json.toJson(Validation.invalidJson(e))) @@ -57,7 +57,7 @@ class Attributes @Inject() ( } } - def deleteByName(name: String) = Identified { request => + def deleteByName(name: String): Action[AnyContent] = Identified { request => attributesDao.findByName(name) match { case None => { NotFound diff --git a/api/app/controllers/Authentications.scala b/api/app/controllers/Authentications.scala index 02f0d735b..1408f2d90 100644 --- a/api/app/controllers/Authentications.scala +++ b/api/app/controllers/Authentications.scala @@ -15,7 +15,7 @@ class Authentications @Inject() ( usersDao: UsersDao ) extends ApiBuilderController { - def getSessionById(sessionId: String) = Anonymous { _ => + def getSessionById(sessionId: String): Action[AnyContent] = Anonymous { _ => sessionsDao.findById(sessionId) match { case None => NotFound case Some(session) => { diff --git a/api/app/controllers/BatchDownloadApplications.scala b/api/app/controllers/BatchDownloadApplications.scala index 749c03d31..4dea3e5d8 100644 --- a/api/app/controllers/BatchDownloadApplications.scala +++ b/api/app/controllers/BatchDownloadApplications.scala @@ -2,10 +2,12 @@ package controllers import cats.data.Validated.{Invalid, Valid} import io.apibuilder.api.v0.models.BatchDownloadApplicationsForm -import io.apibuilder.api.v0.models.json._ +import io.apibuilder.api.v0.models.json.* + import javax.inject.{Inject, Singleton} import lib.Validation import play.api.libs.json.Json +import play.api.mvc.Action import services.BatchDownloadApplicationsService @Singleton @@ -14,7 +16,7 @@ class BatchDownloadApplications @Inject() ( service: BatchDownloadApplicationsService, ) extends ApiBuilderController { - def post(orgKey: String) = Anonymous(parse.json[BatchDownloadApplicationsForm]) { request => + def post(orgKey: String): Action[BatchDownloadApplicationsForm] = Anonymous(parse.json[BatchDownloadApplicationsForm]) { request => service.process(request.authorization, orgKey, request.body) match { case Valid(result) => Created(Json.toJson(result)) case Invalid(errors) => Conflict(Json.toJson(Validation.errors(errors))) diff --git a/api/app/controllers/Changes.scala b/api/app/controllers/Changes.scala index 450c13513..e83d54a6b 100644 --- a/api/app/controllers/Changes.scala +++ b/api/app/controllers/Changes.scala @@ -20,7 +20,7 @@ class Changes @Inject() ( `type`: Option[String], limit: Long = 25, offset: Long = 0 - ) = Anonymous { request => + ): Action[AnyContent] = Anonymous { request => val changes = changesDao.findAll( request.authorization, organizationKey = orgKey, diff --git a/api/app/controllers/Domains.scala b/api/app/controllers/Domains.scala index 1b4fc185d..745d8f19b 100644 --- a/api/app/controllers/Domains.scala +++ b/api/app/controllers/Domains.scala @@ -15,7 +15,7 @@ class Domains @Inject() ( organizationDomainsDao: OrganizationDomainsDao ) extends ApiBuilderController { - def post(orgKey: String) = Identified(parse.json) { request => + def post(orgKey: String): Action[JsValue] = Identified(parse.json) { request => withOrgAdmin(request.user, orgKey) { org => request.body.validate[Domain] match { case e: JsError => { @@ -40,7 +40,7 @@ class Domains @Inject() ( } } - def deleteByName(orgKey: String, name: String) = Identified { request => + def deleteByName(orgKey: String, name: String): Action[AnyContent] = Identified { request => withOrgAdmin(request.user, orgKey) { org => org.domains.find(_.name == name).foreach { domain => organizationDomainsDao.findAll(organizationGuid = Some(org.guid), domain = Some(domain.name)).foreach { orgDomain => diff --git a/api/app/controllers/EmailVerificationConfirmationForms.scala b/api/app/controllers/EmailVerificationConfirmationForms.scala index b28932bc1..4c1e6bfdf 100644 --- a/api/app/controllers/EmailVerificationConfirmationForms.scala +++ b/api/app/controllers/EmailVerificationConfirmationForms.scala @@ -14,7 +14,7 @@ class EmailVerificationConfirmationForms @Inject() ( emailVerificationsDao: EmailVerificationsDao ) extends ApiBuilderController { - def post() = Anonymous(parse.json) { request => + def post(): Action[JsValue] = Anonymous(parse.json) { request => request.body.validate[EmailVerificationConfirmationForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) diff --git a/api/app/controllers/GeneratorServices.scala b/api/app/controllers/GeneratorServices.scala index 6441c1289..d91cc95dd 100644 --- a/api/app/controllers/GeneratorServices.scala +++ b/api/app/controllers/GeneratorServices.scala @@ -27,7 +27,7 @@ class GeneratorServices @Inject() ( generatorKey: Option[String], limit: Long = 25, offset: Long = 0 - ) = Anonymous { request => + ): Action[AnyContent] = Anonymous { request => val services = servicesDao.findAll( request.authorization, guid = guid, @@ -39,14 +39,14 @@ class GeneratorServices @Inject() ( Ok(Json.toJson(services)) } - def getByGuid(guid: UUID) = Anonymous { request => + def getByGuid(guid: UUID): Action[AnyContent] = Anonymous { request => servicesDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(service) => Ok(Json.toJson(service)) } } - def post() = Identified(parse.json) { request => + def post(): Action[JsValue] = Identified(parse.json) { request => request.body.validate[GeneratorServiceForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) @@ -78,7 +78,7 @@ class GeneratorServices @Inject() ( def deleteByGuid( guid: UUID - ) = Identified { request => + ): Action[AnyContent] = Identified { request => servicesDao.findByGuid(request.authorization, guid) match { case None => { NotFound diff --git a/api/app/controllers/GeneratorWithServices.scala b/api/app/controllers/GeneratorWithServices.scala index d6b57bfe3..85dc6c6d9 100644 --- a/api/app/controllers/GeneratorWithServices.scala +++ b/api/app/controllers/GeneratorWithServices.scala @@ -21,7 +21,7 @@ class GeneratorWithServices @Inject() ( key: Option[String], limit: Long = 25, offset: Long = 0 - ) = Anonymous { request => + ): Action[AnyContent] = Anonymous { request => val generators = generatorsDao.findAll( request.authorization, guid = guid, @@ -35,7 +35,7 @@ class GeneratorWithServices @Inject() ( Ok(Json.toJson(generators)) } - def getByKey(key: String) = Anonymous { request => + def getByKey(key: String): Action[AnyContent] = Anonymous { request => generatorsDao.findAll( request.authorization, key = Some(key), diff --git a/api/app/controllers/Items.scala b/api/app/controllers/Items.scala index 4df5afe7c..d7d181af2 100644 --- a/api/app/controllers/Items.scala +++ b/api/app/controllers/Items.scala @@ -17,7 +17,7 @@ class Items @Inject() ( q: Option[String], limit: Long = 25, offset: Long = 0 - ) = Anonymous { request => + ): Action[AnyContent] = Anonymous { request => val items = itemsDao.findAll( request.authorization, q = q, @@ -29,7 +29,7 @@ class Items @Inject() ( def getByGuid( guid: UUID - ) = Anonymous { request => + ): Action[AnyContent] = Anonymous { request => itemsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(item) => Ok(Json.toJson(item)) diff --git a/api/app/controllers/MembershipRequests.scala b/api/app/controllers/MembershipRequests.scala index 29eef21cc..07f7fa7dc 100644 --- a/api/app/controllers/MembershipRequests.scala +++ b/api/app/controllers/MembershipRequests.scala @@ -1,11 +1,12 @@ package controllers import db.{MembershipRequestsDao, OrganizationsDao, UsersDao} -import io.apibuilder.api.v0.models.json._ +import io.apibuilder.api.v0.models.json.* import io.apibuilder.api.v0.models.{Organization, User} import io.apibuilder.common.v0.models.MembershipRole import lib.Validation -import play.api.libs.json._ +import play.api.libs.json.* +import play.api.mvc.{Action, AnyContent} import java.util.UUID import javax.inject.{Inject, Singleton} @@ -37,7 +38,7 @@ class MembershipRequests @Inject() ( role: Option[MembershipRole], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ): Action[AnyContent] = Identified { request => val requests = membershipRequestsDao.findAll( request.authorization, organizationGuid = organizationGuid, @@ -50,7 +51,7 @@ class MembershipRequests @Inject() ( Ok(Json.toJson(requests)) } - def post() = Identified(parse.json) { request => + def post(): Action[JsValue] = Identified(parse.json) { request => request.body.validate[MembershipRequestForm] match { case e: JsError => { Conflict(Json.toJson(Validation.error(e.toString))) @@ -88,7 +89,7 @@ class MembershipRequests @Inject() ( } } - def postAcceptByGuid(guid: UUID) = Identified { request => + def postAcceptByGuid(guid: UUID): Action[AnyContent] = Identified { request => membershipRequestsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(mr) => { @@ -98,7 +99,7 @@ class MembershipRequests @Inject() ( } } - def postDeclineByGuid(guid: UUID) = Identified { request => + def postDeclineByGuid(guid: UUID): Action[AnyContent] = Identified { request => membershipRequestsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(mr) => { diff --git a/api/app/controllers/Memberships.scala b/api/app/controllers/Memberships.scala index d9be6fe75..7e5f060f1 100644 --- a/api/app/controllers/Memberships.scala +++ b/api/app/controllers/Memberships.scala @@ -1,9 +1,10 @@ package controllers import db.MembershipsDao -import io.apibuilder.api.v0.models.json._ +import io.apibuilder.api.v0.models.json.* import io.apibuilder.common.v0.models.MembershipRole import play.api.libs.json.Json +import play.api.mvc.{Action, AnyContent} import java.util.UUID import javax.inject.{Inject, Singleton} @@ -21,7 +22,7 @@ class Memberships @Inject() ( role: Option[MembershipRole], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ): Action[AnyContent] = Identified { request => Ok( Json.toJson( membershipsDao.findAll( @@ -37,7 +38,7 @@ class Memberships @Inject() ( ) } - def getByGuid(guid: UUID) = Identified { request => + def getByGuid(guid: UUID): Action[AnyContent] = Identified { request => membershipsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(membership) => { @@ -50,7 +51,7 @@ class Memberships @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified { request => + def deleteByGuid(guid: UUID): Action[AnyContent] = Identified { request => membershipsDao.findByGuid(request.authorization, guid) match { case None => NoContent case Some(membership) => { diff --git a/api/app/controllers/Organizations.scala b/api/app/controllers/Organizations.scala index 78a64833c..b4d9ae87d 100644 --- a/api/app/controllers/Organizations.scala +++ b/api/app/controllers/Organizations.scala @@ -25,7 +25,7 @@ class Organizations @Inject() ( namespace: Option[String], limit: Long = 25, offset: Long = 0 - ) = Anonymous { request => + ): Action[AnyContent] = Anonymous { request => Ok( Json.toJson( organizationsDao.findAll( @@ -42,13 +42,13 @@ class Organizations @Inject() ( ) } - def getByKey(key: String) = Anonymous { request => + def getByKey(key: String): Action[AnyContent] = Anonymous { request => withOrg(request.authorization, key) { org => Ok(Json.toJson(org)) } } - def post() = Identified(parse.json) { request => + def post(): Action[JsValue] = Identified(parse.json) { request => request.body.validate[OrganizationForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) @@ -66,7 +66,7 @@ class Organizations @Inject() ( } } - def putByKey(key: String) = Identified(parse.json) { request => + def putByKey(key: String): Action[JsValue] = Identified(parse.json) { request => request.body.validate[OrganizationForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) @@ -89,7 +89,7 @@ class Organizations @Inject() ( } } - def deleteByKey(key: String) = Identified { request => + def deleteByKey(key: String): Action[AnyContent] = Identified { request => withOrgAdmin(request.user, key) { org => organizationsDao.softDelete(request.user, org) NoContent @@ -101,7 +101,7 @@ class Organizations @Inject() ( attributeName: Option[String], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ): Action[AnyContent] = Identified { request => withOrg(request.authorization, key) { org => Ok( Json.toJson( @@ -119,7 +119,7 @@ class Organizations @Inject() ( def getAttributesByKeyAndName( key: String, name: String - ) = Identified { request => + ): Action[AnyContent] = Identified { request => withOrg(request.authorization, key) { org => organizationAttributeValuesDao.findByOrganizationGuidAndAttributeName(org.guid, name) match { case None => NotFound @@ -128,7 +128,7 @@ class Organizations @Inject() ( } } - def putAttributesByKeyAndName(key: String, name: String) = Identified(parse.json) { request => + def putAttributesByKeyAndName(key: String, name: String): Action[JsValue] = Identified(parse.json) { request => withOrg(request.authorization, key) { org => withAttribute(name) { attr => request.body.validate[AttributeValueForm] match { @@ -159,7 +159,7 @@ class Organizations @Inject() ( def deleteAttributesByKeyAndName( key: String, name: String - ) = Identified { request => + ): Action[AnyContent] = Identified { request => withOrg(request.authorization, key) { org => organizationAttributeValuesDao.findByOrganizationGuidAndAttributeName(org.guid, name) match { case None => NotFound diff --git a/api/app/controllers/PasswordResetRequests.scala b/api/app/controllers/PasswordResetRequests.scala index 8278f8c04..4677a85da 100644 --- a/api/app/controllers/PasswordResetRequests.scala +++ b/api/app/controllers/PasswordResetRequests.scala @@ -15,7 +15,7 @@ class PasswordResetRequests @Inject() ( usersDao: UsersDao ) extends ApiBuilderController { - def post() = Anonymous(parse.json) { request => + def post(): Action[JsValue] = Anonymous(parse.json) { request => request.body.validate[PasswordResetRequest] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) diff --git a/api/app/controllers/PasswordResets.scala b/api/app/controllers/PasswordResets.scala index 69133bb4b..6c4469dbe 100644 --- a/api/app/controllers/PasswordResets.scala +++ b/api/app/controllers/PasswordResets.scala @@ -18,7 +18,7 @@ class PasswordResets @Inject() ( userPasswordsDao: UserPasswordsDao ) extends ApiBuilderController { - def post() = Anonymous(parse.json) { request => + def post(): Action[JsValue] = Anonymous(parse.json) { request => request.body.validate[PasswordReset] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) diff --git a/api/app/controllers/Subscriptions.scala b/api/app/controllers/Subscriptions.scala index f72ceb0cf..20d225285 100644 --- a/api/app/controllers/Subscriptions.scala +++ b/api/app/controllers/Subscriptions.scala @@ -22,7 +22,7 @@ class Subscriptions @Inject() ( publication: Option[Publication], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ): Action[AnyContent] = Identified { request => val subscriptions = subscriptionsDao.findAll( request.authorization, guid = guid, @@ -35,14 +35,14 @@ class Subscriptions @Inject() ( Ok(Json.toJson(subscriptions)) } - def getByGuid(guid: UUID) = Identified { request => + def getByGuid(guid: UUID): Action[AnyContent] = Identified { request => subscriptionsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(subscription) => Ok(Json.toJson(subscription)) } } - def post() = Identified(parse.json) { request => + def post(): Action[JsValue] = Identified(parse.json) { request => request.body.validate[SubscriptionForm] match { case e: JsError => { UnprocessableEntity(Json.toJson(Validation.invalidJson(e))) @@ -62,7 +62,7 @@ class Subscriptions @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified { request => + def deleteByGuid(guid: UUID): Action[AnyContent] = Identified { request => subscriptionsDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(subscription) => { diff --git a/api/app/controllers/Tokens.scala b/api/app/controllers/Tokens.scala index 064cb837c..c31f29823 100644 --- a/api/app/controllers/Tokens.scala +++ b/api/app/controllers/Tokens.scala @@ -20,7 +20,7 @@ class Tokens @Inject() ( guid: Option[UUID], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ): Action[AnyContent] = Identified { request => val tokens = tokensDao.findAll( request.authorization, userGuid = Some(userGuid), @@ -33,7 +33,7 @@ class Tokens @Inject() ( def getCleartextByGuid( guid: UUID - ) = Identified { request => + ): Action[AnyContent] = Identified { request => tokensDao.findCleartextByGuid(request.authorization, guid) match { case None => NotFound case Some(token) => { @@ -42,7 +42,7 @@ class Tokens @Inject() ( } } - def post() = Identified(parse.json) { request => + def post(): Action[JsValue] = Identified(parse.json) { request => request.body.validate[TokenForm] match { case e: JsError => { UnprocessableEntity(Json.toJson(Validation.invalidJson(e))) @@ -62,7 +62,7 @@ class Tokens @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified { request => + def deleteByGuid(guid: UUID): Action[AnyContent] = Identified { request => tokensDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(token) => { diff --git a/api/app/controllers/Users.scala b/api/app/controllers/Users.scala index a2a70e179..b42cfae89 100644 --- a/api/app/controllers/Users.scala +++ b/api/app/controllers/Users.scala @@ -1,16 +1,17 @@ package controllers import io.apibuilder.api.v0.models.{User, UserForm, UserUpdateForm} -import io.apibuilder.api.v0.models.json._ +import io.apibuilder.api.v0.models.json.* import lib.Validation import util.SessionHelper import db.{UserPasswordsDao, UsersDao} import javax.inject.Inject -import play.api.libs.json.{JsArray, JsBoolean, JsError, JsObject, JsString, JsSuccess, Json, Reads} +import play.api.libs.json.{JsArray, JsBoolean, JsError, JsObject, JsString, JsSuccess, JsValue, Json, Reads} import java.util.UUID import play.api.libs.ws.WSClient +import play.api.mvc.{Action, AnyContent} import scala.concurrent.Future @@ -35,7 +36,7 @@ class Users @Inject() ( email: Option[String], nickname: Option[String], token: Option[String] - ) = Identified { request => + ): Action[AnyContent] = Identified { request => if (!Seq(guid, email, nickname, token).exists(_.isDefined)) { // require system user to show more then one user requireSystemUser(request.user) @@ -50,7 +51,7 @@ class Users @Inject() ( Ok(Json.toJson(users)) } - def getByGuid(guid: UUID) = Identified { request => + def getByGuid(guid: UUID): Action[AnyContent] = Identified { request => requireSystemUser(request.user) usersDao.findByGuid(guid) match { case None => NotFound @@ -58,7 +59,7 @@ class Users @Inject() ( } } - def post() = Anonymous(parse.json) { request => + def post(): Action[JsValue] = Anonymous(parse.json) { request => request.body.validate[UserForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) @@ -78,7 +79,7 @@ class Users @Inject() ( } } - def putByGuid(guid: UUID) = Identified(parse.json) { request => + def putByGuid(guid: UUID): Action[JsValue] = Identified(parse.json) { request => request.body.validate[UserUpdateForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) @@ -120,7 +121,7 @@ class Users @Inject() ( } } - def postAuthenticate() = Anonymous(parse.json) { request => + def postAuthenticate(): Action[JsValue] = Anonymous(parse.json) { request => request.body.validate[UserAuthenticationForm] match { case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) @@ -145,7 +146,7 @@ class Users @Inject() ( } } - def postAuthenticateGithub() = Action.async(parse.json) { request => + def postAuthenticateGithub(): Action[JsValue] = Action.async(parse.json) { request => request.body.validate[GithubAuthenticationForm] match { case e: JsError => Future.successful { Conflict(Json.toJson(Validation.invalidJson(e))) diff --git a/api/app/controllers/Versions.scala b/api/app/controllers/Versions.scala index d97301690..1cf7daad2 100644 --- a/api/app/controllers/Versions.scala +++ b/api/app/controllers/Versions.scala @@ -33,7 +33,7 @@ class Versions @Inject() ( private val DefaultVisibility = Visibility.Organization - def getByApplicationKey(orgKey: String, applicationKey: String, limit: Long = 25, offset: Long = 0) = Anonymous { request => + def getByApplicationKey(orgKey: String, applicationKey: String, limit: Long = 25, offset: Long = 0): Action[AnyContent] = Anonymous { request => val versions = applicationsDao.findByOrganizationKeyAndApplicationKey(request.authorization, orgKey, applicationKey).map { application => versionsDao.findAll( request.authorization, @@ -45,7 +45,7 @@ class Versions @Inject() ( Ok(Json.toJson(versions)) } - def getByApplicationKeyAndVersion(orgKey: String, applicationKey: String, version: String) = Anonymous { request => + def getByApplicationKeyAndVersion(orgKey: String, applicationKey: String, version: String): Action[AnyContent] = Anonymous { request => versionsDao.findVersion(request.authorization, orgKey, applicationKey, version) match { case None => NotFound case Some(v: Version) => Ok(Json.toJson(v)) @@ -54,7 +54,7 @@ class Versions @Inject() ( def getExampleByApplicationKeyAndVersionAndTypeName( orgKey: String, applicationKey: String, version: String, typeName: String, subTypeName: Option[String], optionalFields: Option[Boolean] - ) = Anonymous { request => + ): Action[AnyContent] = Anonymous { request => versionsDao.findVersion(request.authorization, orgKey, applicationKey, version) match { case None => NotFound case Some(v: Version) => { @@ -108,7 +108,7 @@ class Versions @Inject() ( def postByVersion( orgKey: String, versionName: String - ) = Identified { request => + ): Action[AnyContent] = Identified { request => withOrg(request.authorization, orgKey) { org => request.body match { case AnyContentAsJson(json) => { @@ -157,7 +157,7 @@ class Versions @Inject() ( orgKey: String, applicationKey: String, versionName: String - ) = Identified { request => + ): Action[AnyContent] = Identified { request => withOrg(request.authorization, orgKey) { org => request.body match { case AnyContentAsJson(json) => { @@ -200,7 +200,7 @@ class Versions @Inject() ( } } - def deleteByApplicationKeyAndVersion(orgKey: String, applicationKey: String, version: String) = Identified { request => + def deleteByApplicationKeyAndVersion(orgKey: String, applicationKey: String, version: String): Action[AnyContent] = Identified { request => withOrgMember(request.user, orgKey) { _ => versionsDao.findVersion(request.authorization, orgKey, applicationKey, version).foreach { version => versionsDao.softDelete(request.user, version) diff --git a/api/app/controllers/Watches.scala b/api/app/controllers/Watches.scala index 203ef4f91..2f8d4df7a 100644 --- a/api/app/controllers/Watches.scala +++ b/api/app/controllers/Watches.scala @@ -22,7 +22,7 @@ class Watches @Inject() ( applicationKey: Option[String], limit: Long = 25, offset: Long = 0 - ) = Identified { request => + ): Action[AnyContent] = Identified { request => val watches = watchesDao.findAll( request.authorization, guid = guid, @@ -35,7 +35,7 @@ class Watches @Inject() ( Ok(Json.toJson(watches)) } - def getByGuid(guid: UUID) = Identified { request => + def getByGuid(guid: UUID): Action[AnyContent] = Identified { request => watchesDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(watch) => Ok(Json.toJson(watch)) @@ -46,7 +46,7 @@ class Watches @Inject() ( userGuid: scala.Option[_root_.java.util.UUID], organizationKey: String, applicationKey: String - ) = Identified { request => + ): Action[AnyContent] = Identified { request => watchesDao.findAll( request.authorization, userGuid = userGuid, @@ -59,7 +59,7 @@ class Watches @Inject() ( } } - def post() = Identified(parse.json) { request => + def post(): Action[JsValue] = Identified(parse.json) { request => request.body.validate[WatchForm] match { case e: JsError => { UnprocessableEntity(Json.toJson(Validation.invalidJson(e))) @@ -76,7 +76,7 @@ class Watches @Inject() ( } } - def deleteByGuid(guid: UUID) = Identified { request => + def deleteByGuid(guid: UUID): Action[AnyContent] = Identified { request => watchesDao.findByGuid(request.authorization, guid) match { case None => NotFound case Some(watch) => { From 8339b40fa612dd34d44e2ea410f424520f2ac60a Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Sat, 6 Jul 2024 11:32:20 -0400 Subject: [PATCH 70/95] wip --- api/app/db/UserPasswordsDao.scala | 38 +++++++++++++++++++------------ 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/api/app/db/UserPasswordsDao.scala b/api/app/db/UserPasswordsDao.scala index c02a94bf4..0ae64b32b 100644 --- a/api/app/db/UserPasswordsDao.scala +++ b/api/app/db/UserPasswordsDao.scala @@ -1,23 +1,24 @@ package db +import anorm.* +import com.mbryzek.cipher.{CipherLibraryMindrot, Ciphers, HashedValue} import io.apibuilder.api.v0.models.{Error, User} +import io.flow.postgresql.Query import lib.Validation -import anorm._ -import javax.inject.{Inject, Singleton} +import play.api.db.* -import play.api.db._ -import java.util.UUID import java.sql.Connection +import java.util.UUID +import javax.inject.{Inject, Singleton} -import io.flow.postgresql.Query - -case class UserPassword(guid: UUID, userGuid: UUID, hashed: HashedValue) +case class UserPassword(guid: UUID, userGuid: UUID, algorithmKey: String, base64EncodedHash: String) @Singleton class UserPasswordsDao @Inject() ( @NamedDatabase("default") db: Database ) { + private val ciphers: Ciphers = Ciphers() private val MinLength = 5 private val BaseQuery = Query( @@ -69,14 +70,14 @@ class UserPasswordsDao @Inject() ( assert(errors.isEmpty, errors.map(_.message).mkString("\n")) val guid = UUID.randomUUID - val algorithm = PasswordAlgorithm.Latest + val algorithm = ciphers.latest val hashedPassword = algorithm.hash(cleartextPassword) SQL(InsertQuery).on( "guid" -> guid, "user_guid" -> userGuid, "algorithm_key" -> algorithm.key, - "hash" -> new String(Base64.encodeBase64(hashedPassword.hash.getBytes)), + "hash" -> hashedPassword.hash, "created_by_guid" -> creatingUserGuid, "updated_by_guid" -> creatingUserGuid ).execute() @@ -89,7 +90,18 @@ class UserPasswordsDao @Inject() ( def isValid(userGuid: UUID, cleartextPassword: String): Boolean = { findByUserGuid(userGuid) match { case None => false - case Some(up: UserPassword) => up.algorithm.check(cleartextPassword, up.hash) + case Some(up) => { + ciphers.libraries.find(_.key == up.algorithmKey) match { + case None => false + case Some(al) => { + al.isValid( + plaintext = cleartextPassword, + hash = up.hash, + salt = None + ) + } + } + } } } @@ -112,10 +124,8 @@ class UserPasswordsDao @Inject() ( UserPassword( guid = guid, userGuid = userGuid, - algorithm = PasswordAlgorithm.fromString(algorithmKey).getOrElse { - sys.error(s"Invalid algorithmKey[$algorithmKey] for userGuid[$userGuid]") - }, - hash = new String(Base64.decodeBase64(hash.getBytes)) + algorithmKey = algorithmKey, + base64EncodedHash = hash ) } } From ba79b1970ddbbe998da8076fa477e46d6ff4b474 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Sat, 6 Jul 2024 11:34:58 -0400 Subject: [PATCH 71/95] wip --- api/app/db/OrganizationsDao.scala | 2 +- api/app/db/TokensDao.scala | 2 +- api/app/db/UserPasswordsDao.scala | 2 +- .../db/generated/PsqlApibuilderGeneratorInvocationsDao.scala | 4 ++-- build.sbt | 1 + dao/spec/psql-apibuilder.json | 1 + 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/api/app/db/OrganizationsDao.scala b/api/app/db/OrganizationsDao.scala index cf40b4f2b..fbe84fe6a 100644 --- a/api/app/db/OrganizationsDao.scala +++ b/api/app/db/OrganizationsDao.scala @@ -194,7 +194,7 @@ class OrganizationsDao @Inject() ( name = form.name.trim, namespace = form.namespace.trim, visibility = form.visibility, - domains = form.domains.getOrElse(Nil).map(Domain), + domains = form.domains.getOrElse(Nil).map(Domain(_)), audit = Audit( createdAt = DateTime.now, createdBy = ReferenceGuid(user.guid), diff --git a/api/app/db/TokensDao.scala b/api/app/db/TokensDao.scala index 23547b395..4d7932ac5 100644 --- a/api/app/db/TokensDao.scala +++ b/api/app/db/TokensDao.scala @@ -93,7 +93,7 @@ class TokensDao @Inject() ( tokenFilter(FindCleartextQuery). isNull("tokens.deleted_at"). equals("tokens.guid", guid). - anormSql().as(SqlParser.str("token").*).headOption.map(CleartextToken) + anormSql().as(SqlParser.str("token").*).headOption.map(CleartextToken(_)) } } diff --git a/api/app/db/UserPasswordsDao.scala b/api/app/db/UserPasswordsDao.scala index 0ae64b32b..552d72709 100644 --- a/api/app/db/UserPasswordsDao.scala +++ b/api/app/db/UserPasswordsDao.scala @@ -96,7 +96,7 @@ class UserPasswordsDao @Inject() ( case Some(al) => { al.isValid( plaintext = cleartextPassword, - hash = up.hash, + hash = up.base64EncodedHash, salt = None ) } diff --git a/api/app/db/generated/PsqlApibuilderGeneratorInvocationsDao.scala b/api/app/db/generated/PsqlApibuilderGeneratorInvocationsDao.scala index ed291fe3b..4d813e176 100644 --- a/api/app/db/generated/PsqlApibuilderGeneratorInvocationsDao.scala +++ b/api/app/db/generated/PsqlApibuilderGeneratorInvocationsDao.scala @@ -1,8 +1,8 @@ package db.generated import anorm._ +import com.mbryzek.util.IdGenerator import io.flow.postgresql.{OrderBy, Query} -import io.flow.util.IdGenerator import java.sql.Connection import java.util.UUID import javax.inject.{Inject, Singleton} @@ -166,7 +166,7 @@ class GeneratorInvocationsDao @Inject() ( override val db: Database ) extends BaseGeneratorInvocationsDao { - private val idGenerator = IdGenerator("gni") + private val idGenerator = com.mbryzek.util.IdGenerator("gni") def randomId(): String = idGenerator.randomId() diff --git a/build.sbt b/build.sbt index 7558bbc0a..ee1cb5a55 100644 --- a/build.sbt +++ b/build.sbt @@ -116,6 +116,7 @@ lazy val api = project "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0", "org.projectlombok" % "lombok" % "1.18.32" % "provided", ("com.github.mbryzek" % "lib-cipher" % "0.0.2").cross(CrossVersion.for3Use2_13), + "com.github.mbryzek" % "lib-util" % "0.0.7", "com.sendgrid" % "sendgrid-java" % "4.10.2", "com.github.mbryzek" % "lib-query" % "0.0.2", "com.rollbar" % "rollbar-java" % "1.10.0", diff --git a/dao/spec/psql-apibuilder.json b/dao/spec/psql-apibuilder.json index f2628fc33..52708ca52 100644 --- a/dao/spec/psql-apibuilder.json +++ b/dao/spec/psql-apibuilder.json @@ -33,6 +33,7 @@ "package": "db.generated", "dao_user_class": "java.util.UUID", "id_generator": { + "class": "com.mbryzek.util.IdGenerator", "prefix": "gni" } } From 994a3b54183cb1080cae5c4dee9275a11354740b Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Sat, 6 Jul 2024 11:35:49 -0400 Subject: [PATCH 72/95] wip --- api/app/lib/EmailUtil.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/app/lib/EmailUtil.scala b/api/app/lib/EmailUtil.scala index 073acf760..c3c92e168 100644 --- a/api/app/lib/EmailUtil.scala +++ b/api/app/lib/EmailUtil.scala @@ -38,10 +38,10 @@ class EmailUtil @Inject()( // string. private val sendgrid = { localDeliveryDir match { - case None => new SendGrid(appConfig.sendgridApiKey.getOrElse { - sys.error(s"sendgridApiKey required when localDeliveryDir is not set") - }) - case Some(_) => new SendGrid(appConfig.sendgridApiKey.getOrElse("development")) + case None => new SendGrid(appConfig.sendgridConfig.getOrElse { + sys.error(s"sendgridConfig required when localDeliveryDir is not set") + }.apiKey) + case Some(_) => new SendGrid(appConfig.sendgridApiKey.map(_.apiKey).getOrElse("development")) } } From 15d76b41e4451229f7cfbbba5649e43a2bc99b60 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Sat, 6 Jul 2024 11:36:05 -0400 Subject: [PATCH 73/95] wip --- api/app/lib/EmailUtil.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/app/lib/EmailUtil.scala b/api/app/lib/EmailUtil.scala index c3c92e168..b4b65b7e4 100644 --- a/api/app/lib/EmailUtil.scala +++ b/api/app/lib/EmailUtil.scala @@ -41,7 +41,7 @@ class EmailUtil @Inject()( case None => new SendGrid(appConfig.sendgridConfig.getOrElse { sys.error(s"sendgridConfig required when localDeliveryDir is not set") }.apiKey) - case Some(_) => new SendGrid(appConfig.sendgridApiKey.map(_.apiKey).getOrElse("development")) + case Some(_) => new SendGrid(appConfig.sendgridConfig.map(_.apiKey).getOrElse("development")) } } From 2f31155864bca7e06e1a4adb798846fc0dc57ba2 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 10:32:20 -0400 Subject: [PATCH 74/95] wip --- .../ApicollectiveApibuilderApiV0Parsers.scala | 1394 ----------------- ...icollectiveApibuilderCommonV0Parsers.scala | 114 -- ...llectiveApibuilderGeneratorV0Parsers.scala | 199 --- ...ApicollectiveApibuilderSpecV0Parsers.scala | 862 ---------- 4 files changed, 2569 deletions(-) delete mode 100644 api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala delete mode 100644 api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala delete mode 100644 api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala delete mode 100644 api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala diff --git a/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala deleted file mode 100644 index 6092817a5..000000000 --- a/api/app/generated/ApicollectiveApibuilderApiV0Parsers.scala +++ /dev/null @@ -1,1394 +0,0 @@ -/** - * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.50 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-api/latest/anorm_2_8_scala_3_parsers - */ -import anorm._ - -package io.apibuilder.api.v0.anorm.parsers { - - import io.apibuilder.api.v0.anorm.conversions.Standard._ - - import io.apibuilder.api.v0.anorm.conversions.Types._ - import io.apibuilder.common.v0.anorm.conversions.Types._ - import io.apibuilder.generator.v0.anorm.conversions.Types._ - import io.apibuilder.spec.v0.anorm.conversions.Types._ - - object AppSortBy { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.AppSortBy] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser(name: String = "app_sort_by", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.AppSortBy] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case value => io.apibuilder.api.v0.models.AppSortBy(value) - } - } - - } - - object OriginalType { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.OriginalType] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser(name: String = "original_type", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.OriginalType] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case value => io.apibuilder.api.v0.models.OriginalType(value) - } - } - - } - - object Publication { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Publication] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser(name: String = "publication", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.Publication] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case value => io.apibuilder.api.v0.models.Publication(value) - } - } - - } - - object SortOrder { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.SortOrder] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser(name: String = "sort_order", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.SortOrder] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case value => io.apibuilder.api.v0.models.SortOrder(value) - } - } - - } - - object Visibility { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Visibility] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser(name: String = "visibility", prefixOpt: Option[String] = None): RowParser[io.apibuilder.api.v0.models.Visibility] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case value => io.apibuilder.api.v0.models.Visibility(value) - } - } - - } - - object Application { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Application] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - organizationPrefix: String = "organization", - name: String = "name", - key: String = "key", - visibility: String = "visibility", - description: String = "description", - lastUpdatedAt: String = "last_updated_at", - auditPrefix: String = "audit", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Application] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - io.apibuilder.common.v0.anorm.parsers.Reference.parserWithPrefix(prefixOpt.getOrElse("") + organizationPrefix) ~ - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + key) ~ - io.apibuilder.api.v0.anorm.parsers.Visibility.parser(prefixOpt.getOrElse("") + visibility) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - SqlParser.get[_root_.org.joda.time.DateTime](prefixOpt.getOrElse("") + lastUpdatedAt) ~ - io.apibuilder.common.v0.anorm.parsers.Audit.parserWithPrefix(prefixOpt.getOrElse("") + auditPrefix) map { - case guid ~ organization ~ name ~ key ~ visibility ~ description ~ lastUpdatedAt ~ audit => { - io.apibuilder.api.v0.models.Application( - guid = guid, - organization = organization, - name = name, - key = key, - visibility = visibility, - description = description, - lastUpdatedAt = lastUpdatedAt, - audit = audit - ) - } - } - } - - } - - object ApplicationForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.ApplicationForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - key: String = "key", - description: String = "description", - visibility: String = "visibility", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.ApplicationForm] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + key).? ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.api.v0.anorm.parsers.Visibility.parser(prefixOpt.getOrElse("") + visibility) map { - case name ~ key ~ description ~ visibility => { - io.apibuilder.api.v0.models.ApplicationForm( - name = name, - key = key, - description = description, - visibility = visibility - ) - } - } - } - - } - - object ApplicationMetadata { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.ApplicationMetadata] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - key: String = "key", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.ApplicationMetadata] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - SqlParser.str(prefixOpt.getOrElse("") + key) map { - case guid ~ key => { - io.apibuilder.api.v0.models.ApplicationMetadata( - guid = guid, - key = key - ) - } - } - } - - } - - object ApplicationMetadataVersion { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.ApplicationMetadataVersion] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - version: String = "version", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.ApplicationMetadataVersion] = { - SqlParser.str(prefixOpt.getOrElse("") + version) map { - case version => { - io.apibuilder.api.v0.models.ApplicationMetadataVersion( - version = version - ) - } - } - } - - } - - object ApplicationSummary { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.ApplicationSummary] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - organizationPrefix: String = "organization", - key: String = "key", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.ApplicationSummary] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - io.apibuilder.common.v0.anorm.parsers.Reference.parserWithPrefix(prefixOpt.getOrElse("") + organizationPrefix) ~ - SqlParser.str(prefixOpt.getOrElse("") + key) map { - case guid ~ organization ~ key => { - io.apibuilder.api.v0.models.ApplicationSummary( - guid = guid, - organization = organization, - key = key - ) - } - } - } - - } - - object Attribute { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Attribute] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - name: String = "name", - description: String = "description", - auditPrefix: String = "audit", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Attribute] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.common.v0.anorm.parsers.Audit.parserWithPrefix(prefixOpt.getOrElse("") + auditPrefix) map { - case guid ~ name ~ description ~ audit => { - io.apibuilder.api.v0.models.Attribute( - guid = guid, - name = name, - description = description, - audit = audit - ) - } - } - } - - } - - object AttributeForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.AttributeForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - description: String = "description", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.AttributeForm] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? map { - case name ~ description => { - io.apibuilder.api.v0.models.AttributeForm( - name = name, - description = description - ) - } - } - } - - } - - object AttributeSummary { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.AttributeSummary] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - name: String = "name", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.AttributeSummary] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case guid ~ name => { - io.apibuilder.api.v0.models.AttributeSummary( - guid = guid, - name = name - ) - } - } - } - - } - - object AttributeValue { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.AttributeValue] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - attributePrefix: String = "attribute", - value: String = "value", - auditPrefix: String = "audit", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.AttributeValue] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - io.apibuilder.api.v0.anorm.parsers.AttributeSummary.parserWithPrefix(prefixOpt.getOrElse("") + attributePrefix) ~ - SqlParser.str(prefixOpt.getOrElse("") + value) ~ - io.apibuilder.common.v0.anorm.parsers.Audit.parserWithPrefix(prefixOpt.getOrElse("") + auditPrefix) map { - case guid ~ attribute ~ value ~ audit => { - io.apibuilder.api.v0.models.AttributeValue( - guid = guid, - attribute = attribute, - value = value, - audit = audit - ) - } - } - } - - } - - object AttributeValueForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.AttributeValueForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - value: String = "value", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.AttributeValueForm] = { - SqlParser.str(prefixOpt.getOrElse("") + value) map { - case value => { - io.apibuilder.api.v0.models.AttributeValueForm( - value = value - ) - } - } - } - - } - - object Authentication { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Authentication] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - userPrefix: String = "user", - sessionPrefix: String = "session", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Authentication] = { - io.apibuilder.api.v0.anorm.parsers.User.parserWithPrefix(prefixOpt.getOrElse("") + userPrefix) ~ - io.apibuilder.api.v0.anorm.parsers.Session.parserWithPrefix(prefixOpt.getOrElse("") + sessionPrefix) map { - case user ~ session => { - io.apibuilder.api.v0.models.Authentication( - user = user, - session = session - ) - } - } - } - - } - - object BatchDownloadApplicationForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplicationForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - applicationKey: String = "application_key", - version: String = "version", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplicationForm] = { - SqlParser.str(prefixOpt.getOrElse("") + applicationKey) ~ - SqlParser.str(prefixOpt.getOrElse("") + version) map { - case applicationKey ~ version => { - io.apibuilder.api.v0.models.BatchDownloadApplicationForm( - applicationKey = applicationKey, - version = version - ) - } - } - } - - } - - object BatchDownloadApplications { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplications] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - applications: String = "applications", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplications] = { - SqlParser.get[Seq[io.apibuilder.api.v0.models.Version]](prefixOpt.getOrElse("") + applications) map { - case applications => { - io.apibuilder.api.v0.models.BatchDownloadApplications( - applications = applications - ) - } - } - } - - } - - object BatchDownloadApplicationsForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplicationsForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - applications: String = "applications", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.BatchDownloadApplicationsForm] = { - SqlParser.get[Seq[io.apibuilder.api.v0.models.BatchDownloadApplicationForm]](prefixOpt.getOrElse("") + applications) map { - case applications => { - io.apibuilder.api.v0.models.BatchDownloadApplicationsForm( - applications = applications - ) - } - } - } - - } - - object Change { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Change] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - organizationPrefix: String = "organization", - applicationPrefix: String = "application", - fromVersionPrefix: String = "from_version", - toVersionPrefix: String = "to_version", - diffPrefix: String = "diff", - changedAt: String = "changed_at", - changedByPrefix: String = "changed_by", - auditPrefix: String = "audit", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Change] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - io.apibuilder.common.v0.anorm.parsers.Reference.parserWithPrefix(prefixOpt.getOrElse("") + organizationPrefix) ~ - io.apibuilder.common.v0.anorm.parsers.Reference.parserWithPrefix(prefixOpt.getOrElse("") + applicationPrefix) ~ - io.apibuilder.api.v0.anorm.parsers.ChangeVersion.parserWithPrefix(prefixOpt.getOrElse("") + fromVersionPrefix) ~ - io.apibuilder.api.v0.anorm.parsers.ChangeVersion.parserWithPrefix(prefixOpt.getOrElse("") + toVersionPrefix) ~ - io.apibuilder.api.v0.anorm.parsers.Diff.parserWithPrefix(prefixOpt.getOrElse("") + diffPrefix) ~ - SqlParser.get[_root_.org.joda.time.DateTime](prefixOpt.getOrElse("") + changedAt) ~ - io.apibuilder.api.v0.anorm.parsers.UserSummary.parserWithPrefix(prefixOpt.getOrElse("") + changedByPrefix) ~ - io.apibuilder.common.v0.anorm.parsers.Audit.parserWithPrefix(prefixOpt.getOrElse("") + auditPrefix) map { - case guid ~ organization ~ application ~ fromVersion ~ toVersion ~ diff ~ changedAt ~ changedBy ~ audit => { - io.apibuilder.api.v0.models.Change( - guid = guid, - organization = organization, - application = application, - fromVersion = fromVersion, - toVersion = toVersion, - diff = diff, - changedAt = changedAt, - changedBy = changedBy, - audit = audit - ) - } - } - } - - } - - object ChangeVersion { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.ChangeVersion] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - version: String = "version", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.ChangeVersion] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - SqlParser.str(prefixOpt.getOrElse("") + version) map { - case guid ~ version => { - io.apibuilder.api.v0.models.ChangeVersion( - guid = guid, - version = version - ) - } - } - } - - } - - object CleartextToken { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.CleartextToken] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - token: String = "token", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.CleartextToken] = { - SqlParser.str(prefixOpt.getOrElse("") + token) map { - case token => { - io.apibuilder.api.v0.models.CleartextToken( - token = token - ) - } - } - } - - } - - object Code { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Code] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - generatorPrefix: String = "generator", - source: String = "source", - files: String = "files", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Code] = { - io.apibuilder.api.v0.anorm.parsers.GeneratorWithService.parserWithPrefix(prefixOpt.getOrElse("") + generatorPrefix) ~ - SqlParser.str(prefixOpt.getOrElse("") + source) ~ - SqlParser.get[Seq[io.apibuilder.generator.v0.models.File]](prefixOpt.getOrElse("") + files) map { - case generator ~ source ~ files => { - io.apibuilder.api.v0.models.Code( - generator = generator, - source = source, - files = files - ) - } - } - } - - } - - object CodeForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.CodeForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.CodeForm] = { - SqlParser.get[Seq[io.apibuilder.generator.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { - case attributes => { - io.apibuilder.api.v0.models.CodeForm( - attributes = attributes - ) - } - } - } - - } - - object DiffBreaking { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.DiffBreaking] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - description: String = "description", - isMaterial: String = "is_material", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.DiffBreaking] = { - SqlParser.str(prefixOpt.getOrElse("") + description) ~ - SqlParser.bool(prefixOpt.getOrElse("") + isMaterial) map { - case description ~ isMaterial => { - io.apibuilder.api.v0.models.DiffBreaking( - description = description, - isMaterial = isMaterial - ) - } - } - } - - } - - object DiffNonBreaking { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.DiffNonBreaking] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - description: String = "description", - isMaterial: String = "is_material", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.DiffNonBreaking] = { - SqlParser.str(prefixOpt.getOrElse("") + description) ~ - SqlParser.bool(prefixOpt.getOrElse("") + isMaterial) map { - case description ~ isMaterial => { - io.apibuilder.api.v0.models.DiffNonBreaking( - description = description, - isMaterial = isMaterial - ) - } - } - } - - } - - object Domain { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Domain] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Domain] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case name => { - io.apibuilder.api.v0.models.Domain( - name = name - ) - } - } - } - - } - - object EmailVerificationConfirmationForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.EmailVerificationConfirmationForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - token: String = "token", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.EmailVerificationConfirmationForm] = { - SqlParser.str(prefixOpt.getOrElse("") + token) map { - case token => { - io.apibuilder.api.v0.models.EmailVerificationConfirmationForm( - token = token - ) - } - } - } - - } - - object Error { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Error] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - code: String = "code", - message: String = "message", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Error] = { - SqlParser.str(prefixOpt.getOrElse("") + code) ~ - SqlParser.str(prefixOpt.getOrElse("") + message) map { - case code ~ message => { - io.apibuilder.api.v0.models.Error( - code = code, - message = message - ) - } - } - } - - } - - object GeneratorForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.GeneratorForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - serviceGuid: String = "service_guid", - generatorPrefix: String = "generator", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.GeneratorForm] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + serviceGuid) ~ - io.apibuilder.generator.v0.anorm.parsers.Generator.parserWithPrefix(prefixOpt.getOrElse("") + generatorPrefix) map { - case serviceGuid ~ generator => { - io.apibuilder.api.v0.models.GeneratorForm( - serviceGuid = serviceGuid, - generator = generator - ) - } - } - } - - } - - object GeneratorService { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.GeneratorService] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - uri: String = "uri", - auditPrefix: String = "audit", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.GeneratorService] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - SqlParser.str(prefixOpt.getOrElse("") + uri) ~ - io.apibuilder.common.v0.anorm.parsers.Audit.parserWithPrefix(prefixOpt.getOrElse("") + auditPrefix) map { - case guid ~ uri ~ audit => { - io.apibuilder.api.v0.models.GeneratorService( - guid = guid, - uri = uri, - audit = audit - ) - } - } - } - - } - - object GeneratorServiceForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.GeneratorServiceForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - uri: String = "uri", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.GeneratorServiceForm] = { - SqlParser.str(prefixOpt.getOrElse("") + uri) map { - case uri => { - io.apibuilder.api.v0.models.GeneratorServiceForm( - uri = uri - ) - } - } - } - - } - - object GeneratorWithService { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.GeneratorWithService] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - servicePrefix: String = "service", - generatorPrefix: String = "generator", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.GeneratorWithService] = { - io.apibuilder.api.v0.anorm.parsers.GeneratorService.parserWithPrefix(prefixOpt.getOrElse("") + servicePrefix) ~ - io.apibuilder.generator.v0.anorm.parsers.Generator.parserWithPrefix(prefixOpt.getOrElse("") + generatorPrefix) map { - case service ~ generator => { - io.apibuilder.api.v0.models.GeneratorWithService( - service = service, - generator = generator - ) - } - } - } - - } - - object Item { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Item] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - detailPrefix: String = "detail", - label: String = "label", - description: String = "description", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Item] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - io.apibuilder.api.v0.anorm.parsers.ItemDetail.parserWithPrefix(prefixOpt.getOrElse("") + detailPrefix) ~ - SqlParser.str(prefixOpt.getOrElse("") + label) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? map { - case guid ~ detail ~ label ~ description => { - io.apibuilder.api.v0.models.Item( - guid = guid, - detail = detail, - label = label, - description = description - ) - } - } - } - - } - - object Membership { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Membership] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - userPrefix: String = "user", - organizationPrefix: String = "organization", - role: String = "role", - auditPrefix: String = "audit", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Membership] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - io.apibuilder.api.v0.anorm.parsers.User.parserWithPrefix(prefixOpt.getOrElse("") + userPrefix) ~ - io.apibuilder.api.v0.anorm.parsers.Organization.parserWithPrefix(prefixOpt.getOrElse("") + organizationPrefix) ~ - io.apibuilder.common.v0.anorm.parsers.MembershipRole.parser(prefixOpt.getOrElse("") + role) ~ - io.apibuilder.common.v0.anorm.parsers.Audit.parserWithPrefix(prefixOpt.getOrElse("") + auditPrefix) map { - case guid ~ user ~ organization ~ role ~ audit => { - io.apibuilder.api.v0.models.Membership( - guid = guid, - user = user, - organization = organization, - role = role, - audit = audit - ) - } - } - } - - } - - object MembershipRequest { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.MembershipRequest] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - userPrefix: String = "user", - organizationPrefix: String = "organization", - role: String = "role", - auditPrefix: String = "audit", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.MembershipRequest] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - io.apibuilder.api.v0.anorm.parsers.User.parserWithPrefix(prefixOpt.getOrElse("") + userPrefix) ~ - io.apibuilder.api.v0.anorm.parsers.Organization.parserWithPrefix(prefixOpt.getOrElse("") + organizationPrefix) ~ - io.apibuilder.common.v0.anorm.parsers.MembershipRole.parser(prefixOpt.getOrElse("") + role) ~ - io.apibuilder.common.v0.anorm.parsers.Audit.parserWithPrefix(prefixOpt.getOrElse("") + auditPrefix) map { - case guid ~ user ~ organization ~ role ~ audit => { - io.apibuilder.api.v0.models.MembershipRequest( - guid = guid, - user = user, - organization = organization, - role = role, - audit = audit - ) - } - } - } - - } - - object MoveForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.MoveForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - orgKey: String = "org_key", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.MoveForm] = { - SqlParser.str(prefixOpt.getOrElse("") + orgKey) map { - case orgKey => { - io.apibuilder.api.v0.models.MoveForm( - orgKey = orgKey - ) - } - } - } - - } - - object Organization { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Organization] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - key: String = "key", - name: String = "name", - namespace: String = "namespace", - visibility: String = "visibility", - domains: String = "domains", - auditPrefix: String = "audit", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Organization] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - SqlParser.str(prefixOpt.getOrElse("") + key) ~ - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + namespace) ~ - io.apibuilder.api.v0.anorm.parsers.Visibility.parser(prefixOpt.getOrElse("") + visibility) ~ - SqlParser.get[Seq[io.apibuilder.api.v0.models.Domain]](prefixOpt.getOrElse("") + domains) ~ - io.apibuilder.common.v0.anorm.parsers.Audit.parserWithPrefix(prefixOpt.getOrElse("") + auditPrefix) map { - case guid ~ key ~ name ~ namespace ~ visibility ~ domains ~ audit => { - io.apibuilder.api.v0.models.Organization( - guid = guid, - key = key, - name = name, - namespace = namespace, - visibility = visibility, - domains = domains, - audit = audit - ) - } - } - } - - } - - object OrganizationForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.OrganizationForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - key: String = "key", - namespace: String = "namespace", - visibility: String = "visibility", - domains: String = "domains", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.OrganizationForm] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + key).? ~ - SqlParser.str(prefixOpt.getOrElse("") + namespace) ~ - io.apibuilder.api.v0.anorm.parsers.Visibility.parser(prefixOpt.getOrElse("") + visibility) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + domains).? map { - case name ~ key ~ namespace ~ visibility ~ domains => { - io.apibuilder.api.v0.models.OrganizationForm( - name = name, - key = key, - namespace = namespace, - visibility = visibility, - domains = domains - ) - } - } - } - - } - - object Original { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Original] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - `type`: String = "type", - data: String = "data", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Original] = { - io.apibuilder.api.v0.anorm.parsers.OriginalType.parser(prefixOpt.getOrElse("") + `type`) ~ - SqlParser.str(prefixOpt.getOrElse("") + data) map { - case typeInstance ~ data => { - io.apibuilder.api.v0.models.Original( - `type` = typeInstance, - data = data - ) - } - } - } - - } - - object OriginalForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.OriginalForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - `type`: String = "type", - data: String = "data", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.OriginalForm] = { - io.apibuilder.api.v0.anorm.parsers.OriginalType.parser(prefixOpt.getOrElse("") + `type`).? ~ - SqlParser.str(prefixOpt.getOrElse("") + data) map { - case typeInstance ~ data => { - io.apibuilder.api.v0.models.OriginalForm( - `type` = typeInstance, - data = data - ) - } - } - } - - } - - object PasswordReset { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.PasswordReset] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - token: String = "token", - password: String = "password", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.PasswordReset] = { - SqlParser.str(prefixOpt.getOrElse("") + token) ~ - SqlParser.str(prefixOpt.getOrElse("") + password) map { - case token ~ password => { - io.apibuilder.api.v0.models.PasswordReset( - token = token, - password = password - ) - } - } - } - - } - - object PasswordResetRequest { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.PasswordResetRequest] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - email: String = "email", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.PasswordResetRequest] = { - SqlParser.str(prefixOpt.getOrElse("") + email) map { - case email => { - io.apibuilder.api.v0.models.PasswordResetRequest( - email = email - ) - } - } - } - - } - - object Session { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Session] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - id: String = "id", - expiresAt: String = "expires_at", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Session] = { - SqlParser.str(prefixOpt.getOrElse("") + id) ~ - SqlParser.get[_root_.org.joda.time.DateTime](prefixOpt.getOrElse("") + expiresAt) map { - case id ~ expiresAt => { - io.apibuilder.api.v0.models.Session( - id = id, - expiresAt = expiresAt - ) - } - } - } - - } - - object Subscription { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Subscription] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - organizationPrefix: String = "organization", - userPrefix: String = "user", - publication: String = "publication", - auditPrefix: String = "audit", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Subscription] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - io.apibuilder.api.v0.anorm.parsers.Organization.parserWithPrefix(prefixOpt.getOrElse("") + organizationPrefix) ~ - io.apibuilder.api.v0.anorm.parsers.User.parserWithPrefix(prefixOpt.getOrElse("") + userPrefix) ~ - io.apibuilder.api.v0.anorm.parsers.Publication.parser(prefixOpt.getOrElse("") + publication) ~ - io.apibuilder.common.v0.anorm.parsers.Audit.parserWithPrefix(prefixOpt.getOrElse("") + auditPrefix) map { - case guid ~ organization ~ user ~ publication ~ audit => { - io.apibuilder.api.v0.models.Subscription( - guid = guid, - organization = organization, - user = user, - publication = publication, - audit = audit - ) - } - } - } - - } - - object SubscriptionForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.SubscriptionForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - organizationKey: String = "organization_key", - userGuid: String = "user_guid", - publication: String = "publication", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.SubscriptionForm] = { - SqlParser.str(prefixOpt.getOrElse("") + organizationKey) ~ - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + userGuid) ~ - io.apibuilder.api.v0.anorm.parsers.Publication.parser(prefixOpt.getOrElse("") + publication) map { - case organizationKey ~ userGuid ~ publication => { - io.apibuilder.api.v0.models.SubscriptionForm( - organizationKey = organizationKey, - userGuid = userGuid, - publication = publication - ) - } - } - } - - } - - object Token { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Token] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - userPrefix: String = "user", - maskedToken: String = "masked_token", - description: String = "description", - auditPrefix: String = "audit", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Token] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - io.apibuilder.api.v0.anorm.parsers.User.parserWithPrefix(prefixOpt.getOrElse("") + userPrefix) ~ - SqlParser.str(prefixOpt.getOrElse("") + maskedToken) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.common.v0.anorm.parsers.Audit.parserWithPrefix(prefixOpt.getOrElse("") + auditPrefix) map { - case guid ~ user ~ maskedToken ~ description ~ audit => { - io.apibuilder.api.v0.models.Token( - guid = guid, - user = user, - maskedToken = maskedToken, - description = description, - audit = audit - ) - } - } - } - - } - - object TokenForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.TokenForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - userGuid: String = "user_guid", - description: String = "description", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.TokenForm] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + userGuid) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? map { - case userGuid ~ description => { - io.apibuilder.api.v0.models.TokenForm( - userGuid = userGuid, - description = description - ) - } - } - } - - } - - object User { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.User] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - email: String = "email", - nickname: String = "nickname", - name: String = "name", - auditPrefix: String = "audit", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.User] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - SqlParser.str(prefixOpt.getOrElse("") + email) ~ - SqlParser.str(prefixOpt.getOrElse("") + nickname) ~ - SqlParser.str(prefixOpt.getOrElse("") + name).? ~ - io.apibuilder.common.v0.anorm.parsers.Audit.parserWithPrefix(prefixOpt.getOrElse("") + auditPrefix) map { - case guid ~ email ~ nickname ~ name ~ audit => { - io.apibuilder.api.v0.models.User( - guid = guid, - email = email, - nickname = nickname, - name = name, - audit = audit - ) - } - } - } - - } - - object UserForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.UserForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - email: String = "email", - password: String = "password", - nickname: String = "nickname", - name: String = "name", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.UserForm] = { - SqlParser.str(prefixOpt.getOrElse("") + email) ~ - SqlParser.str(prefixOpt.getOrElse("") + password) ~ - SqlParser.str(prefixOpt.getOrElse("") + nickname).? ~ - SqlParser.str(prefixOpt.getOrElse("") + name).? map { - case email ~ password ~ nickname ~ name => { - io.apibuilder.api.v0.models.UserForm( - email = email, - password = password, - nickname = nickname, - name = name - ) - } - } - } - - } - - object UserSummary { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.UserSummary] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - nickname: String = "nickname", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.UserSummary] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - SqlParser.str(prefixOpt.getOrElse("") + nickname) map { - case guid ~ nickname => { - io.apibuilder.api.v0.models.UserSummary( - guid = guid, - nickname = nickname - ) - } - } - } - - } - - object UserUpdateForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.UserUpdateForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - email: String = "email", - nickname: String = "nickname", - name: String = "name", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.UserUpdateForm] = { - SqlParser.str(prefixOpt.getOrElse("") + email) ~ - SqlParser.str(prefixOpt.getOrElse("") + nickname) ~ - SqlParser.str(prefixOpt.getOrElse("") + name).? map { - case email ~ nickname ~ name => { - io.apibuilder.api.v0.models.UserUpdateForm( - email = email, - nickname = nickname, - name = name - ) - } - } - } - - } - - object Validation { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Validation] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - valid: String = "valid", - errors: String = "errors", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Validation] = { - SqlParser.bool(prefixOpt.getOrElse("") + valid) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + errors) map { - case valid ~ errors => { - io.apibuilder.api.v0.models.Validation( - valid = valid, - errors = errors - ) - } - } - } - - } - - object Version { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Version] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - organizationPrefix: String = "organization", - applicationPrefix: String = "application", - version: String = "version", - originalPrefix: String = "original", - servicePrefix: String = "service", - auditPrefix: String = "audit", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Version] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - io.apibuilder.common.v0.anorm.parsers.Reference.parserWithPrefix(prefixOpt.getOrElse("") + organizationPrefix) ~ - io.apibuilder.common.v0.anorm.parsers.Reference.parserWithPrefix(prefixOpt.getOrElse("") + applicationPrefix) ~ - SqlParser.str(prefixOpt.getOrElse("") + version) ~ - io.apibuilder.api.v0.anorm.parsers.Original.parserWithPrefix(prefixOpt.getOrElse("") + originalPrefix).? ~ - io.apibuilder.spec.v0.anorm.parsers.Service.parserWithPrefix(prefixOpt.getOrElse("") + servicePrefix) ~ - io.apibuilder.common.v0.anorm.parsers.Audit.parserWithPrefix(prefixOpt.getOrElse("") + auditPrefix) map { - case guid ~ organization ~ application ~ version ~ original ~ service ~ audit => { - io.apibuilder.api.v0.models.Version( - guid = guid, - organization = organization, - application = application, - version = version, - original = original, - service = service, - audit = audit - ) - } - } - } - - } - - object VersionForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.VersionForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - originalFormPrefix: String = "original_form", - visibility: String = "visibility", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.VersionForm] = { - io.apibuilder.api.v0.anorm.parsers.OriginalForm.parserWithPrefix(prefixOpt.getOrElse("") + originalFormPrefix) ~ - io.apibuilder.api.v0.anorm.parsers.Visibility.parser(prefixOpt.getOrElse("") + visibility).? map { - case originalForm ~ visibility => { - io.apibuilder.api.v0.models.VersionForm( - originalForm = originalForm, - visibility = visibility - ) - } - } - } - - } - - object Watch { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.Watch] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - userPrefix: String = "user", - organizationPrefix: String = "organization", - applicationPrefix: String = "application", - auditPrefix: String = "audit", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.Watch] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - io.apibuilder.api.v0.anorm.parsers.User.parserWithPrefix(prefixOpt.getOrElse("") + userPrefix) ~ - io.apibuilder.api.v0.anorm.parsers.Organization.parserWithPrefix(prefixOpt.getOrElse("") + organizationPrefix) ~ - io.apibuilder.api.v0.anorm.parsers.Application.parserWithPrefix(prefixOpt.getOrElse("") + applicationPrefix) ~ - io.apibuilder.common.v0.anorm.parsers.Audit.parserWithPrefix(prefixOpt.getOrElse("") + auditPrefix) map { - case guid ~ user ~ organization ~ application ~ audit => { - io.apibuilder.api.v0.models.Watch( - guid = guid, - user = user, - organization = organization, - application = application, - audit = audit - ) - } - } - } - - } - - object WatchForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.api.v0.models.WatchForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - userGuid: String = "user_guid", - organizationKey: String = "organization_key", - applicationKey: String = "application_key", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.api.v0.models.WatchForm] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + userGuid) ~ - SqlParser.str(prefixOpt.getOrElse("") + organizationKey) ~ - SqlParser.str(prefixOpt.getOrElse("") + applicationKey) map { - case userGuid ~ organizationKey ~ applicationKey => { - io.apibuilder.api.v0.models.WatchForm( - userGuid = userGuid, - organizationKey = organizationKey, - applicationKey = applicationKey - ) - } - } - } - - } - - object Diff { - - def parserWithPrefix(prefix: String, sep: String = "_") = { - io.apibuilder.api.v0.anorm.parsers.DiffBreaking.parser(prefixOpt = Some(s"$prefix$sep")) | - io.apibuilder.api.v0.anorm.parsers.DiffNonBreaking.parser(prefixOpt = Some(s"$prefix$sep")) - } - - def parser() = { - io.apibuilder.api.v0.anorm.parsers.DiffBreaking.parser() | - io.apibuilder.api.v0.anorm.parsers.DiffNonBreaking.parser() - } - - } - - object ItemDetail { - - def parserWithPrefix(prefix: String, sep: String = "_") = { - io.apibuilder.api.v0.anorm.parsers.ApplicationSummary.parser(prefixOpt = Some(s"$prefix$sep")) - } - - def parser() = { - io.apibuilder.api.v0.anorm.parsers.ApplicationSummary.parser() - } - - } - -} \ No newline at end of file diff --git a/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala deleted file mode 100644 index fcd3044f4..000000000 --- a/api/app/generated/ApicollectiveApibuilderCommonV0Parsers.scala +++ /dev/null @@ -1,114 +0,0 @@ -/** - * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.50 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-common/latest/anorm_2_8_scala_3_parsers - */ -import anorm._ - -package io.apibuilder.common.v0.anorm.parsers { - - import io.apibuilder.common.v0.anorm.conversions.Standard._ - - import io.apibuilder.common.v0.anorm.conversions.Types._ - - object MembershipRole { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.common.v0.models.MembershipRole] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser(name: String = "membership_role", prefixOpt: Option[String] = None): RowParser[io.apibuilder.common.v0.models.MembershipRole] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case value => io.apibuilder.common.v0.models.MembershipRole(value) - } - } - - } - - object Audit { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.common.v0.models.Audit] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - createdAt: String = "created_at", - createdByPrefix: String = "created_by", - updatedAt: String = "updated_at", - updatedByPrefix: String = "updated_by", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.common.v0.models.Audit] = { - SqlParser.get[_root_.org.joda.time.DateTime](prefixOpt.getOrElse("") + createdAt) ~ - io.apibuilder.common.v0.anorm.parsers.ReferenceGuid.parserWithPrefix(prefixOpt.getOrElse("") + createdByPrefix) ~ - SqlParser.get[_root_.org.joda.time.DateTime](prefixOpt.getOrElse("") + updatedAt) ~ - io.apibuilder.common.v0.anorm.parsers.ReferenceGuid.parserWithPrefix(prefixOpt.getOrElse("") + updatedByPrefix) map { - case createdAt ~ createdBy ~ updatedAt ~ updatedBy => { - io.apibuilder.common.v0.models.Audit( - createdAt = createdAt, - createdBy = createdBy, - updatedAt = updatedAt, - updatedBy = updatedBy - ) - } - } - } - - } - - object Healthcheck { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.common.v0.models.Healthcheck] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - status: String = "status", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.common.v0.models.Healthcheck] = { - SqlParser.str(prefixOpt.getOrElse("") + status) map { - case status => { - io.apibuilder.common.v0.models.Healthcheck( - status = status - ) - } - } - } - - } - - object Reference { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.common.v0.models.Reference] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - key: String = "key", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.common.v0.models.Reference] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) ~ - SqlParser.str(prefixOpt.getOrElse("") + key) map { - case guid ~ key => { - io.apibuilder.common.v0.models.Reference( - guid = guid, - key = key - ) - } - } - } - - } - - object ReferenceGuid { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.common.v0.models.ReferenceGuid] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - guid: String = "guid", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.common.v0.models.ReferenceGuid] = { - SqlParser.get[_root_.java.util.UUID](prefixOpt.getOrElse("") + guid) map { - case guid => { - io.apibuilder.common.v0.models.ReferenceGuid( - guid = guid - ) - } - } - } - - } - -} \ No newline at end of file diff --git a/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala deleted file mode 100644 index 51ac152a6..000000000 --- a/api/app/generated/ApicollectiveApibuilderGeneratorV0Parsers.scala +++ /dev/null @@ -1,199 +0,0 @@ -/** - * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.50 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-generator/latest/anorm_2_8_scala_3_parsers - */ -import anorm._ - -package io.apibuilder.generator.v0.anorm.parsers { - - import io.apibuilder.generator.v0.anorm.conversions.Standard._ - - import io.apibuilder.generator.v0.anorm.conversions.Types._ - import io.apibuilder.spec.v0.anorm.conversions.Types._ - - object FileFlag { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.generator.v0.models.FileFlag] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser(name: String = "file_flag", prefixOpt: Option[String] = None): RowParser[io.apibuilder.generator.v0.models.FileFlag] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case value => io.apibuilder.generator.v0.models.FileFlag(value) - } - } - - } - - object Attribute { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.generator.v0.models.Attribute] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - value: String = "value", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.generator.v0.models.Attribute] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + value) map { - case name ~ value => { - io.apibuilder.generator.v0.models.Attribute( - name = name, - value = value - ) - } - } - } - - } - - object Error { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.generator.v0.models.Error] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - code: String = "code", - message: String = "message", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.generator.v0.models.Error] = { - SqlParser.str(prefixOpt.getOrElse("") + code) ~ - SqlParser.str(prefixOpt.getOrElse("") + message) map { - case code ~ message => { - io.apibuilder.generator.v0.models.Error( - code = code, - message = message - ) - } - } - } - - } - - object File { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.generator.v0.models.File] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - dir: String = "dir", - contents: String = "contents", - flags: String = "flags", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.generator.v0.models.File] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + dir).? ~ - SqlParser.str(prefixOpt.getOrElse("") + contents) ~ - SqlParser.get[Seq[io.apibuilder.generator.v0.models.FileFlag]](prefixOpt.getOrElse("") + flags).? map { - case name ~ dir ~ contents ~ flags => { - io.apibuilder.generator.v0.models.File( - name = name, - dir = dir, - contents = contents, - flags = flags - ) - } - } - } - - } - - object Generator { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.generator.v0.models.Generator] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - key: String = "key", - name: String = "name", - language: String = "language", - description: String = "description", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.generator.v0.models.Generator] = { - SqlParser.str(prefixOpt.getOrElse("") + key) ~ - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + language).? ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + attributes) map { - case key ~ name ~ language ~ description ~ attributes => { - io.apibuilder.generator.v0.models.Generator( - key = key, - name = name, - language = language, - description = description, - attributes = attributes - ) - } - } - } - - } - - object Healthcheck { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.generator.v0.models.Healthcheck] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - status: String = "status", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.generator.v0.models.Healthcheck] = { - SqlParser.str(prefixOpt.getOrElse("") + status) map { - case status => { - io.apibuilder.generator.v0.models.Healthcheck( - status = status - ) - } - } - } - - } - - object Invocation { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.generator.v0.models.Invocation] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - source: String = "source", - files: String = "files", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.generator.v0.models.Invocation] = { - SqlParser.str(prefixOpt.getOrElse("") + source) ~ - SqlParser.get[Seq[io.apibuilder.generator.v0.models.File]](prefixOpt.getOrElse("") + files) map { - case source ~ files => { - io.apibuilder.generator.v0.models.Invocation( - source = source, - files = files - ) - } - } - } - - } - - object InvocationForm { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.generator.v0.models.InvocationForm] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - servicePrefix: String = "service", - attributes: String = "attributes", - userAgent: String = "user_agent", - importedServices: String = "imported_services", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.generator.v0.models.InvocationForm] = { - io.apibuilder.spec.v0.anorm.parsers.Service.parserWithPrefix(prefixOpt.getOrElse("") + servicePrefix) ~ - SqlParser.get[Seq[io.apibuilder.generator.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ - SqlParser.str(prefixOpt.getOrElse("") + userAgent).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Service]](prefixOpt.getOrElse("") + importedServices).? map { - case service ~ attributes ~ userAgent ~ importedServices => { - io.apibuilder.generator.v0.models.InvocationForm( - service = service, - attributes = attributes, - userAgent = userAgent, - importedServices = importedServices - ) - } - } - } - - } - -} \ No newline at end of file diff --git a/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala b/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala deleted file mode 100644 index d812c5869..000000000 --- a/api/app/generated/ApicollectiveApibuilderSpecV0Parsers.scala +++ /dev/null @@ -1,862 +0,0 @@ -/** - * Generated by API Builder - https://www.apibuilder.io - * Service version: 0.16.50 - * User agent: apibuilder localhost 9000/apicollective/apibuilder-spec/latest/anorm_2_8_scala_3_parsers - */ -import anorm._ - -package io.apibuilder.spec.v0.anorm.parsers { - - import io.apibuilder.spec.v0.anorm.conversions.Standard._ - - import io.apibuilder.spec.v0.anorm.conversions.Types._ - - object Method { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Method] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser(name: String = "method", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.Method] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case value => io.apibuilder.spec.v0.models.Method(value) - } - } - - } - - object ParameterLocation { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.ParameterLocation] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser(name: String = "parameter_location", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.ParameterLocation] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case value => io.apibuilder.spec.v0.models.ParameterLocation(value) - } - } - - } - - object ResponseCodeOption { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.ResponseCodeOption] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser(name: String = "response_code_option", prefixOpt: Option[String] = None): RowParser[io.apibuilder.spec.v0.models.ResponseCodeOption] = { - SqlParser.str(prefixOpt.getOrElse("") + name) map { - case value => io.apibuilder.spec.v0.models.ResponseCodeOption(value) - } - } - - } - - object Annotation { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Annotation] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - description: String = "description", - deprecationPrefix: String = "deprecation", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Annotation] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? map { - case name ~ description ~ deprecation => { - io.apibuilder.spec.v0.models.Annotation( - name = name, - description = description, - deprecation = deprecation - ) - } - } - } - - } - - object Apidoc { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Apidoc] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - version: String = "version", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Apidoc] = { - SqlParser.str(prefixOpt.getOrElse("") + version) map { - case version => { - io.apibuilder.spec.v0.models.Apidoc( - version = version - ) - } - } - } - - } - - object Application { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Application] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - key: String = "key", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Application] = { - SqlParser.str(prefixOpt.getOrElse("") + key) map { - case key => { - io.apibuilder.spec.v0.models.Application( - key = key - ) - } - } - } - - } - - object Attribute { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Attribute] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - value: String = "value", - description: String = "description", - deprecationPrefix: String = "deprecation", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Attribute] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.get[_root_.play.api.libs.json.JsObject](prefixOpt.getOrElse("") + value) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? map { - case name ~ value ~ description ~ deprecation => { - io.apibuilder.spec.v0.models.Attribute( - name = name, - value = value, - description = description, - deprecation = deprecation - ) - } - } - } - - } - - object Body { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Body] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - `type`: String = "type", - description: String = "description", - deprecationPrefix: String = "deprecation", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Body] = { - SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { - case typeInstance ~ description ~ deprecation ~ attributes => { - io.apibuilder.spec.v0.models.Body( - `type` = typeInstance, - description = description, - deprecation = deprecation, - attributes = attributes - ) - } - } - } - - } - - object Contact { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Contact] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - url: String = "url", - email: String = "email", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Contact] = { - SqlParser.str(prefixOpt.getOrElse("") + name).? ~ - SqlParser.str(prefixOpt.getOrElse("") + url).? ~ - SqlParser.str(prefixOpt.getOrElse("") + email).? map { - case name ~ url ~ email => { - io.apibuilder.spec.v0.models.Contact( - name = name, - url = url, - email = email - ) - } - } - } - - } - - object Deprecation { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Deprecation] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - description: String = "description", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Deprecation] = { - SqlParser.str(prefixOpt.getOrElse("") + description).? map { - case description => { - io.apibuilder.spec.v0.models.Deprecation( - description = description - ) - } - } - } - - } - - object Enum { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Enum] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - plural: String = "plural", - description: String = "description", - deprecationPrefix: String = "deprecation", - values: String = "values", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Enum] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + plural) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.EnumValue]](prefixOpt.getOrElse("") + values) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { - case name ~ plural ~ description ~ deprecation ~ values ~ attributes => { - io.apibuilder.spec.v0.models.Enum( - name = name, - plural = plural, - description = description, - deprecation = deprecation, - values = values, - attributes = attributes - ) - } - } - } - - } - - object EnumValue { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.EnumValue] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - description: String = "description", - deprecationPrefix: String = "deprecation", - attributes: String = "attributes", - value: String = "value", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.EnumValue] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ - SqlParser.str(prefixOpt.getOrElse("") + value).? map { - case name ~ description ~ deprecation ~ attributes ~ value => { - io.apibuilder.spec.v0.models.EnumValue( - name = name, - description = description, - deprecation = deprecation, - attributes = attributes, - value = value - ) - } - } - } - - } - - object Field { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Field] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - `type`: String = "type", - description: String = "description", - deprecationPrefix: String = "deprecation", - default: String = "default", - required: String = "required", - minimum: String = "minimum", - maximum: String = "maximum", - example: String = "example", - attributes: String = "attributes", - annotations: String = "annotations", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Field] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.str(prefixOpt.getOrElse("") + default).? ~ - SqlParser.bool(prefixOpt.getOrElse("") + required) ~ - SqlParser.long(prefixOpt.getOrElse("") + minimum).? ~ - SqlParser.long(prefixOpt.getOrElse("") + maximum).? ~ - SqlParser.str(prefixOpt.getOrElse("") + example).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + annotations) map { - case name ~ typeInstance ~ description ~ deprecation ~ default ~ required ~ minimum ~ maximum ~ example ~ attributes ~ annotations => { - io.apibuilder.spec.v0.models.Field( - name = name, - `type` = typeInstance, - description = description, - deprecation = deprecation, - default = default, - required = required, - minimum = minimum, - maximum = maximum, - example = example, - attributes = attributes, - annotations = annotations - ) - } - } - } - - } - - object Header { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Header] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - `type`: String = "type", - description: String = "description", - deprecationPrefix: String = "deprecation", - required: String = "required", - default: String = "default", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Header] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.bool(prefixOpt.getOrElse("") + required) ~ - SqlParser.str(prefixOpt.getOrElse("") + default).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { - case name ~ typeInstance ~ description ~ deprecation ~ required ~ default ~ attributes => { - io.apibuilder.spec.v0.models.Header( - name = name, - `type` = typeInstance, - description = description, - deprecation = deprecation, - required = required, - default = default, - attributes = attributes - ) - } - } - } - - } - - object Import { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Import] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - uri: String = "uri", - namespace: String = "namespace", - organizationPrefix: String = "organization", - applicationPrefix: String = "application", - version: String = "version", - enums: String = "enums", - interfaces: String = "interfaces", - unions: String = "unions", - models: String = "models", - annotations: String = "annotations", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Import] = { - SqlParser.str(prefixOpt.getOrElse("") + uri) ~ - SqlParser.str(prefixOpt.getOrElse("") + namespace) ~ - io.apibuilder.spec.v0.anorm.parsers.Organization.parserWithPrefix(prefixOpt.getOrElse("") + organizationPrefix) ~ - io.apibuilder.spec.v0.anorm.parsers.Application.parserWithPrefix(prefixOpt.getOrElse("") + applicationPrefix) ~ - SqlParser.str(prefixOpt.getOrElse("") + version) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + enums) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + interfaces) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + unions) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + models) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Annotation]](prefixOpt.getOrElse("") + annotations) map { - case uri ~ namespace ~ organization ~ application ~ version ~ enums ~ interfaces ~ unions ~ models ~ annotations => { - io.apibuilder.spec.v0.models.Import( - uri = uri, - namespace = namespace, - organization = organization, - application = application, - version = version, - enums = enums, - interfaces = interfaces, - unions = unions, - models = models, - annotations = annotations - ) - } - } - } - - } - - object Info { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Info] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - licensePrefix: String = "license", - contactPrefix: String = "contact", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Info] = { - io.apibuilder.spec.v0.anorm.parsers.License.parserWithPrefix(prefixOpt.getOrElse("") + licensePrefix).? ~ - io.apibuilder.spec.v0.anorm.parsers.Contact.parserWithPrefix(prefixOpt.getOrElse("") + contactPrefix).? map { - case license ~ contact => { - io.apibuilder.spec.v0.models.Info( - license = license, - contact = contact - ) - } - } - } - - } - - object Interface { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Interface] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - plural: String = "plural", - description: String = "description", - deprecationPrefix: String = "deprecation", - fields: String = "fields", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Interface] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + plural) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Field]](prefixOpt.getOrElse("") + fields) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { - case name ~ plural ~ description ~ deprecation ~ fields ~ attributes => { - io.apibuilder.spec.v0.models.Interface( - name = name, - plural = plural, - description = description, - deprecation = deprecation, - fields = fields, - attributes = attributes - ) - } - } - } - - } - - object License { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.License] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - url: String = "url", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.License] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + url).? map { - case name ~ url => { - io.apibuilder.spec.v0.models.License( - name = name, - url = url - ) - } - } - } - - } - - object Model { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Model] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - plural: String = "plural", - description: String = "description", - deprecationPrefix: String = "deprecation", - fields: String = "fields", - attributes: String = "attributes", - interfaces: String = "interfaces", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Model] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + plural) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Field]](prefixOpt.getOrElse("") + fields) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + interfaces) map { - case name ~ plural ~ description ~ deprecation ~ fields ~ attributes ~ interfaces => { - io.apibuilder.spec.v0.models.Model( - name = name, - plural = plural, - description = description, - deprecation = deprecation, - fields = fields, - attributes = attributes, - interfaces = interfaces - ) - } - } - } - - } - - object Operation { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Operation] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - method: String = "method", - path: String = "path", - description: String = "description", - deprecationPrefix: String = "deprecation", - bodyPrefix: String = "body", - parameters: String = "parameters", - responses: String = "responses", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Operation] = { - io.apibuilder.spec.v0.anorm.parsers.Method.parser(prefixOpt.getOrElse("") + method) ~ - SqlParser.str(prefixOpt.getOrElse("") + path) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - io.apibuilder.spec.v0.anorm.parsers.Body.parserWithPrefix(prefixOpt.getOrElse("") + bodyPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Parameter]](prefixOpt.getOrElse("") + parameters) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Response]](prefixOpt.getOrElse("") + responses) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { - case method ~ path ~ description ~ deprecation ~ body ~ parameters ~ responses ~ attributes => { - io.apibuilder.spec.v0.models.Operation( - method = method, - path = path, - description = description, - deprecation = deprecation, - body = body, - parameters = parameters, - responses = responses, - attributes = attributes - ) - } - } - } - - } - - object Organization { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Organization] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - key: String = "key", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Organization] = { - SqlParser.str(prefixOpt.getOrElse("") + key) map { - case key => { - io.apibuilder.spec.v0.models.Organization( - key = key - ) - } - } - } - - } - - object Parameter { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Parameter] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - `type`: String = "type", - location: String = "location", - description: String = "description", - deprecationPrefix: String = "deprecation", - required: String = "required", - default: String = "default", - minimum: String = "minimum", - maximum: String = "maximum", - example: String = "example", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Parameter] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ - io.apibuilder.spec.v0.anorm.parsers.ParameterLocation.parser(prefixOpt.getOrElse("") + location) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.bool(prefixOpt.getOrElse("") + required) ~ - SqlParser.str(prefixOpt.getOrElse("") + default).? ~ - SqlParser.long(prefixOpt.getOrElse("") + minimum).? ~ - SqlParser.long(prefixOpt.getOrElse("") + maximum).? ~ - SqlParser.str(prefixOpt.getOrElse("") + example).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes).? map { - case name ~ typeInstance ~ location ~ description ~ deprecation ~ required ~ default ~ minimum ~ maximum ~ example ~ attributes => { - io.apibuilder.spec.v0.models.Parameter( - name = name, - `type` = typeInstance, - location = location, - description = description, - deprecation = deprecation, - required = required, - default = default, - minimum = minimum, - maximum = maximum, - example = example, - attributes = attributes - ) - } - } - } - - } - - object Resource { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Resource] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - `type`: String = "type", - plural: String = "plural", - path: String = "path", - description: String = "description", - deprecationPrefix: String = "deprecation", - operations: String = "operations", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Resource] = { - SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ - SqlParser.str(prefixOpt.getOrElse("") + plural) ~ - SqlParser.str(prefixOpt.getOrElse("") + path).? ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Operation]](prefixOpt.getOrElse("") + operations) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) map { - case typeInstance ~ plural ~ path ~ description ~ deprecation ~ operations ~ attributes => { - io.apibuilder.spec.v0.models.Resource( - `type` = typeInstance, - plural = plural, - path = path, - description = description, - deprecation = deprecation, - operations = operations, - attributes = attributes - ) - } - } - } - - } - - object Response { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Response] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - codePrefix: String = "code", - `type`: String = "type", - headers: String = "headers", - description: String = "description", - deprecationPrefix: String = "deprecation", - attributes: String = "attributes", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Response] = { - io.apibuilder.spec.v0.anorm.parsers.ResponseCode.parserWithPrefix(prefixOpt.getOrElse("") + codePrefix) ~ - SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Header]](prefixOpt.getOrElse("") + headers).? ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes).? map { - case code ~ typeInstance ~ headers ~ description ~ deprecation ~ attributes => { - io.apibuilder.spec.v0.models.Response( - code = code, - `type` = typeInstance, - headers = headers, - description = description, - deprecation = deprecation, - attributes = attributes - ) - } - } - } - - } - - object Service { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Service] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - apidocPrefix: String = "apidoc", - name: String = "name", - organizationPrefix: String = "organization", - applicationPrefix: String = "application", - namespace: String = "namespace", - version: String = "version", - baseUrl: String = "base_url", - description: String = "description", - infoPrefix: String = "info", - headers: String = "headers", - imports: String = "imports", - enums: String = "enums", - interfaces: String = "interfaces", - unions: String = "unions", - models: String = "models", - resources: String = "resources", - attributes: String = "attributes", - annotations: String = "annotations", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Service] = { - io.apibuilder.spec.v0.anorm.parsers.Apidoc.parserWithPrefix(prefixOpt.getOrElse("") + apidocPrefix).? ~ - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - io.apibuilder.spec.v0.anorm.parsers.Organization.parserWithPrefix(prefixOpt.getOrElse("") + organizationPrefix) ~ - io.apibuilder.spec.v0.anorm.parsers.Application.parserWithPrefix(prefixOpt.getOrElse("") + applicationPrefix) ~ - SqlParser.str(prefixOpt.getOrElse("") + namespace) ~ - SqlParser.str(prefixOpt.getOrElse("") + version) ~ - SqlParser.str(prefixOpt.getOrElse("") + baseUrl).? ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Info.parserWithPrefix(prefixOpt.getOrElse("") + infoPrefix) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Header]](prefixOpt.getOrElse("") + headers) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Import]](prefixOpt.getOrElse("") + imports) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Enum]](prefixOpt.getOrElse("") + enums) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Interface]](prefixOpt.getOrElse("") + interfaces) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Union]](prefixOpt.getOrElse("") + unions) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Model]](prefixOpt.getOrElse("") + models) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Resource]](prefixOpt.getOrElse("") + resources) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Annotation]](prefixOpt.getOrElse("") + annotations) map { - case apidoc ~ name ~ organization ~ application ~ namespace ~ version ~ baseUrl ~ description ~ info ~ headers ~ imports ~ enums ~ interfaces ~ unions ~ models ~ resources ~ attributes ~ annotations => { - io.apibuilder.spec.v0.models.Service( - apidoc = apidoc, - name = name, - organization = organization, - application = application, - namespace = namespace, - version = version, - baseUrl = baseUrl, - description = description, - info = info, - headers = headers, - imports = imports, - enums = enums, - interfaces = interfaces, - unions = unions, - models = models, - resources = resources, - attributes = attributes, - annotations = annotations - ) - } - } - } - - } - - object Union { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.Union] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - name: String = "name", - plural: String = "plural", - discriminator: String = "discriminator", - description: String = "description", - deprecationPrefix: String = "deprecation", - types: String = "types", - attributes: String = "attributes", - interfaces: String = "interfaces", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.Union] = { - SqlParser.str(prefixOpt.getOrElse("") + name) ~ - SqlParser.str(prefixOpt.getOrElse("") + plural) ~ - SqlParser.str(prefixOpt.getOrElse("") + discriminator).? ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.UnionType]](prefixOpt.getOrElse("") + types) ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ - SqlParser.get[Seq[String]](prefixOpt.getOrElse("") + interfaces) map { - case name ~ plural ~ discriminator ~ description ~ deprecation ~ types ~ attributes ~ interfaces => { - io.apibuilder.spec.v0.models.Union( - name = name, - plural = plural, - discriminator = discriminator, - description = description, - deprecation = deprecation, - types = types, - attributes = attributes, - interfaces = interfaces - ) - } - } - } - - } - - object UnionType { - - def parserWithPrefix(prefix: String, sep: String = "_"): RowParser[io.apibuilder.spec.v0.models.UnionType] = parser(prefixOpt = Some(s"$prefix$sep")) - - def parser( - `type`: String = "type", - description: String = "description", - deprecationPrefix: String = "deprecation", - attributes: String = "attributes", - default: String = "default", - discriminatorValue: String = "discriminator_value", - prefixOpt: Option[String] = None - ): RowParser[io.apibuilder.spec.v0.models.UnionType] = { - SqlParser.str(prefixOpt.getOrElse("") + `type`) ~ - SqlParser.str(prefixOpt.getOrElse("") + description).? ~ - io.apibuilder.spec.v0.anorm.parsers.Deprecation.parserWithPrefix(prefixOpt.getOrElse("") + deprecationPrefix).? ~ - SqlParser.get[Seq[io.apibuilder.spec.v0.models.Attribute]](prefixOpt.getOrElse("") + attributes) ~ - SqlParser.bool(prefixOpt.getOrElse("") + default).? ~ - SqlParser.str(prefixOpt.getOrElse("") + discriminatorValue).? map { - case typeInstance ~ description ~ deprecation ~ attributes ~ default ~ discriminatorValue => { - io.apibuilder.spec.v0.models.UnionType( - `type` = typeInstance, - description = description, - deprecation = deprecation, - attributes = attributes, - default = default, - discriminatorValue = discriminatorValue - ) - } - } - } - - } - - object ResponseCode { - - def parserWithPrefix(prefix: String, sep: String = "_") = { - SqlParser.int(s"$prefix${sep}response_code").map(io.apibuilder.spec.v0.models.ResponseCodeInt.apply) | - io.apibuilder.spec.v0.anorm.parsers.ResponseCodeOption.parser("response_code", Some(s"$prefix$sep")) - } - - def parser() = { - SqlParser.int("response_code").map(io.apibuilder.spec.v0.models.ResponseCodeInt.apply) | - io.apibuilder.spec.v0.anorm.parsers.ResponseCodeOption.parser("response_code") - } - - } - -} \ No newline at end of file From 575a79f73f6a43fb60ccc4fb1c97d63f118482a1 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 10:33:55 -0400 Subject: [PATCH 75/95] wip --- api/app/db/TokensDao.scala | 2 +- api/app/db/VersionsDao.scala | 2 +- api/app/db/WatchesDao.scala | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/app/db/TokensDao.scala b/api/app/db/TokensDao.scala index bbf071590..ab64d3ae9 100644 --- a/api/app/db/TokensDao.scala +++ b/api/app/db/TokensDao.scala @@ -99,7 +99,7 @@ class TokensDao @Inject() ( equals("tokens.guid", guid). as(SqlParser.str("token").*). headOption. - map(CleartextToken) + map(CleartextToken(_)) } } diff --git a/api/app/db/VersionsDao.scala b/api/app/db/VersionsDao.scala index f13aa9074..b8d2863b6 100644 --- a/api/app/db/VersionsDao.scala +++ b/api/app/db/VersionsDao.scala @@ -300,7 +300,7 @@ class VersionsDao @Inject() ( guid = guid, applicationGuid = applicationGuid, version = version, - original = (originalType.map(OriginalType.apply), originalData).mapN(Original), + original = (originalType.map(OriginalType.apply), originalData).mapN(Original(_, _)), serviceJson = serviceJson, audit = Audit( createdAt = createdAt, diff --git a/api/app/db/WatchesDao.scala b/api/app/db/WatchesDao.scala index 6f671310f..5fa91852b 100644 --- a/api/app/db/WatchesDao.scala +++ b/api/app/db/WatchesDao.scala @@ -52,7 +52,7 @@ class WatchesDao @Inject() ( ( usersDao.findByGuid(form.userGuid).toValidNec(Validation.singleError("User not found")), applicationsDao.findByOrganizationKeyAndApplicationKey(auth, form.organizationKey, form.applicationKey).toValidNec(Validation.singleError(s"Application[${form.applicationKey}] not found")) - ).mapN(ValidatedWatchForm) + ).mapN(ValidatedWatchForm(_, _)) } private def findByApplicationGuidAndUserGuid(applicationGuid: UUID, userGuid: UUID) = { From 80d50d8c682cb069d5dfcb8c93114680af67267d Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 10:38:15 -0400 Subject: [PATCH 76/95] wip --- api/app/controllers/MembershipRequests.scala | 3 +-- api/app/controllers/Users.scala | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/api/app/controllers/MembershipRequests.scala b/api/app/controllers/MembershipRequests.scala index 5e9a90409..c0f2066a4 100644 --- a/api/app/controllers/MembershipRequests.scala +++ b/api/app/controllers/MembershipRequests.scala @@ -58,8 +58,7 @@ class MembershipRequests @Inject() ( case e: JsError => { Conflict(Json.toJson(Validation.error(e.toString))) } - case s: JsSuccess[MembershipRequestForm] => { - val form = s.get + case JsSuccess(form: MembershipRequestForm, _) => { organizationsDao.findByGuid(request.authorization, form.org_guid) match { case None => { Conflict(Json.toJson(Validation.error("Organization not found or not authorized to make changes to this org"))) diff --git a/api/app/controllers/Users.scala b/api/app/controllers/Users.scala index b42cfae89..b28dc0004 100644 --- a/api/app/controllers/Users.scala +++ b/api/app/controllers/Users.scala @@ -64,8 +64,7 @@ class Users @Inject() ( case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) } - case s: JsSuccess[UserForm] => { - val form = s.get + case JsSuccess(form: UserForm, _) => { usersDao.validateNewUser(form) match { case Nil => { val user = usersDao.create(form) From 8c9cadce4e88ac78f1a5a777b571e014c688f8d2 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 10:39:13 -0400 Subject: [PATCH 77/95] wip --- api/app/controllers/Users.scala | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/api/app/controllers/Users.scala b/api/app/controllers/Users.scala index b28dc0004..6bac984d2 100644 --- a/api/app/controllers/Users.scala +++ b/api/app/controllers/Users.scala @@ -125,10 +125,8 @@ class Users @Inject() ( case e: JsError => { Conflict(Json.toJson(Validation.invalidJson(e))) } - case s: JsSuccess[UserAuthenticationForm] => { - val form = s.get + case JsSuccess(form: UserAuthenticationForm, _) => { usersDao.findByEmail(form.email) match { - case None => { Conflict(Json.toJson(Validation.userAuthorizationFailed())) } @@ -150,9 +148,8 @@ class Users @Inject() ( case e: JsError => Future.successful { Conflict(Json.toJson(Validation.invalidJson(e))) } - case s: JsSuccess[GithubAuthenticationForm] => { - val token = s.get.token - val headers = "Authorization" -> s"Bearer $token" + case JsSuccess(form: GithubAuthenticationForm, _) => { + val headers = "Authorization" -> s"Bearer ${form.token}" for { userResponse <- wsClient.url("https://api.github.com/user").addHttpHeaders(headers).get() From 544b0715a96cdc7ab8a299742b1626e8c0ee2e6e Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 10:40:41 -0400 Subject: [PATCH 78/95] wip --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index ee1cb5a55..cf84f70ec 100644 --- a/build.sbt +++ b/build.sbt @@ -153,7 +153,7 @@ lazy val app = project "org.apache.commons" % "commons-compress" % "1.26.2", "com.github.tototoshi" %% "scala-csv" % "1.4.0", "com.vladsch.flexmark" % "flexmark-all" % "0.64.8", - "org.webjars" %% "webjars-play" % "2.8.18", + "org.webjars" %% "webjars-play" % "3.0.1", "org.webjars" % "bootstrap" % "3.3.7", "org.webjars" % "bootstrap-social" % "5.0.0", "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test From 9f46f924b926c6b4c305c001430cbf8f8ea9c6ac Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 10:46:54 -0400 Subject: [PATCH 79/95] wip --- app/app/views/main.scala.html | 4 ++-- app/app/views/versions/form.scala.html | 14 ++++++-------- app/app/views/versions/show.scala.html | 14 +++++++------- app/app/views/versions/values.scala.html | 15 ++++++++------- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/app/app/views/main.scala.html b/app/app/views/main.scala.html index 587ae5938..84d8c3fe5 100644 --- a/app/app/views/main.scala.html +++ b/app/app/views/main.scala.html @@ -70,8 +70,8 @@ @if(!service.enums.isEmpty) { Enums } diff --git a/app/app/views/versions/form.scala.html b/app/app/views/versions/form.scala.html index eac937084..07a021e15 100644 --- a/app/app/views/versions/form.scala.html +++ b/app/app/views/versions/form.scala.html @@ -50,14 +50,12 @@ @helper.select( form("original_type"), - Seq( ("", "-- auto detect --") ) ++ io.apibuilder.api.v0.models.OriginalType.all.map { t => - t match { - case io.apibuilder.api.v0.models.OriginalType.AvroIdl => (t.toString, "Avro IDL (experimental)") - case io.apibuilder.api.v0.models.OriginalType.ApiJson => (t.toString, "api.json") - case io.apibuilder.api.v0.models.OriginalType.ServiceJson => (t.toString, "service.json") - case io.apibuilder.api.v0.models.OriginalType.Swagger => (t.toString, "Swagger: JSON or YAML (2.0, experimental)") - case io.apibuilder.api.v0.models.OriginalType.UNDEFINED(name) => (t.toString, name) - } + Seq( ("", "-- auto detect --") ) ++ io.apibuilder.api.v0.models.OriginalType.all.map { + case io.apibuilder.api.v0.models.OriginalType.AvroIdl => (t.toString, "Avro IDL (experimental)") + case io.apibuilder.api.v0.models.OriginalType.ApiJson => (t.toString, "api.json") + case io.apibuilder.api.v0.models.OriginalType.ServiceJson => (t.toString, "service.json") + case io.apibuilder.api.v0.models.OriginalType.Swagger => (t.toString, "Swagger: JSON or YAML (2.0, experimental)") + case io.apibuilder.api.v0.models.OriginalType.UNDEFINED(name) => (t.toString, name) }, Symbol("_label") -> "Type" ) diff --git a/app/app/views/versions/show.scala.html b/app/app/views/versions/show.scala.html index af1075e94..4778272b4 100644 --- a/app/app/views/versions/show.scala.html +++ b/app/app/views/versions/show.scala.html @@ -78,16 +78,16 @@

Enums

@if(service.enums.isEmpty) { No enums } else { - @service.enums.map { enum => -
- + @service.enums.map { e => +
+
-

@enum.name

- @enum.deprecation.map(deprecation(_)) +

@e.name

+ @e.deprecation.map(deprecation(_)) - @Html(lib.Markdown(enum.description)) + @Html(lib.Markdown(e.description)) - @values(tpl.org.get, application, tpl.version.get, enum) + @values(tpl.org.get, application, tpl.version.get, e)
} } diff --git a/app/app/views/versions/values.scala.html b/app/app/views/versions/values.scala.html index 83de90520..665088e4f 100644 --- a/app/app/views/versions/values.scala.html +++ b/app/app/views/versions/values.scala.html @@ -1,7 +1,7 @@ @(org: io.apibuilder.api.v0.models.Organization, app: io.apibuilder.api.v0.models.Application, version: String, - enum: io.apibuilder.spec.v0.models.Enum) + e: io.apibuilder.spec.v0.models.Enum) @@ -12,15 +12,16 @@ - @enum.values.map { value => + @e.deprecation.map { depr => + + + + } + @e.values.map { value => - + } From 68ace1bc40fea6fbc8c8813fc1d96f235167798f Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 15:43:02 -0400 Subject: [PATCH 80/95] wip --- app/app/controllers/AccountController.scala | 6 ++-- .../AccountProfileController.scala | 13 ++++---- .../controllers/ApplicationController.scala | 7 ++-- app/app/controllers/ApplicationSettings.scala | 24 +++++++------- .../controllers/AttributesController.scala | 15 +++++---- app/app/controllers/Domains.scala | 15 +++++---- app/app/controllers/EmailVerifications.scala | 3 +- app/app/controllers/GeneratorServices.scala | 5 +-- app/app/controllers/Generators.scala | 15 +++++---- app/app/controllers/GithubController.scala | 6 ++-- app/app/controllers/Healthchecks.scala | 3 +- app/app/controllers/HistoryController.scala | 3 +- app/app/controllers/LoginController.scala | 32 +++++++++---------- app/app/controllers/LogoutController.scala | 6 ++-- app/app/controllers/Members.scala | 25 ++++++++------- .../MembershipRequestReviews.scala | 6 ++-- .../OrganizationAttributesController.scala | 13 ++++---- app/app/controllers/SearchController.scala | 3 +- app/app/controllers/Subscriptions.scala | 7 ++-- app/app/controllers/TokensController.scala | 19 +++++------ app/app/controllers/Versions.scala | 32 ++++++++++--------- app/app/lib/MemberDownload.scala | 9 +++--- 22 files changed, 145 insertions(+), 122 deletions(-) diff --git a/app/app/controllers/AccountController.scala b/app/app/controllers/AccountController.scala index 1c1289337..cc2dfc899 100644 --- a/app/app/controllers/AccountController.scala +++ b/app/app/controllers/AccountController.scala @@ -1,5 +1,7 @@ package controllers +import play.api.mvc.{Action, AnyContent} + import javax.inject.Inject import scala.concurrent.ExecutionContext @@ -9,11 +11,11 @@ class AccountController @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def redirect = Action { implicit request => + def redirect: Action[AnyContent] = Action { implicit request => Redirect(routes.AccountController.index()) } - def index() = Identified { implicit request => + def index(): Action[AnyContent] = Identified { implicit request => Redirect(routes.AccountProfileController.index()) } diff --git a/app/app/controllers/AccountProfileController.scala b/app/app/controllers/AccountProfileController.scala index edfd3d68c..141fc71b9 100644 --- a/app/app/controllers/AccountProfileController.scala +++ b/app/app/controllers/AccountProfileController.scala @@ -3,8 +3,9 @@ package controllers import io.apibuilder.api.v0.models.UserUpdateForm import javax.inject.Inject -import play.api.data._ -import play.api.data.Forms._ +import play.api.data.* +import play.api.data.Forms.* +import play.api.mvc.{Action, AnyContent} import scala.concurrent.{ExecutionContext, Future} @@ -14,16 +15,16 @@ class AccountProfileController @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def redirect = Action { implicit request => + def redirect: Action[AnyContent] = Action { implicit request => Redirect(routes.AccountProfileController.index()) } - def index() = Identified { implicit request => + def index(): Action[AnyContent] = Identified { implicit request => val tpl = request.mainTemplate(Some("Profile")) Ok(views.html.account.profile.index(tpl, request.user)) } - def edit() = Identified { implicit request => + def edit(): Action[AnyContent] = Identified { implicit request => val form = AccountProfileController.profileForm.fill( AccountProfileController.ProfileData( email = request.user.email, @@ -36,7 +37,7 @@ class AccountProfileController @Inject() ( Ok(views.html.account.profile.edit(tpl, request.user, form)) } - def postEdit = Identified.async { implicit request => + def postEdit: Action[AnyContent] = Identified.async { implicit request => val tpl = request.mainTemplate(Some("Edit Profile")) val form = AccountProfileController.profileForm.bindFromRequest() diff --git a/app/app/controllers/ApplicationController.scala b/app/app/controllers/ApplicationController.scala index ba7911a81..989adfdd1 100644 --- a/app/app/controllers/ApplicationController.scala +++ b/app/app/controllers/ApplicationController.scala @@ -1,6 +1,7 @@ package controllers import lib.{ApiClientProvider, PaginatedCollection, Pagination} +import play.api.mvc.{Action, AnyContent} import javax.inject.Inject import scala.concurrent.ExecutionContext @@ -12,15 +13,15 @@ class ApplicationController @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def redirect() = Action { request => + def redirect(): Action[AnyContent] = Action { request => Redirect(request.path + "/") } - def redirectOrg(org: String) = Action { request => + def redirectOrg(org: String): Action[AnyContent] = Action { request => Redirect(request.path + "/") } - def index(orgsPage: Int = 0, membershipRequestsPage: Int = 0, publicOrgsPage: Int = 0) = Anonymous.async { implicit request => + def index(orgsPage: Int = 0, membershipRequestsPage: Int = 0, publicOrgsPage: Int = 0): Action[AnyContent] = Anonymous.async { implicit request => request.user match { case None => { for { diff --git a/app/app/controllers/ApplicationSettings.scala b/app/app/controllers/ApplicationSettings.scala index 8f41e86b1..301c4f671 100644 --- a/app/app/controllers/ApplicationSettings.scala +++ b/app/app/controllers/ApplicationSettings.scala @@ -4,10 +4,10 @@ import io.apibuilder.api.v0.models.{ApplicationForm, MoveForm, Visibility} import javax.inject.Inject import lib.ApiClientProvider -import models._ -import play.api.data.Forms._ -import play.api.data._ -import play.api.mvc.Result +import models.* +import play.api.data.Forms.* +import play.api.data.* +import play.api.mvc.{Action, AnyContent, Result} import scala.concurrent.{ExecutionContext, Future} @@ -63,7 +63,7 @@ class ApplicationSettings @Inject() ( } } - def show(orgKey: String, applicationKey: String, versionName: String) = IdentifiedOrg.async { implicit request => + def show(orgKey: String, applicationKey: String, versionName: String): Action[AnyContent] = IdentifiedOrg.async { implicit request => for { tpl <- mainTemplate(request.api, request.mainTemplate(None), applicationKey, versionName) } yield { @@ -73,7 +73,7 @@ class ApplicationSettings @Inject() ( } } - def edit(orgKey: String, applicationKey: String, versionName: String) = IdentifiedOrg.async { implicit request => + def edit(orgKey: String, applicationKey: String, versionName: String): Action[AnyContent] = IdentifiedOrg.async { implicit request => for { tpl <- mainTemplate(request.api, request.mainTemplate(None), applicationKey, versionName) } yield { @@ -84,7 +84,7 @@ class ApplicationSettings @Inject() ( } } - def postEdit(orgKey: String, applicationKey: String, versionName: String) = IdentifiedOrg.async { implicit request => + def postEdit(orgKey: String, applicationKey: String, versionName: String): Action[AnyContent] = IdentifiedOrg.async { implicit request => mainTemplate(request.api, request.mainTemplate(None), applicationKey, versionName).flatMap { result => result match { case Left(error) => Future { @@ -121,7 +121,7 @@ class ApplicationSettings @Inject() ( } } - def postDelete(orgKey: String, applicationKey: String) = IdentifiedOrg.async { implicit request => + def postDelete(orgKey: String, applicationKey: String): Action[AnyContent] = IdentifiedOrg.async { implicit request => for { result <- request.api.Applications.deleteByApplicationKey(request.org.key, applicationKey) } yield { @@ -129,7 +129,7 @@ class ApplicationSettings @Inject() ( } } - def move(orgKey: String, applicationKey: String) = IdentifiedOrg.async { implicit request => + def move(orgKey: String, applicationKey: String): Action[AnyContent] = IdentifiedOrg.async { implicit request => for { tpl <- mainTemplate(request.api, request.mainTemplate(None), applicationKey) } yield { @@ -139,7 +139,7 @@ class ApplicationSettings @Inject() ( } } - def postMove(orgKey: String, applicationKey: String) = IdentifiedOrg.async { implicit request => + def postMove(orgKey: String, applicationKey: String): Action[AnyContent] = IdentifiedOrg.async { implicit request => mainTemplate(request.api, request.mainTemplate(None), applicationKey).flatMap { result => result match { case Left(error) => Future { @@ -180,14 +180,14 @@ object ApplicationSettings { private[controllers] val settingsForm = Form( mapping( "visibility" -> text - )(Settings.apply)(Settings.unapply) + )(Settings.apply)(Settings.unapply(_)) ) case class MoveOrgData(orgKey: String) private[controllers] val moveOrgForm = Form( mapping( "org_key" -> text - )(MoveOrgData.apply)(MoveOrgData.unapply) + )(MoveOrgData.apply)(MoveOrgData.unapply(_)) ) } diff --git a/app/app/controllers/AttributesController.scala b/app/app/controllers/AttributesController.scala index 2cd2f50b6..97ec100dc 100644 --- a/app/app/controllers/AttributesController.scala +++ b/app/app/controllers/AttributesController.scala @@ -5,8 +5,9 @@ import lib.{ApiClientProvider, PaginatedCollection, Pagination} import scala.concurrent.{ExecutionContext, Future} import javax.inject.Inject -import play.api.data.Forms._ -import play.api.data._ +import play.api.data.Forms.* +import play.api.data.* +import play.api.mvc.{Action, AnyContent} class AttributesController @Inject() ( val apiBuilderControllerComponents: ApiBuilderControllerComponents, @@ -15,7 +16,7 @@ class AttributesController @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def index(page: Int = 0) = Anonymous.async { implicit request => + def index(page: Int = 0): Action[AnyContent] = Anonymous.async { implicit request => for { attributes <- request.api.attributes.get( limit = Pagination.DefaultLimit+1, @@ -29,7 +30,7 @@ class AttributesController @Inject() ( } } - def show(name: String, page: Int) = Anonymous.async { implicit request => + def show(name: String, page: Int): Action[AnyContent] = Anonymous.async { implicit request => for { attribute <- apiClientProvider.callWith404(request.api.attributes.getByName(name)) generators <- request.api.generatorWithServices.get( @@ -51,7 +52,7 @@ class AttributesController @Inject() ( } } - def create() = Identified { implicit request => + def create(): Action[AnyContent] = Identified { implicit request => val filledForm = AttributesController.attributesFormData.fill( AttributesController.AttributeFormData( name = "", @@ -62,7 +63,7 @@ class AttributesController @Inject() ( Ok(views.html.attributes.create(request.mainTemplate(), filledForm)) } - def createPost = Identified.async { implicit request => + def createPost: Action[AnyContent] = Identified.async { implicit request => val tpl = request.mainTemplate(Some("Add Attribute")) val form = AttributesController.attributesFormData.bindFromRequest() @@ -90,7 +91,7 @@ class AttributesController @Inject() ( ) } - def deletePost(name: String) = Identified.async { implicit request => + def deletePost(name: String): Action[AnyContent] = Identified.async { implicit request => apiClientProvider.callWith404(request.api.attributes.deleteByName(name)).map { case None => Redirect(routes.AttributesController.index()).flashing("warning" -> s"Attribute not found") case Some(_) => Redirect(routes.AttributesController.index()).flashing("success" -> s"Attribute deleted") diff --git a/app/app/controllers/Domains.scala b/app/app/controllers/Domains.scala index c4f72d1d0..db48418a9 100644 --- a/app/app/controllers/Domains.scala +++ b/app/app/controllers/Domains.scala @@ -2,9 +2,10 @@ package controllers import io.apibuilder.api.v0.models.Domain import lib.ApiClientProvider -import models._ -import play.api.data._ -import play.api.data.Forms._ +import models.* +import play.api.data.* +import play.api.data.Forms.* +import play.api.mvc.{Action, AnyContent} import scala.concurrent.{ExecutionContext, Future} import javax.inject.Inject @@ -16,21 +17,21 @@ class Domains @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def index(orgKey: String) = IdentifiedOrg { implicit request => + def index(orgKey: String): Action[AnyContent] = IdentifiedOrg { implicit request => request.withMember { val tpl = request.mainTemplate(title = Some("Domains")) Ok(views.html.domains.index(tpl.copy(settings = Some(SettingsMenu(section = Some(SettingSection.Domains)))))) } } - def create(orgKey: String) = IdentifiedOrg { implicit request => + def create(orgKey: String): Action[AnyContent] = IdentifiedOrg { implicit request => request.withAdmin { val tpl = request.mainTemplate(title = Some("Add Domain")) Ok(views.html.domains.form(tpl, Domains.domainForm)) } } - def postCreate(orgKey: String) = IdentifiedOrg.async { implicit request => + def postCreate(orgKey: String): Action[AnyContent] = IdentifiedOrg.async { implicit request => request.withAdmin { val tpl = request.mainTemplate(title = Some("Add Domain")) val boundForm = Domains.domainForm.bindFromRequest() @@ -57,7 +58,7 @@ class Domains @Inject() ( } } - def postRemove(orgKey: String, domain: String) = IdentifiedOrg.async { implicit request => + def postRemove(orgKey: String, domain: String): Action[AnyContent] = IdentifiedOrg.async { implicit request => request.withAdmin { for { _ <- request.api.Domains.deleteByName(orgKey, domain) diff --git a/app/app/controllers/EmailVerifications.scala b/app/app/controllers/EmailVerifications.scala index 266e660b0..7ed59b758 100644 --- a/app/app/controllers/EmailVerifications.scala +++ b/app/app/controllers/EmailVerifications.scala @@ -2,6 +2,7 @@ package controllers import javax.inject.Inject import io.apibuilder.api.v0.models.EmailVerificationConfirmationForm +import play.api.mvc.{Action, AnyContent} import scala.concurrent.ExecutionContext @@ -11,7 +12,7 @@ class EmailVerifications @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def get(token: String) = Anonymous.async { implicit request => + def get(token: String): Action[AnyContent] = Anonymous.async { implicit request => request.api.emailVerificationConfirmationForms.post( EmailVerificationConfirmationForm(token = token) ).map { _ => diff --git a/app/app/controllers/GeneratorServices.scala b/app/app/controllers/GeneratorServices.scala index 6ae28e161..a5673a79f 100644 --- a/app/app/controllers/GeneratorServices.scala +++ b/app/app/controllers/GeneratorServices.scala @@ -1,6 +1,7 @@ package controllers import lib.{ApiClientProvider, PaginatedCollection, Pagination} +import play.api.mvc.{Action, AnyContent} import java.util.UUID import javax.inject.Inject @@ -13,7 +14,7 @@ class GeneratorServices @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def show(guid: UUID, page: Int = 0) = Anonymous.async { implicit request => + def show(guid: UUID, page: Int = 0): Action[AnyContent] = Anonymous.async { implicit request => for { serviceOption <- apiClientProvider.callWith404(request.api.generatorServices.getByGuid(guid)) generators <- request.api.generatorWithServices.get( @@ -37,7 +38,7 @@ class GeneratorServices @Inject() ( } } - def deletePost(guid: UUID) = Anonymous.async { implicit request => + def deletePost(guid: UUID): Action[AnyContent] = Anonymous.async { implicit request => for { _ <- request.api.generatorServices.deleteByGuid(guid) } yield { diff --git a/app/app/controllers/Generators.scala b/app/app/controllers/Generators.scala index 86359ba5e..9666bcd3e 100644 --- a/app/app/controllers/Generators.scala +++ b/app/app/controllers/Generators.scala @@ -2,8 +2,9 @@ package controllers import io.apibuilder.api.v0.models.GeneratorServiceForm import lib.{ApiClientProvider, PaginatedCollection, Pagination} -import play.api.data.Forms._ -import play.api.data._ +import play.api.data.Forms.* +import play.api.data.* +import play.api.mvc.{Action, AnyContent} import scala.concurrent.{ExecutionContext, Future} import javax.inject.Inject @@ -15,11 +16,11 @@ class Generators @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def redirect = Action { implicit request => + def redirect: Action[AnyContent] = Action { implicit request => Redirect(routes.Generators.index()) } - def index(page: Int = 0) = Anonymous.async { implicit request => + def index(page: Int = 0): Action[AnyContent] = Anonymous.async { implicit request => for { generators <- request.api.generatorWithServices.get( limit = Pagination.DefaultLimit+1, @@ -33,7 +34,7 @@ class Generators @Inject() ( } } - def show(key: String) = Anonymous.async { implicit request => + def show(key: String): Action[AnyContent] = Anonymous.async { implicit request => for { generator <- apiClientProvider.callWith404(request.api.generatorWithServices.getByKey(key)) } yield { @@ -49,7 +50,7 @@ class Generators @Inject() ( } } - def create() = Identified { implicit request => + def create(): Action[AnyContent] = Identified { implicit request => val filledForm = Generators.generatorServiceCreateFormData.fill( Generators.GeneratorServiceCreateFormData( uri = "" @@ -59,7 +60,7 @@ class Generators @Inject() ( Ok(views.html.generators.create(request.mainTemplate(), filledForm)) } - def createPost = Identified.async { implicit request => + def createPost: Action[AnyContent] = Identified.async { implicit request => val form = Generators.generatorServiceCreateFormData.bindFromRequest() form.fold ( diff --git a/app/app/controllers/GithubController.scala b/app/app/controllers/GithubController.scala index c245f38b8..3904c5c23 100644 --- a/app/app/controllers/GithubController.scala +++ b/app/app/controllers/GithubController.scala @@ -17,18 +17,18 @@ class GithubController @javax.inject.Inject() ( import scala.concurrent.ExecutionContext.Implicits.global - def redirect(returnUrl: Option[String]) = Action { + def redirect(returnUrl: Option[String]): Action[AnyContent] = Action { Redirect(routes.GithubController.index(returnUrl)) } - def index(returnUrl: Option[String]) = Action { + def index(returnUrl: Option[String]): Action[AnyContent] = Action { Redirect(github.oauthUrl(returnUrl = returnUrl)) } def callback( code: String, returnUrl: String - ) = Anonymous.async { request => + ): Action[AnyContent] = Anonymous.async { request => getAccessToken(code).flatMap { case Left(ex) => Future.successful { logger.error(s"Unable to process git hub login: ${ex.getMessage}", ex) diff --git a/app/app/controllers/Healthchecks.scala b/app/app/controllers/Healthchecks.scala index 5425072fb..856747a77 100644 --- a/app/app/controllers/Healthchecks.scala +++ b/app/app/controllers/Healthchecks.scala @@ -1,6 +1,7 @@ package controllers import models.MainTemplate +import play.api.mvc.{Action, AnyContent} import javax.inject.Inject import scala.concurrent.ExecutionContext @@ -11,7 +12,7 @@ class Healthchecks @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def index() = Anonymous.async { implicit request => + def index(): Action[AnyContent] = Anonymous.async { implicit request => for { orgs <- request.api.organizations.get(key = Some("apicollective"), limit = 1) } yield { diff --git a/app/app/controllers/HistoryController.scala b/app/app/controllers/HistoryController.scala index 7fbb8c123..9e6bde7f1 100644 --- a/app/app/controllers/HistoryController.scala +++ b/app/app/controllers/HistoryController.scala @@ -1,6 +1,7 @@ package controllers import lib.{PaginatedCollection, Pagination} +import play.api.mvc.{Action, AnyContent} import javax.inject.Inject import scala.concurrent.ExecutionContext @@ -18,7 +19,7 @@ class HistoryController @Inject() ( to: Option[String], `type`: Option[String], page: Int = 0 - ) = Anonymous.async { implicit request => + ): Action[AnyContent] = Anonymous.async { implicit request => for { changes <- request.api.changes.get( orgKey = orgKey, diff --git a/app/app/controllers/LoginController.scala b/app/app/controllers/LoginController.scala index e2b8a3612..f19ceb2d6 100644 --- a/app/app/controllers/LoginController.scala +++ b/app/app/controllers/LoginController.scala @@ -3,13 +3,13 @@ package controllers import io.apibuilder.api.v0.models.{PasswordReset, PasswordResetRequest} import lib.{ApiClientProvider, Github, Util} import models.MainTemplate -import play.api.data._ -import play.api.data.Forms._ +import play.api.data.* +import play.api.data.Forms.* import scala.concurrent.Future import javax.inject.Inject - import play.api.Logger +import play.api.mvc.{Action, AnyContent} class LoginController @Inject() ( val apiBuilderControllerComponents: ApiBuilderControllerComponents, @@ -24,11 +24,11 @@ class LoginController @Inject() ( private val DevSessionId = "dev" - def redirect = Action { + def redirect: Action[AnyContent] = Action { Redirect(routes.LoginController.index()) } - def developmentLogin = Anonymous.async { request => + def developmentLogin: Action[AnyContent] = Anonymous.async { request => request.api.authentications.getSessionById(DevSessionId).map { result => Redirect("/"). withSession { "session_id" -> result.session.id }. @@ -42,19 +42,19 @@ class LoginController @Inject() ( } } - def index(returnUrl: Option[String]) = Action { implicit request => + def index(returnUrl: Option[String]): Action[AnyContent] = Action { implicit request => val tpl = MainTemplate(requestPath = request.path) Ok(views.html.login.index(tpl, github, LoginController.Tab.Login, returnUrl)) } - def legacy(returnUrl: Option[String]) = Action { implicit request => + def legacy(returnUrl: Option[String]): Action[AnyContent] = Action { implicit request => val tpl = MainTemplate(requestPath = request.path) val lForm = LoginController.loginForm.fill(LoginController.LoginData(email = "", password = "", returnUrl = returnUrl)) val rForm = LoginController.registerForm.fill(LoginController.RegisterData(name = None, email = "", password = "", passwordVerify = "", returnUrl = returnUrl)) Ok(views.html.login.legacy(tpl, LoginController.Tab.Login, lForm, rForm)) } - def legacyPost = Anonymous.async { implicit request => + def legacyPost: Action[AnyContent] = Anonymous.async { implicit request => val tpl = MainTemplate(requestPath = request.path) val form = LoginController.loginForm.bindFromRequest() form.fold ( @@ -93,12 +93,12 @@ class LoginController @Inject() ( ) } - def forgotPassword() = Action { implicit request => + def forgotPassword(): Action[AnyContent] = Action { implicit request => val tpl = MainTemplate(requestPath = request.path) Ok(views.html.login.forgotPassword(tpl, LoginController.forgotPasswordForm)) } - def postForgotPassword = Anonymous.async { implicit request => + def postForgotPassword: Action[AnyContent] = Anonymous.async { implicit request => val tpl = MainTemplate(requestPath = request.path) val form = LoginController.forgotPasswordForm.bindFromRequest() form.fold ( @@ -119,12 +119,12 @@ class LoginController @Inject() ( ) } - def resetPassword(token: String) = Action { implicit request => + def resetPassword(token: String): Action[AnyContent] = Action { implicit request => val tpl = MainTemplate(requestPath = request.path) Ok(views.html.login.resetPassword(tpl, token, LoginController.resetPasswordForm)) } - def postResetPassword(token: String) = Anonymous.async { implicit request => + def postResetPassword(token: String): Action[AnyContent] = Anonymous.async { implicit request => val tpl = MainTemplate(requestPath = request.path) val form = LoginController.resetPasswordForm.bindFromRequest() form.fold ( @@ -155,7 +155,7 @@ class LoginController @Inject() ( object LoginController { case class LoginData(email: String, password: String, returnUrl: Option[String]) - val loginForm = Form( + val loginForm: Form[LoginData] = Form( mapping( "email" -> nonEmptyText, "password" -> nonEmptyText, @@ -164,7 +164,7 @@ object LoginController { ) case class RegisterData(name: Option[String], email: String, password: String, passwordVerify: String, returnUrl: Option[String]) - val registerForm = Form( + val registerForm: Form[RegisterData] = Form( mapping( "name" -> optional(text), "email" -> nonEmptyText, @@ -177,14 +177,14 @@ object LoginController { ) case class ForgotPasswordData(email: String) - val forgotPasswordForm = Form( + val forgotPasswordForm: Form[ForgotPasswordData] = Form( mapping( "email" -> nonEmptyText )(ForgotPasswordData.apply)(ForgotPasswordData.unapply) ) case class ResetPasswordData(password: String, passwordVerify: String) - val resetPasswordForm = Form( + val resetPasswordForm: Form[ResetPasswordData] = Form( mapping( "password" -> nonEmptyText(minLength=5), "password_verify" -> nonEmptyText diff --git a/app/app/controllers/LogoutController.scala b/app/app/controllers/LogoutController.scala index df3069bff..9affce37a 100644 --- a/app/app/controllers/LogoutController.scala +++ b/app/app/controllers/LogoutController.scala @@ -1,6 +1,8 @@ package controllers import models.MainTemplate +import play.api.mvc.{Action, AnyContent} + import javax.inject.Inject class LogoutController @Inject() ( @@ -8,11 +10,11 @@ class LogoutController @Inject() ( ) extends ApiBuilderController { - def logged_out = Action { implicit request => + def logged_out: Action[AnyContent] = Action { implicit request => Ok(views.html.logged_out(MainTemplate(requestPath = request.path))) } - def logout = Action { + def logout: Action[AnyContent] = Action { Redirect("/logged_out").withNewSession } diff --git a/app/app/controllers/Members.scala b/app/app/controllers/Members.scala index 0b39112c7..094006a35 100644 --- a/app/app/controllers/Members.scala +++ b/app/app/controllers/Members.scala @@ -1,15 +1,16 @@ package controllers -import lib._ +import lib.* import io.apibuilder.api.v0.models.{Organization, User} import io.apibuilder.common.v0.models.MembershipRole -import models._ -import play.api.data._ -import play.api.data.Forms._ +import models.* +import play.api.data.* +import play.api.data.Forms.* import scala.concurrent.{Await, ExecutionContext} -import scala.concurrent.duration._ +import scala.concurrent.duration.* import org.joda.time.DateTime +import play.api.mvc.{Action, AnyContent} import java.util.UUID import javax.inject.Inject @@ -21,7 +22,7 @@ class Members @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def show(orgKey: String, page: Int = 0) = IdentifiedOrg.async { implicit request => + def show(orgKey: String, page: Int = 0): Action[AnyContent] = IdentifiedOrg.async { implicit request => request.withMember { for { orgs <- request.api.Organizations.get(key = Some(orgKey)) @@ -47,7 +48,7 @@ class Members @Inject() ( } } - def add(orgKey: String) = IdentifiedOrg { implicit request => + def add(orgKey: String): Action[AnyContent] = IdentifiedOrg { implicit request => request.withMember { val filledForm = Members.addMemberForm.fill(Members.AddMemberData(role = MembershipRole.Member.toString, email = "", nickname = "")) @@ -56,7 +57,7 @@ class Members @Inject() ( } } - def addPost(orgKey: String) = IdentifiedOrg { implicit request => + def addPost(orgKey: String): Action[AnyContent] = IdentifiedOrg { implicit request => request.withMember { val tpl = request.mainTemplate(Some("Add Member")).copy(settings = Some(SettingsMenu(section = Some(SettingSection.Members)))) @@ -93,7 +94,7 @@ class Members @Inject() ( } } - def postRemove(orgKey: String, guid: UUID) = IdentifiedOrg.async { implicit request => + def postRemove(orgKey: String, guid: UUID): Action[AnyContent] = IdentifiedOrg.async { implicit request => request.withAdmin { for { _ <- request.api.Memberships.deleteByGuid(guid) @@ -103,7 +104,7 @@ class Members @Inject() ( } } - def postRevokeAdmin(orgKey: String, guid: UUID) = IdentifiedOrg.async { implicit request => + def postRevokeAdmin(orgKey: String, guid: UUID): Action[AnyContent] = IdentifiedOrg.async { implicit request => request.withAdmin { for { membership <- apiClientProvider.callWith404(request.api.Memberships.getByGuid(guid)) @@ -130,7 +131,7 @@ class Members @Inject() ( } } - def postMakeAdmin(orgKey: String, guid: UUID) = IdentifiedOrg.async { implicit request => + def postMakeAdmin(orgKey: String, guid: UUID): Action[AnyContent] = IdentifiedOrg.async { implicit request => request.withAdmin { for { membership <- apiClientProvider.callWith404(request.api.Memberships.getByGuid(guid)) @@ -156,7 +157,7 @@ class Members @Inject() ( } } - def downloadCsv(orgKey: String) = IdentifiedOrg.async { implicit request => + def downloadCsv(orgKey: String): Action[AnyContent] = IdentifiedOrg.async { implicit request => request.withAdmin { for { path <- MemberDownload(request.api, orgKey).csv() diff --git a/app/app/controllers/MembershipRequestReviews.scala b/app/app/controllers/MembershipRequestReviews.scala index 5a703f7d6..60ceab168 100644 --- a/app/app/controllers/MembershipRequestReviews.scala +++ b/app/app/controllers/MembershipRequestReviews.scala @@ -1,5 +1,7 @@ package controllers +import play.api.mvc.{Action, AnyContent} + import java.util.UUID import javax.inject.Inject import scala.concurrent.ExecutionContext @@ -10,7 +12,7 @@ class MembershipRequestReviews @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def accept(orgKey: String, membershipRequestGuid: UUID) = IdentifiedOrg.async { implicit request => + def accept(orgKey: String, membershipRequestGuid: UUID): Action[AnyContent] = IdentifiedOrg.async { implicit request => request.withAdmin { for { _ <- request.api.MembershipRequests.postAcceptByGuid(membershipRequestGuid) @@ -20,7 +22,7 @@ class MembershipRequestReviews @Inject() ( } } - def decline(orgKey: String, membershipRequestGuid: UUID) = IdentifiedOrg.async { implicit request => + def decline(orgKey: String, membershipRequestGuid: UUID): Action[AnyContent] = IdentifiedOrg.async { implicit request => request.withAdmin { for { _ <- request.api.MembershipRequests.postDeclineByGuid(membershipRequestGuid) diff --git a/app/app/controllers/OrganizationAttributesController.scala b/app/app/controllers/OrganizationAttributesController.scala index c00aea7bd..d51f09db4 100644 --- a/app/app/controllers/OrganizationAttributesController.scala +++ b/app/app/controllers/OrganizationAttributesController.scala @@ -2,8 +2,9 @@ package controllers import io.apibuilder.api.v0.models.AttributeValueForm import models.{SettingSection, SettingsMenu} -import play.api.data.Forms._ -import play.api.data._ +import play.api.data.Forms.* +import play.api.data.* +import play.api.mvc.{Action, AnyContent} import javax.inject.Inject import scala.concurrent.{ExecutionContext, Future} @@ -14,11 +15,11 @@ class OrganizationAttributesController @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def redirect = Action { implicit request => + def redirect: Action[AnyContent] = Action { implicit request => Redirect(routes.AttributesController.index()) } - def index(orgKey: String) = IdentifiedOrg.async { implicit request => + def index(orgKey: String): Action[AnyContent] = IdentifiedOrg.async { implicit request => // TODO: Paginate once we exceed limit for { attributes <- request.api.attributes.get( @@ -44,7 +45,7 @@ class OrganizationAttributesController @Inject() ( } } - def edit(orgKey: String, name: String) = IdentifiedOrg.async { implicit request => + def edit(orgKey: String, name: String): Action[AnyContent] = IdentifiedOrg.async { implicit request => for { attr <- request.api.attributes.getByName(name) values <- request.api.organizations.getAttributesByKey( @@ -63,7 +64,7 @@ class OrganizationAttributesController @Inject() ( } } - def editPost(orgKey: String, name: String) = IdentifiedOrg.async { implicit request => + def editPost(orgKey: String, name: String): Action[AnyContent] = IdentifiedOrg.async { implicit request => request.api.attributes.getByName(name).flatMap { attr => val tpl = request.mainTemplate(Some("Edit Attribute")) diff --git a/app/app/controllers/SearchController.scala b/app/app/controllers/SearchController.scala index c7746382f..6674d526f 100644 --- a/app/app/controllers/SearchController.scala +++ b/app/app/controllers/SearchController.scala @@ -1,6 +1,7 @@ package controllers import lib.{PaginatedCollection, Pagination, Util} +import play.api.mvc.{Action, AnyContent} import javax.inject.Inject import scala.concurrent.ExecutionContext @@ -12,7 +13,7 @@ class SearchController @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def index(q: Option[String], org: Option[String], page: Int = 0) = Anonymous.async { implicit request => + def index(q: Option[String], org: Option[String], page: Int = 0): Action[AnyContent] = Anonymous.async { implicit request => val finalQuery = Seq( org.map { key => s"org:$key" }, q diff --git a/app/app/controllers/Subscriptions.scala b/app/app/controllers/Subscriptions.scala index 79f84e525..b0a6b290f 100644 --- a/app/app/controllers/Subscriptions.scala +++ b/app/app/controllers/Subscriptions.scala @@ -2,6 +2,7 @@ package controllers import lib.Labels import io.apibuilder.api.v0.models.{Publication, SubscriptionForm} +import play.api.mvc.{Action, AnyContent} import javax.inject.Inject @@ -26,7 +27,7 @@ class Subscriptions @Inject() ( import scala.concurrent.ExecutionContext.Implicits.global - def offerPublication(isAdmin: Boolean, publication: Publication): Boolean = { + private def offerPublication(isAdmin: Boolean, publication: Publication): Boolean = { publication match { case Publication.MembershipRequestsCreate => isAdmin case Publication.MembershipsCreate => isAdmin @@ -39,7 +40,7 @@ class Subscriptions @Inject() ( def index( org: String - ) = IdentifiedOrg.async { implicit request => + ): Action[AnyContent] = IdentifiedOrg.async { implicit request => for { subscriptions <- request.api.subscriptions.get( organizationKey = Some(request.org.key), @@ -60,7 +61,7 @@ class Subscriptions @Inject() ( def postToggle( org: String, publication: Publication - ) = IdentifiedOrg.async { implicit request => + ): Action[AnyContent] = IdentifiedOrg.async { implicit request => request.api.subscriptions.get( organizationKey = Some(request.org.key), userGuid = Some(request.user.guid), diff --git a/app/app/controllers/TokensController.scala b/app/app/controllers/TokensController.scala index 3273a06f8..9a08cc479 100644 --- a/app/app/controllers/TokensController.scala +++ b/app/app/controllers/TokensController.scala @@ -4,8 +4,9 @@ import java.util.UUID import javax.inject.Inject import io.apibuilder.api.v0.models.TokenForm import lib.{ApiClientProvider, PaginatedCollection, Pagination} -import play.api.data._ -import play.api.data.Forms._ +import play.api.data.* +import play.api.data.Forms.* +import play.api.mvc.{Action, AnyContent} import scala.concurrent.{ExecutionContext, Future} @@ -16,11 +17,11 @@ class TokensController @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def redirect = Action { implicit request => + def redirect: Action[AnyContent] = Action { implicit request => Redirect(routes.TokensController.index()) } - def index(page: Int = 0) = Identified.async { implicit request => + def index(page: Int = 0): Action[AnyContent] = Identified.async { implicit request => for { tokens <- request.api.tokens.getUsersByUserGuid( request.user.guid, @@ -32,7 +33,7 @@ class TokensController @Inject() ( } } - def show(guid: UUID) = Identified.async { implicit request => + def show(guid: UUID): Action[AnyContent] = Identified.async { implicit request => for { tokens <- request.api.tokens.getUsersByUserGuid( request.user.guid, @@ -50,7 +51,7 @@ class TokensController @Inject() ( } } - def cleartext(guid: UUID) = Identified.async { implicit request => + def cleartext(guid: UUID): Action[AnyContent] = Identified.async { implicit request => for { cleartextOption <- apiClientProvider.callWith404(request.api.tokens.getCleartextByGuid(guid)) } yield { @@ -65,11 +66,11 @@ class TokensController @Inject() ( } } - def create() = Identified { implicit request => + def create(): Action[AnyContent] = Identified { implicit request => Ok(views.html.tokens.create(request.mainTemplate(Some("Create token")), TokensController.tokenForm)) } - def postCreate = Identified.async { implicit request => + def postCreate: Action[AnyContent] = Identified.async { implicit request => val tpl = request.mainTemplate(Some("Create token")) val form = TokensController.tokenForm.bindFromRequest() @@ -97,7 +98,7 @@ class TokensController @Inject() ( ) } - def postDelete(guid: UUID) = Identified.async { implicit request => + def postDelete(guid: UUID): Action[AnyContent] = Identified.async { implicit request => for { _ <- request.api.tokens.deleteByGuid(guid) } yield { diff --git a/app/app/controllers/Versions.scala b/app/app/controllers/Versions.scala index d6028014d..ca7d3873b 100644 --- a/app/app/controllers/Versions.scala +++ b/app/app/controllers/Versions.scala @@ -2,14 +2,16 @@ package controllers import java.io.File import javax.inject.Inject -import io.apibuilder.api.v0.models._ -import io.apibuilder.spec.v0.models.json._ +import io.apibuilder.api.v0.models.* +import io.apibuilder.spec.v0.models.json.* import lib.{ApiClientProvider, FileUtils, Labels, VersionTag} -import play.api.data.Forms._ -import play.api.data._ -import play.api.libs.json._ +import play.api.data.Forms.* +import play.api.data.* +import play.api.libs.Files +import play.api.libs.json.* +import play.api.mvc.{Action, AnyContent, MultipartFormData} -import scala.concurrent.duration._ +import scala.concurrent.duration.* import scala.concurrent.{Await, ExecutionContext, Future} class Versions @Inject() ( @@ -22,11 +24,11 @@ class Versions @Inject() ( private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global - def redirectToLatest(orgKey: String, applicationKey: String) = Action { + def redirectToLatest(orgKey: String, applicationKey: String): Action[AnyContent] = Action { Redirect(routes.Versions.show(orgKey, applicationKey, LatestVersion)) } - def show(orgKey: String, applicationKey: String, versionName: String) = AnonymousOrg.async { implicit request => + def show(orgKey: String, applicationKey: String, versionName: String): Action[AnyContent] = AnonymousOrg.async { implicit request => for { applicationResponse <- request.api.applications.get(orgKey = orgKey, key = Some(applicationKey)) versionsResponse <- request.api.versions.getByApplicationKey(orgKey, applicationKey) @@ -74,7 +76,7 @@ class Versions @Inject() ( } } - def original(orgKey: String, applicationKey: String, versionName: String) = AnonymousOrg.async { implicit request => + def original(orgKey: String, applicationKey: String, versionName: String): Action[AnyContent] = AnonymousOrg.async { implicit request => apiClientProvider.callWith404( request.api.versions.getByApplicationKeyAndVersion(orgKey, applicationKey, versionName) ).map { @@ -112,7 +114,7 @@ class Versions @Inject() ( def example( orgKey: String, applicationKey: String, versionName: String, typeName: String, subTypeName: Option[String], optionalFields: Option[Boolean] - ) = AnonymousOrg.async { implicit request => + ): Action[AnyContent] = AnonymousOrg.async { implicit request => apiClientProvider.callWith404( request.api.versions.getExampleByApplicationKeyAndVersionAndTypeName(orgKey, applicationKey, versionName, typeName, subTypeName = subTypeName, optionalFields = optionalFields) ).map { @@ -131,7 +133,7 @@ class Versions @Inject() ( } } - def serviceJson(orgKey: String, applicationKey: String, versionName: String) = AnonymousOrg.async { implicit request => + def serviceJson(orgKey: String, applicationKey: String, versionName: String): Action[AnyContent] = AnonymousOrg.async { implicit request => apiClientProvider.callWith404( request.api.versions.getByApplicationKeyAndVersion(orgKey, applicationKey, versionName) ).map { @@ -149,7 +151,7 @@ class Versions @Inject() ( } } - def postDelete(orgKey: String, applicationKey: String, versionName: String) = AnonymousOrg.async { implicit request => + def postDelete(orgKey: String, applicationKey: String, versionName: String): Action[AnyContent] = AnonymousOrg.async { implicit request => for { result <- apiClientProvider.callWith404( request.api.versions.deleteByApplicationKeyAndVersion(orgKey, applicationKey, versionName) @@ -163,7 +165,7 @@ class Versions @Inject() ( } - def postWatch(orgKey: String, applicationKey: String, versionName: String) = IdentifiedOrg.async { implicit request => + def postWatch(orgKey: String, applicationKey: String, versionName: String): Action[AnyContent] = IdentifiedOrg.async { implicit request => apiClientProvider.callWith404( request.api.versions.getByApplicationKeyAndVersion(request.org.key, applicationKey, versionName) ).flatMap { @@ -209,7 +211,7 @@ class Versions @Inject() ( def create( orgKey: String, applicationKey: Option[String] = None - ) = IdentifiedOrg.async { implicit request => + ): Action[AnyContent] = IdentifiedOrg.async { implicit request => request.withMember { applicationKey match { @@ -261,7 +263,7 @@ class Versions @Inject() ( def createPost( orgKey: String, applicationKey: Option[String] = None - ) = IdentifiedOrg.async(parse.multipartFormData) { implicit request => + ): Action[MultipartFormData[Files.TemporaryFile]] = IdentifiedOrg.async(parse.multipartFormData) { implicit request => request.withMember { val tpl = applicationKey match { case None => request.mainTemplate(Some(Labels.AddApplicationText)) diff --git a/app/app/lib/MemberDownload.scala b/app/app/lib/MemberDownload.scala index e7143b87f..e7c6fb0b4 100644 --- a/app/app/lib/MemberDownload.scala +++ b/app/app/lib/MemberDownload.scala @@ -1,12 +1,13 @@ package lib -import com.github.tototoshi.csv.CSVWriter -import java.io.File +import com.github.tototoshi.csv.{CSVFormat, CSVWriter} +import com.github.tototoshi.csv.defaultCSVFormat +import java.io.File import io.apibuilder.api.v0.models.Membership import scala.concurrent.{Await, ExecutionContext, Future} -import scala.concurrent.duration._ +import scala.concurrent.duration.* case class MemberDownload( client: io.apibuilder.api.v0.Client, @@ -16,7 +17,7 @@ case class MemberDownload( def csv()(implicit ec: ExecutionContext): Future[File] = Future { val file = File.createTempFile(s"member-download-$orgKey", "csv") - val writer = CSVWriter.open(file) + val writer = CSVWriter.open(file)(defaultCSVFormat) writer.writeRow(Seq("guid", "role", "user_guid", "user_email", "user_nickname", "user_name")) Pager.eachPage[Membership] { offset => From 258c31c7bff137d2b8aaa9b81982197d52dd770a Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 15:44:19 -0400 Subject: [PATCH 81/95] wip --- app/app/views/versions/form.scala.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/app/views/versions/form.scala.html b/app/app/views/versions/form.scala.html index 07a021e15..87923b3ae 100644 --- a/app/app/views/versions/form.scala.html +++ b/app/app/views/versions/form.scala.html @@ -51,11 +51,11 @@ @helper.select( form("original_type"), Seq( ("", "-- auto detect --") ) ++ io.apibuilder.api.v0.models.OriginalType.all.map { - case io.apibuilder.api.v0.models.OriginalType.AvroIdl => (t.toString, "Avro IDL (experimental)") - case io.apibuilder.api.v0.models.OriginalType.ApiJson => (t.toString, "api.json") - case io.apibuilder.api.v0.models.OriginalType.ServiceJson => (t.toString, "service.json") - case io.apibuilder.api.v0.models.OriginalType.Swagger => (t.toString, "Swagger: JSON or YAML (2.0, experimental)") - case io.apibuilder.api.v0.models.OriginalType.UNDEFINED(name) => (t.toString, name) + case t: io.apibuilder.api.v0.models.OriginalType.AvroIdl => (t.toString, "Avro IDL (experimental)") + case t: io.apibuilder.api.v0.models.OriginalType.ApiJson => (t.toString, "api.json") + case t: io.apibuilder.api.v0.models.OriginalType.ServiceJson => (t.toString, "service.json") + case t: io.apibuilder.api.v0.models.OriginalType.Swagger => (t.toString, "Swagger: JSON or YAML (2.0, experimental)") + case io.apibuilder.api.v0.models.OriginalType.UNDEFINED(name) => (name, name) }, Symbol("_label") -> "Type" ) From 775e67fa8eb9989b60f27a35f58519b76571c296 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 15:50:23 -0400 Subject: [PATCH 82/95] wip --- app/app/controllers/AccountProfileController.scala | 4 ++++ app/app/controllers/ApplicationSettings.scala | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/app/controllers/AccountProfileController.scala b/app/app/controllers/AccountProfileController.scala index 141fc71b9..fc507d5fb 100644 --- a/app/app/controllers/AccountProfileController.scala +++ b/app/app/controllers/AccountProfileController.scala @@ -76,6 +76,10 @@ object AccountProfileController { name: Option[String] ) + object ProfileData { + def unapply(d: ProfileData): Option[(String, String, Option[String])] = Some((d.email, d.nickname, d.name)) + } + private[controllers] val profileForm = Form( mapping( "email" -> nonEmptyText, diff --git a/app/app/controllers/ApplicationSettings.scala b/app/app/controllers/ApplicationSettings.scala index 301c4f671..e28c3dfe0 100644 --- a/app/app/controllers/ApplicationSettings.scala +++ b/app/app/controllers/ApplicationSettings.scala @@ -177,17 +177,23 @@ class ApplicationSettings @Inject() ( object ApplicationSettings { case class Settings(visibility: String) + object Settings { + def unapply(s: Settings): Option[String] = Some(s.visibility) + } private[controllers] val settingsForm = Form( mapping( "visibility" -> text - )(Settings.apply)(Settings.unapply(_)) + )(Settings.apply)(Settings.unapply) ) case class MoveOrgData(orgKey: String) + object MoveOrgData { + def unapply(d: MoveOrgData): Option[String] = Some(d.orgKey) + } private[controllers] val moveOrgForm = Form( mapping( "org_key" -> text - )(MoveOrgData.apply)(MoveOrgData.unapply(_)) + )(MoveOrgData.apply)(MoveOrgData.unapply) ) } From 22dd1452084cafdd6c8e9050b85c692944b347df Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 15:53:08 -0400 Subject: [PATCH 83/95] wip --- app/app/controllers/AttributesController.scala | 5 +++++ app/app/controllers/Domains.scala | 4 ++++ app/app/controllers/Generators.scala | 3 +++ app/app/controllers/GithubController.scala | 6 +++--- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/app/controllers/AttributesController.scala b/app/app/controllers/AttributesController.scala index 97ec100dc..2f3500aef 100644 --- a/app/app/controllers/AttributesController.scala +++ b/app/app/controllers/AttributesController.scala @@ -105,6 +105,11 @@ object AttributesController { name: String, description: String ) + object AttributeFormData { + def unapply(d: AttributeFormData): Option[(String, String)] = Some( + (d.name, d.description) + ) + } private[controllers] val attributesFormData = Form( mapping( diff --git a/app/app/controllers/Domains.scala b/app/app/controllers/Domains.scala index db48418a9..8f8aa58f2 100644 --- a/app/app/controllers/Domains.scala +++ b/app/app/controllers/Domains.scala @@ -73,6 +73,10 @@ class Domains @Inject() ( object Domains { case class DomainData(name: String) + object DomainData { + def unapply(d: DomainData): Option[String] = Some(d.name) + } + private[controllers] val domainForm = Form( mapping( "name" -> nonEmptyText diff --git a/app/app/controllers/Generators.scala b/app/app/controllers/Generators.scala index 9666bcd3e..666a661bb 100644 --- a/app/app/controllers/Generators.scala +++ b/app/app/controllers/Generators.scala @@ -92,6 +92,9 @@ object Generators { case class GeneratorServiceCreateFormData( uri: String ) + object GeneratorServiceCreateFormData { + def unapply(d: GeneratorServiceCreateFormData): Option[String] = Some(d.uri) + } private[controllers] val generatorServiceCreateFormData = Form( mapping( diff --git a/app/app/controllers/GithubController.scala b/app/app/controllers/GithubController.scala index 3904c5c23..119ca0bec 100644 --- a/app/app/controllers/GithubController.scala +++ b/app/app/controllers/GithubController.scala @@ -52,6 +52,8 @@ class GithubController @javax.inject.Inject() ( } private def getAccessToken(code: String): Future[Either[Throwable, String]] = { + import play.api.libs.ws.JsonBodyWritables.writeableOf_JsValue + val form = Json.obj( "client_id" -> github.clientId, "client_secret" -> github.clientSecret, @@ -60,9 +62,7 @@ class GithubController @javax.inject.Inject() ( ws.url("https://github.com/login/oauth/access_token").post(form).map { result => val parsed = FormUrlEncodedParser.parse(result.body) - val accessToken = parsed.get("access_token").getOrElse { - sys.error(s"GitHub Oauth response did not contain an access_token: ${result.body}") - }.headOption.getOrElse { + val accessToken = parsed.getOrElse("access_token", sys.error(s"GitHub Oauth response did not contain an access_token: ${result.body}")).headOption.getOrElse { sys.error(s"GitHub Oauth response returned an empty list for access_token: ${result.body}") } Right(accessToken) From fceadfcb93133d4288bc9c25c1e01fd275e883d6 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 15:57:41 -0400 Subject: [PATCH 84/95] wip --- app/app/controllers/LoginController.scala | 22 +++++++++++++++++-- .../OrganizationAttributesController.scala | 4 ++++ app/app/controllers/Organizations.scala | 5 +++++ app/app/controllers/TokensController.scala | 3 +++ app/app/controllers/Versions.scala | 6 +++++ 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/app/app/controllers/LoginController.scala b/app/app/controllers/LoginController.scala index f19ceb2d6..71c393ae5 100644 --- a/app/app/controllers/LoginController.scala +++ b/app/app/controllers/LoginController.scala @@ -155,6 +155,12 @@ class LoginController @Inject() ( object LoginController { case class LoginData(email: String, password: String, returnUrl: Option[String]) + object LoginData { + def unapply(d: LoginData): Option[(String, String, Option[String])] = { + Some(d.email, d.password, d.returnUrl) + } + } + val loginForm: Form[LoginData] = Form( mapping( "email" -> nonEmptyText, @@ -164,6 +170,11 @@ object LoginController { ) case class RegisterData(name: Option[String], email: String, password: String, passwordVerify: String, returnUrl: Option[String]) + object RegisterData { + def unapply(d: RegisterData): Option[(Option[String], String, String, String, Option[String])] = { + Some((d.name, d.email, d.password, d.passwordVerify, d.returnUrl)) + } + } val registerForm: Form[RegisterData] = Form( mapping( "name" -> optional(text), @@ -177,14 +188,21 @@ object LoginController { ) case class ForgotPasswordData(email: String) - val forgotPasswordForm: Form[ForgotPasswordData] = Form( + object ForgotPasswordData { + def unapply(d: ForgotPasswordData): Option[String] = Some(d.email) + } + private val forgotPasswordForm: Form[ForgotPasswordData] = Form( mapping( "email" -> nonEmptyText )(ForgotPasswordData.apply)(ForgotPasswordData.unapply) ) case class ResetPasswordData(password: String, passwordVerify: String) - val resetPasswordForm: Form[ResetPasswordData] = Form( + object ResetPasswordData { + def unapply(d: ResetPasswordData): Option[(String, String)] = Some((d.password, d.passwordVerify)) + } + + private val resetPasswordForm: Form[ResetPasswordData] = Form( mapping( "password" -> nonEmptyText(minLength=5), "password_verify" -> nonEmptyText diff --git a/app/app/controllers/OrganizationAttributesController.scala b/app/app/controllers/OrganizationAttributesController.scala index d51f09db4..519102666 100644 --- a/app/app/controllers/OrganizationAttributesController.scala +++ b/app/app/controllers/OrganizationAttributesController.scala @@ -114,6 +114,10 @@ object OrganizationAttributesController { value: Option[String] ) + object FormData { + def unapply(d: FormData): Option[Option[String]] = Some(d.value) + } + private[controllers] val formData = Form( mapping( "value" -> optional(text) diff --git a/app/app/controllers/Organizations.scala b/app/app/controllers/Organizations.scala index b840f0831..a94985f43 100644 --- a/app/app/controllers/Organizations.scala +++ b/app/app/controllers/Organizations.scala @@ -252,6 +252,11 @@ object Organizations { key: Option[String], visibility: String ) + object OrgData { + def unapply(d: OrgData): Option[(String, String, Option[String], String)] = { + Some((d.name, d.namespace, d.key, d.visibility)) + } + } private[controllers] val orgForm = Form( mapping( diff --git a/app/app/controllers/TokensController.scala b/app/app/controllers/TokensController.scala index 9a08cc479..aaa2ceb66 100644 --- a/app/app/controllers/TokensController.scala +++ b/app/app/controllers/TokensController.scala @@ -112,6 +112,9 @@ object TokensController { case class TokenData( description: Option[String] ) + object TokenData { + def unapply(d: TokenData): Option[Option[String]] = Some(d.description) + } private[controllers] val tokenForm = Form( mapping( diff --git a/app/app/controllers/Versions.scala b/app/app/controllers/Versions.scala index ca7d3873b..935d95cc5 100644 --- a/app/app/controllers/Versions.scala +++ b/app/app/controllers/Versions.scala @@ -362,6 +362,12 @@ object Versions { originalType: Option[String] ) + object UploadData { + def unapply(d: UploadData): Option[(String, String, Option[String])] = { + Some((d.version, d.visibility, d.originalType)) + } + } + private[controllers] val uploadForm = Form( mapping( "version" -> nonEmptyText, From 2987b154704854fbd76ee243981c4bb4a1abb257 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 15:59:57 -0400 Subject: [PATCH 85/95] wip --- app/app/controllers/Members.scala | 3 +++ app/app/views/attributes/create.scala.html | 2 +- app/conf/routes | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/app/controllers/Members.scala b/app/app/controllers/Members.scala index 094006a35..5cdd9bfa6 100644 --- a/app/app/controllers/Members.scala +++ b/app/app/controllers/Members.scala @@ -193,6 +193,9 @@ class Members @Inject() ( object Members { case class AddMemberData(role: String, email: String, nickname: String) + object AddMemberData { + def unapply(d: AddMemberData): Option[(String, String, String)] = Some((d.role, d.email, d.nickname)) + } private[controllers] val addMemberForm = Form( mapping( "role" -> default(nonEmptyText, MembershipRole.Member.toString), diff --git a/app/app/views/attributes/create.scala.html b/app/app/views/attributes/create.scala.html index f70d00d82..61d8956f3 100644 --- a/app/app/views/attributes/create.scala.html +++ b/app/app/views/attributes/create.scala.html @@ -7,7 +7,7 @@
- @helper.form(action = routes.AttributesController.createPost) { + @helper.form(action = routes.AttributesController.createPost()) { @attributeForm(form, routes.AttributesController.index()) diff --git a/app/conf/routes b/app/conf/routes index 4e09c9f7f..278eca5c8 100644 --- a/app/conf/routes +++ b/app/conf/routes @@ -6,7 +6,7 @@ GET /login controllers.Lo GET /login/ controllers.LoginController.index(return_url: Option[String] ?= None) GET /login/dev controllers.LoginController.developmentLogin GET /login/legacy controllers.LoginController.legacy(return_url: Option[String] ?= None) -POST /login/legacy controllers.LoginController.legacyPost +POST /login/legacy controllers.LoginController.legacyPost() GET /login/forgotPassword controllers.LoginController.forgotPassword POST /login/forgotPassword controllers.LoginController.postForgotPassword GET /login/resetPassword/:token controllers.LoginController.resetPassword(token: String) @@ -64,13 +64,13 @@ GET /tokens controllers.To GET /tokens/ controllers.TokensController.index(page: Int ?= 0) GET /tokens/show/:guid controllers.TokensController.show(guid: java.util.UUID) GET /tokens/cleartext/:guid controllers.TokensController.cleartext(guid: java.util.UUID) -GET /tokens/create controllers.TokensController.create +GET /tokens/create controllers.TokensController.create() POST /tokens/postCreate controllers.TokensController.postCreate POST /tokens/postDelete/:guid controllers.TokensController.postDelete(guid: java.util.UUID) GET /assets/*file controllers.Assets.at(path="/public", file) -GET /org/create controllers.Organizations.create +GET /org/create controllers.Organizations.create() POST /org/createPost controllers.Organizations.createPost GET /org/edit controllers.Organizations.edit(org_key: String) POST /org/editPost controllers.Organizations.editPost(org_key: String) From cd91e1d7eb847cd56f68d9afdb80fe5f782eca61 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 16:00:36 -0400 Subject: [PATCH 86/95] wip --- app/app/views/generators/create.scala.html | 2 +- app/app/views/login/legacy.scala.html | 2 +- app/conf/routes | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/app/views/generators/create.scala.html b/app/app/views/generators/create.scala.html index 147a734d2..ed77d9617 100644 --- a/app/app/views/generators/create.scala.html +++ b/app/app/views/generators/create.scala.html @@ -7,7 +7,7 @@
- @helper.form(action = routes.Generators.createPost) { + @helper.form(action = routes.Generators.createPost()) { @generatorForm(form, routes.Generators.index()) diff --git a/app/app/views/login/legacy.scala.html b/app/app/views/login/legacy.scala.html index 12269b85a..aa788f1c0 100644 --- a/app/app/views/login/legacy.scala.html +++ b/app/app/views/login/legacy.scala.html @@ -32,7 +32,7 @@
- @helper.form(action = routes.LoginController.legacyPost) { + @helper.form(action = routes.LoginController.legacyPost()) { @loginForm.globalErrors.map(_.message).map { msg => diff --git a/app/conf/routes b/app/conf/routes index 278eca5c8..928473c96 100644 --- a/app/conf/routes +++ b/app/conf/routes @@ -7,7 +7,7 @@ GET /login/ controllers.Lo GET /login/dev controllers.LoginController.developmentLogin GET /login/legacy controllers.LoginController.legacy(return_url: Option[String] ?= None) POST /login/legacy controllers.LoginController.legacyPost() -GET /login/forgotPassword controllers.LoginController.forgotPassword +GET /login/forgotPassword controllers.LoginController.forgotPassword() POST /login/forgotPassword controllers.LoginController.postForgotPassword GET /login/resetPassword/:token controllers.LoginController.resetPassword(token: String) POST /login/resetPassword/:token controllers.LoginController.postResetPassword(token: String) From 18dcbaad947ea53118105cf806ed1fa592c92e4f Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 16:01:32 -0400 Subject: [PATCH 87/95] wip --- app/app/views/doc/start.scala.html | 2 +- app/app/views/index.scala.html | 2 +- app/app/views/login/legacy.scala.html | 2 +- app/app/views/tokens/index.scala.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/app/views/doc/start.scala.html b/app/app/views/doc/start.scala.html index 80f43bb60..528ccc1d6 100644 --- a/app/app/views/doc/start.scala.html +++ b/app/app/views/doc/start.scala.html @@ -11,7 +11,7 @@

Step 1: Create your organization

-

After logging in, Create +

After logging in, Create an organization. The organization will serve as a container for all of your services.

diff --git a/app/app/views/index.scala.html b/app/app/views/index.scala.html index 77582f901..36a9c9127 100644 --- a/app/app/views/index.scala.html +++ b/app/app/views/index.scala.html @@ -23,7 +23,7 @@

New to API Builder?

} else { @if(organizations.isEmpty) { diff --git a/app/app/views/login/legacy.scala.html b/app/app/views/login/legacy.scala.html index aa788f1c0..a10ef1c4f 100644 --- a/app/app/views/login/legacy.scala.html +++ b/app/app/views/login/legacy.scala.html @@ -56,7 +56,7 @@ - + } diff --git a/app/app/views/tokens/index.scala.html b/app/app/views/tokens/index.scala.html index 23042f148..4ae72d566 100644 --- a/app/app/views/tokens/index.scala.html +++ b/app/app/views/tokens/index.scala.html @@ -5,7 +5,7 @@ @main(tpl) {
@depr
@value.name @value.value.getOrElse(value.name)@Html(lib.Markdown(value.description)) -

- @enum.deprecation.map(deprecation(_)) -

-
@Html(lib.Markdown(value.description))
From 9513eb8b64fe9f2694f7ef13abec5f2c5bd4a980 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 16:02:18 -0400 Subject: [PATCH 88/95] wip --- app/app/views/versions/form.scala.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/app/views/versions/form.scala.html b/app/app/views/versions/form.scala.html index 87923b3ae..719946ae4 100644 --- a/app/app/views/versions/form.scala.html +++ b/app/app/views/versions/form.scala.html @@ -50,12 +50,14 @@ @helper.select( form("original_type"), - Seq( ("", "-- auto detect --") ) ++ io.apibuilder.api.v0.models.OriginalType.all.map { - case t: io.apibuilder.api.v0.models.OriginalType.AvroIdl => (t.toString, "Avro IDL (experimental)") - case t: io.apibuilder.api.v0.models.OriginalType.ApiJson => (t.toString, "api.json") - case t: io.apibuilder.api.v0.models.OriginalType.ServiceJson => (t.toString, "service.json") - case t: io.apibuilder.api.v0.models.OriginalType.Swagger => (t.toString, "Swagger: JSON or YAML (2.0, experimental)") - case io.apibuilder.api.v0.models.OriginalType.UNDEFINED(name) => (name, name) + Seq( ("", "-- auto detect --") ) ++ io.apibuilder.api.v0.models.OriginalType.all.map { t => + t match { + case io.apibuilder.api.v0.models.OriginalType.AvroIdl => (t.toString, "Avro IDL (experimental)") + case io.apibuilder.api.v0.models.OriginalType.ApiJson => (t.toString, "api.json") + case io.apibuilder.api.v0.models.OriginalType.ServiceJson => (t.toString, "service.json") + case io.apibuilder.api.v0.models.OriginalType.Swagger => (t.toString, "Swagger: JSON or YAML (2.0, experimental)") + case io.apibuilder.api.v0.models.OriginalType.UNDEFINED(name) => (t.toString, name) + } }, Symbol("_label") -> "Type" ) From 27f81ecbfe0dea2102e7fb9e6e69582918f1e418 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 16:06:37 -0400 Subject: [PATCH 89/95] wip --- api/app/db/MembershipsDao.scala | 2 +- api/conf/base.conf | 1 - app/app/views/tokens/index.scala.html | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/api/app/db/MembershipsDao.scala b/api/app/db/MembershipsDao.scala index 7510d7271..ebc8c5943 100644 --- a/api/app/db/MembershipsDao.scala +++ b/api/app/db/MembershipsDao.scala @@ -193,7 +193,7 @@ class MembershipsDao @Inject() ( val filters = List( new OptionalQueryFilter(organizationKey) { override def filter(q: Query, value: String): Query = { - q.in("membership_requests.organization_guid", Query("select guid from organizations").isNull("deleted_at").equals("key", organizationKey)) + q.in("memberships.organization_guid", Query("select guid from organizations").isNull("deleted_at").equals("key", organizationKey)) } } ) diff --git a/api/conf/base.conf b/api/conf/base.conf index 45f925dd1..fa39d8331 100644 --- a/api/conf/base.conf +++ b/api/conf/base.conf @@ -17,7 +17,6 @@ play.http.parser.maxMemoryBuffer=10M play.http.requestHandler = "play.http.DefaultHttpRequestHandler" play.modules.enabled += "actors.ActorsModule" -play.modules.enabled += "io.flow.play.clients.ConfigModule" mail.defaultFromEmail="mbryzek@gmail.com" mail.defaultFromName="apibuilder" diff --git a/app/app/views/tokens/index.scala.html b/app/app/views/tokens/index.scala.html index 4ae72d566..ebfd5ce49 100644 --- a/app/app/views/tokens/index.scala.html +++ b/app/app/views/tokens/index.scala.html @@ -41,7 +41,7 @@

- More information on using API Tokens + More information on using API Tokens

} From 2c5c06a1744c5a636a6eeff8e2d20434889d1560 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 16:09:14 -0400 Subject: [PATCH 90/95] wip --- app/app/views/doc/releaseNotes.scala.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/app/views/doc/releaseNotes.scala.html b/app/app/views/doc/releaseNotes.scala.html index e4959a9d0..1985386a0 100644 --- a/app/app/views/doc/releaseNotes.scala.html +++ b/app/app/views/doc/releaseNotes.scala.html @@ -5,6 +5,23 @@ @doc.main(routes.DocController.releaseNotes.url, user, Some("Release notes")) { +

Jul 10, 2024

+ +
    + +
  • Upgraded API Builder code base to support play framework 2.9 + Scala3
  • + +
+ +

Nov 14, 2022

+ +
    + +
  • Introduce support for templates which allow sharing specification across models and resources. +
  • + +
+

Oct 11, 2021

    From 05c828cc46ab842247359c868c66edafbca659fb Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 16:11:37 -0400 Subject: [PATCH 91/95] wip --- app/app/views/doc/releaseNotes.scala.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/app/views/doc/releaseNotes.scala.html b/app/app/views/doc/releaseNotes.scala.html index 1985386a0..99203bdd0 100644 --- a/app/app/views/doc/releaseNotes.scala.html +++ b/app/app/views/doc/releaseNotes.scala.html @@ -11,6 +11,15 @@

    Jul 10, 2024

  • Upgraded API Builder code base to support play framework 2.9 + Scala3
  • +
+ +

Oct 12, 2023

+ +
    + +
  • Upgrade API Builder codebase to Java 17 +
  • +

Nov 14, 2022

From cea38770bcbd5b060661d0c4da9372e9371c4300 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 16:16:45 -0400 Subject: [PATCH 92/95] wip --- .../controllers/ApplicationMetadataSpec.scala | 2 +- api/test/db/MembershipRequestsDaoSpec.scala | 2 +- api/test/db/UserPasswordsDaoSpec.scala | 16 +++------------- api/test/db/VersionsDaoSpec.scala | 4 ++-- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/api/test/controllers/ApplicationMetadataSpec.scala b/api/test/controllers/ApplicationMetadataSpec.scala index f2b9a222b..8d73e05c5 100644 --- a/api/test/controllers/ApplicationMetadataSpec.scala +++ b/api/test/controllers/ApplicationMetadataSpec.scala @@ -36,6 +36,6 @@ class ApplicationMetadataSpec extends PlaySpec with MockClient with GuiceOneServ ).get() ) result.status must equal(200) - result.body must equal("2.0.0") + result.bodyAsBytes.utf8String must equal("2.0.0") } } diff --git a/api/test/db/MembershipRequestsDaoSpec.scala b/api/test/db/MembershipRequestsDaoSpec.scala index 5f491b314..97a9c913e 100644 --- a/api/test/db/MembershipRequestsDaoSpec.scala +++ b/api/test/db/MembershipRequestsDaoSpec.scala @@ -12,7 +12,7 @@ class MembershipRequestsDaoSpec extends PlaySpec with GuiceOneAppPerSuite with d private lazy val org: Organization = createOrganization() private lazy val member: User = upsertUser("gilt-member@bryzek.com") - private[this] def membershipRequestsModel: MembershipRequestsModel = app.injector.instanceOf[MembershipRequestsModel] + private def membershipRequestsModel: MembershipRequestsModel = app.injector.instanceOf[MembershipRequestsModel] "create member" in { val thisOrg = createOrganization() diff --git a/api/test/db/UserPasswordsDaoSpec.scala b/api/test/db/UserPasswordsDaoSpec.scala index 249a7436c..190f7e216 100644 --- a/api/test/db/UserPasswordsDaoSpec.scala +++ b/api/test/db/UserPasswordsDaoSpec.scala @@ -1,5 +1,6 @@ package db +import com.mbryzek.cipher.Ciphers import org.scalatestplus.play.PlaySpec import org.scalatestplus.play.guice.GuiceOneAppPerSuite @@ -7,17 +8,12 @@ class UserPasswordsDaoSpec extends PlaySpec with GuiceOneAppPerSuite with db.Hel private lazy val user = upsertUser("michael@mailinator.com") - "have distinct keys for all algorithms" in { - val keys = PasswordAlgorithm.All.map(_.key.toLowerCase) - keys must equal(keys.distinct.sorted) - } - "findByUserGuid" in { userPasswordsDao.create(user, user.guid, "password") val up = userPasswordsDao.findByUserGuid(user.guid).get up.userGuid must equal(user.guid) - up.algorithm must equal(PasswordAlgorithm.Latest) + up.algorithmKey must equal(Ciphers().latest.key) } "validate matching passwords" in { @@ -37,13 +33,7 @@ class UserPasswordsDaoSpec extends PlaySpec with GuiceOneAppPerSuite with db.Hel "hash the password" in { userPasswordsDao.create(user, user.guid, "password") val up = userPasswordsDao.findByUserGuid(user.guid).get - -1 must equal(up.hash.indexOf("password")) - } - - "generates unique hashes, even for same password" in { - PasswordAlgorithm.All.filter { _ != PasswordAlgorithm.Unknown }.foreach { algo => - algo.hash("password") != algo.hash("password") must be(true) - } + -1 must equal(up.base64EncodedHash.indexOf("password")) } } diff --git a/api/test/db/VersionsDaoSpec.scala b/api/test/db/VersionsDaoSpec.scala index e0ac9a75f..5cedb7057 100644 --- a/api/test/db/VersionsDaoSpec.scala +++ b/api/test/db/VersionsDaoSpec.scala @@ -28,9 +28,9 @@ class VersionsDaoSpec extends PlaySpec with GuiceOneAppPerSuite with db.Helpers "findByApplicationAndVersion" in { versionsDao.create(testUser, application, "1.0.1", Original, service) - val versionOpt = versionsDao.findByApplicationAndVersion(Authorization.All, application, "1.0.1") + val svc = versionsDao.findByApplicationAndVersion(Authorization.All, application, "1.0.1") .flatMap(versionsModel.toModel) - val Some(svc) = versionOpt.map(_.service) + .get.service svc.namespace must be(service.namespace) } From 967730091136a829f009b6f46a850c3afa44f51c Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 16:20:36 -0400 Subject: [PATCH 93/95] wip --- api/test/lib/OriginalGeneratorHelpersSpec.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/test/lib/OriginalGeneratorHelpersSpec.scala b/api/test/lib/OriginalGeneratorHelpersSpec.scala index 90e1a53f6..b7290e8c7 100644 --- a/api/test/lib/OriginalGeneratorHelpersSpec.scala +++ b/api/test/lib/OriginalGeneratorHelpersSpec.scala @@ -24,7 +24,7 @@ class OriginalGeneratorHelpersSpec extends PlaySpec with GuiceOneAppPerSuite wit } "serviceJson" in { - OriginalUtil.guessType(readFile("../core/src/test/resources/apibuilder-service.json")) must be(Some(OriginalType.ServiceJson)) + OriginalUtil.guessType(readFile("../core/test/resources/apibuilder-service.json")) must be(Some(OriginalType.ServiceJson)) } "swaggerJson" in { From c77d75ce40302e1a07b320a24ac85d3f0a0d9af4 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 16:26:26 -0400 Subject: [PATCH 94/95] wip --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 11ee309bc..94536fffc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: scala scala: - - 2.13.8 + - 3.4.2 jdk: - - openjdk13 + - openjdk17 cache: directories: - $HOME/.ivy2/cache From f6f586b9d9c7fe97c45f844a227de2ff4cce0a25 Mon Sep 17 00:00:00 2001 From: Michael Bryzek Date: Tue, 9 Jul 2024 16:41:01 -0400 Subject: [PATCH 95/95] wip --- .github/workflows/ci.yml | 2 +- .travis.yml | 23 ----------------------- 2 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fe221f89..f583db7cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: java: [ '17' ] - scala: [ '2.13.11' ] + scala: [ '3.4.2' ] steps: - uses: actions/checkout@v2 - name: Set up JDK diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 94536fffc..000000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: scala -scala: - - 3.4.2 -jdk: - - openjdk17 -cache: - directories: - - $HOME/.ivy2/cache - - $HOME/.sbt - - $HOME/.cache/coursier -services: - - docker -before_script: - - docker run -d -p 127.0.0.1:7659:5432 flowcommerce/apibuilder-postgresql:latest-pg15 -script: - - CONF_APIBUILDER_API_HOST=http://localhost:9001 sbt ++$TRAVIS_SCALA_VERSION clean compile test -branches: - only: - - main -before_cache: - - rm -fv $HOME/.ivy2/.sbt.ivy.lock - - find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete - - find $HOME/.sbt -name "*.lock" -print -delete