From 4dbb9e8261b050d2cb7bd3f283cfc9725bff635c Mon Sep 17 00:00:00 2001 From: SelligtomGit86 Date: Tue, 7 Jan 2025 16:00:29 +0100 Subject: [PATCH] Change default generated ID for generic API --- otoroshi/app/api/api.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/otoroshi/app/api/api.scala b/otoroshi/app/api/api.scala index 269bdf1b3..edb190c6b 100644 --- a/otoroshi/app/api/api.scala +++ b/otoroshi/app/api/api.scala @@ -1940,7 +1940,7 @@ class GenericApiController(ApiAction: ApiAction, cc: ControllerComponents)(impli case Right(_body) => { val dev = if (env.isDev) "_dev" else "" val id = Try(resource.access.extractIdJson(_body)) - .getOrElse(IdGenerator.lowerCaseToken(16)) + .getOrElse(s"${resource.singularName}${dev}_${IdGenerator.uuid}") val body = _body.asObject ++ Json.obj(resource.access.idFieldName() -> id) resource.access.findOne(version, id).flatMap { case Some(oldEntity) =>