Files
herolib/lib/baobab/generator/templates/interface_openapi.v.template
2025-01-21 02:32:33 +00:00

21 lines
699 B
Plaintext

import freeflowuniverse.herolib.baobab.stage.interfaces
import freeflowuniverse.herolib.schemas.openapi
pub fn new_openapi_interface() !&interfaces.OpenAPIInterface {
// create OpenAPI Handler with actor's client
client := new_client()!
return interfaces.new_openapi_interface(client.Client)
}
@if http
// creates HTTP controller with the actor's OpenAPI Handler
// and OpenAPI Specification
pub fn new_openapi_http_controller(params ServerParams) !&openapi.HTTPController {
return openapi.new_http_controller(
base_url: params.base_url
specification: openapi_specification
specification_path: openapi_spec_path
handler: new_openapi_interface()!
)
}
@end