Freemarker templates
This commit is contained in:
parent
8057928548
commit
d41212c7b2
5 changed files with 72 additions and 20 deletions
endpoints-templates
27
endpoints-templates/Endpoints.ftl
Normal file
27
endpoints-templates/Endpoints.ftl
Normal file
|
@ -0,0 +1,27 @@
|
|||
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
|
||||
import se.senashdev.projekt.api.Protocol.*
|
||||
import se.senashdev.projekt.api.Codecs._
|
||||
|
||||
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>
|
||||
val ${endpoint.inputType}Endpoint = ApiEndpoint[${endpoint.inputType?cap_first}, VersionedResponse] =
|
||||
<#list endpoint.paths.paths>
|
||||
apiV1Endpoint
|
||||
.post
|
||||
<#items as segment>
|
||||
.in("${segment}")
|
||||
</#items>
|
||||
.in(jsonBody[${endpoint.inputType?cap_first}])
|
||||
.out(jsonBody[VersionedResponse])
|
||||
|
||||
</#list>
|
||||
</#list>
|
Loading…
Add table
Add a link
Reference in a new issue