Demo ready
This commit is contained in:
parent
743432e071
commit
620999a992
7 changed files with 190 additions and 74 deletions
|
@ -0,0 +1,37 @@
|
|||
package se.senashdev.projekt.api
|
||||
|
||||
import se.rutdev.projekt.api.HttpProtocol.VersionedResponse
|
||||
import se.rutdev.framework.json.circe.RutUtilsCodec
|
||||
import se.rutdev.framework
|
||||
import se.rutdev.framework.service.api.{OAuthUtils, RequestMeta, RutTapir}
|
||||
import se.rutdev.pd.ProblemDetailProtocol.ProblemDetail
|
||||
import sttp.tapir.Schema
|
||||
|
||||
class Endpoints(override val config: OAuthUtils.OAuthConfig) extends framework.service.api.Endpoints with RutTapir with RutUtilsCodec:
|
||||
type ApiEndpoint[I, O] = OAuthEndpoint[RequestMeta.OAuthRequestMeta, I, ProblemDetail, O]
|
||||
|
||||
<#list endpoints as endpoint>
|
||||
case class ${endpoint.handler.name?cap_first}(
|
||||
<#list endpoint.handler.fields as field>
|
||||
${field.name} : ${field.type},
|
||||
</#list>
|
||||
)
|
||||
</#list>
|
||||
|
||||
<#list endpoints as endpoint>
|
||||
given Codec[${endpoint.handler.name?cap_first}] = deriveCodec
|
||||
</#list>
|
||||
|
||||
<#list endpoints as endpoint>
|
||||
val ${endpoint.handler.name}Endpoint = ApiEndpoint[${endpoint.handler.name?cap_first}, VersionedResponse] =
|
||||
<#list endpoint.paths.paths>
|
||||
apiV1Endpoint
|
||||
.post
|
||||
<#items as segment>
|
||||
.in("${segment}")
|
||||
</#items>
|
||||
.post
|
||||
.in(jsonBody[${endpoint.handler.name?cap_first}])
|
||||
.out(jsonBody[VersionedResponse])
|
||||
</#list>
|
||||
</#list>
|
Loading…
Add table
Add a link
Reference in a new issue