From 0c8c96580f5231f52c4ca1b2a38d78c168d18d9b Mon Sep 17 00:00:00 2001 From: Sergey Morgunov Date: Fri, 11 Jun 2021 16:39:51 +0300 Subject: [PATCH] Improve implementation of `OpenAPIRouter` for Scala DSL --- .../org/taymyr/lagom/scaladsl/openapi/OpenAPIRouter.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scala/impl/src/main/scala/org/taymyr/lagom/scaladsl/openapi/OpenAPIRouter.scala b/scala/impl/src/main/scala/org/taymyr/lagom/scaladsl/openapi/OpenAPIRouter.scala index c23c786..42977f5 100644 --- a/scala/impl/src/main/scala/org/taymyr/lagom/scaladsl/openapi/OpenAPIRouter.scala +++ b/scala/impl/src/main/scala/org/taymyr/lagom/scaladsl/openapi/OpenAPIRouter.scala @@ -18,9 +18,10 @@ class OpenAPIRouter(action: DefaultActionBuilder, config: Config) { def router(service: Service, path: Option[String] = None): Router = { val openapi: OpenAPIContainer = OpenAPIContainer(service, config) val route = path.getOrElse(s"/_${service.descriptor.name}/openapi") + val pathExtractor = new StringContext(route).p Router .from { - case GET(p"$p*") if p.equals(route) => + case GET(pathExtractor()) => action { request => val isJson = "json".equalsIgnoreCase(request.getQueryString("format").orNull) if (isJson) response(openapi.spec.json, "application/json")