All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.kotlin-micronaut.server.controllerOperationBody.mustache Maven / Gradle / Ivy

    {{^generateControllerFromExamples}}
        {{!The body needs to be implemented by user}}
        // TODO implement {{nickname}}()
        {{^generateOperationsToReturnNotImplemented}}
        {{#reactive}}{{#wrapInHttpResponse}}return {{#vendorExtensions.isReturnFlux}}Flux.from({{/vendorExtensions.isReturnFlux}}Mono.fromCallable(HttpResponse::ok){{#vendorExtensions.isReturnFlux}}){{/vendorExtensions.isReturnFlux}}{{/wrapInHttpResponse}}{{^wrapInHttpResponse}}{{#vendorExtensions.isReturnFlux}}return Flux.empty(){{/vendorExtensions.isReturnFlux}}{{^vendorExtensions.isReturnFlux}}return Mono.empty(){{/vendorExtensions.isReturnFlux}}{{/wrapInHttpResponse}}{{/reactive}}{{^reactive}}{{#wrapInHttpResponse}}return HttpResponse.ok(){{/wrapInHttpResponse}}{{^wrapInHttpResponse}}{{#returnType}}return null{{/returnType}}{{/wrapInHttpResponse}}{{/reactive}}
        {{/generateOperationsToReturnNotImplemented}}
        {{#generateOperationsToReturnNotImplemented}}
        {{#reactive}}{{#wrapInHttpResponse}}{{#vendorExtensions.isReturnFlux}}return Flux.just(HttpResponse.status(HttpStatus.NOT_IMPLEMENTED)){{/vendorExtensions.isReturnFlux}}{{^vendorExtensions.isReturnFlux}}return Mono.just(HttpResponse.status(HttpStatus.NOT_IMPLEMENTED)){{/vendorExtensions.isReturnFlux}}{{/wrapInHttpResponse}}{{^wrapInHttpResponse}}{{#vendorExtensions.isReturnFlux}}return Flux.error(HttpStatusException(HttpStatus.NOT_IMPLEMENTED, null)){{/vendorExtensions.isReturnFlux}}{{^vendorExtensions.isReturnFlux}}return Mono.error(HttpStatusException(HttpStatus.NOT_IMPLEMENTED, null)){{/vendorExtensions.isReturnFlux}}{{/wrapInHttpResponse}}{{/reactive}}{{^reactive}}{{#wrapInHttpResponse}}return HttpResponse.status(HttpStatus.NOT_IMPLEMENTED){{/wrapInHttpResponse}}{{^wrapInHttpResponse}}throw HttpStatusException(HttpStatus.NOT_IMPLEMENTED, null){{/wrapInHttpResponse}}{{/reactive}}
        {{/generateOperationsToReturnNotImplemented}}
    {{/generateControllerFromExamples}}
    {{#generateControllerFromExamples}}
        {{!The body is generated to verify that example values are passed correctly}}
        {{#allParams}}
            {{^isFile}}
        var {{vendorExtensions.realName}}Expected: {{{dataType}}} = {{{example}}}
        assert {{{paramName}}}.equals({{{paramName}}}Expected) : "The parameter {{vendorExtensions.realName}} was expected to match its example value"
            {{/isFile}}
        {{/allParams}}
        {{!
        return type present
        }}{{#returnType}}return {{!
        reactive start
        }}{{#reactive}}{{#vendorExtensions.isReturnFlux}}Flux.from({{/vendorExtensions.isReturnFlux}}Mono.fromCallable(() -> {{/reactive}}{{!
        wrapInHttpResponse start
        }}{{#wrapInHttpResponse}}HttpResponse.ok({{/wrapInHttpResponse}}{{!
        body
        }}{{#vendorExtensions.example}}{{{vendorExtensions.example}}}{{/vendorExtensions.example}}{{^vendorExtensions.example}}{{^wrapInHttpResponse}}null{{/wrapInHttpResponse}}{{/vendorExtensions.example}}{{!
        wrapInHttpResponse end
        }}{{#wrapInHttpResponse}}){{/wrapInHttpResponse}}{{!
        reactive end
        }}{{#vendorExtensions.isReturnFlux}}){{/vendorExtensions.isReturnFlux}}{{#reactive}}){{/reactive}}{{/returnType}}{{!
        return type not present
        }}{{^returnType}}{{!
        reactive
        }}{{#reactive}}return {{!
        wrapInHttpResponse
        }}{{#vendorExtensions.isReturnFlux}}Flux.from({{/vendorExtensions.isReturnFlux}}{{#wrapInHttpResponse}}Mono.fromCallable(HttpResponse::ok){{/wrapInHttpResponse}}{{^wrapInHttpResponse}}Mono.fromCallable { null }{{/wrapInHttpResponse}}{{#vendorExtensions.isReturnFlux}}){{/vendorExtensions.isReturnFlux}}{{/reactive}}{{!
        not reactive
        }}{{^reactive}}{{!
        wrapInHttpResponse
        }}{{#wrapInHttpResponse}}return HttpResponse.ok(){{/wrapInHttpResponse}}{{/reactive}}{{/returnType}}
    {{/generateControllerFromExamples}}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy