package eu.nimble.service.example.impl;

import eu.nimble.service.example.swagger.model.Version;
import eu.nimble.service.example.swagger.api.VersionApi;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;

@Controller
public class VersionController implements VersionApi {

    public ResponseEntity<Version> versionGet() {
        return new ResponseEntity<Version>(VersionFactory.create(), HttpStatus.OK);
    }

    private static class VersionFactory {
        static Version create() {
            Version v = new Version();
            v.setVersion("0.0.1");
            v.setServiceId("example");
            return v;
        }
    }
}

@@ -79,21 +79,19 @@
 ger.
-model
+api
 .Version
 ;%0Aim
@@ -86,16 +86,19 @@
 .Version
+Api
 ;%0Aimport
@@ -128,35 +128,37 @@
 ple.swagger.
-api
+model
 .Version
 Api;%0Aimport 
@@ -137,35 +137,91 @@
 er.model.Version
-Api
+;%0Aimport org.springframework.beans.factory.annotation.Value
 ;%0Aimport org.spr
@@ -417,16 +417,155 @@
 nApi %7B%0A%0A
+    @Value(%22$%7Bbuild.version%7D%22)%0A    private String versionString;%0A%0A    @Value(%22$%7Bspring.application.name%7D%22)%0A    private String serviceId;%0A%0A%0A
     publ
@@ -671,16 +671,40 @@
 .create(
+serviceId, versionString
 ), HttpS
@@ -793,16 +793,48 @@
  create(
+String serviceId, String version
 ) %7B%0A    
@@ -897,15 +897,15 @@
 ion(
-%220.0.1%22
+version
 );%0A 
@@ -934,17 +934,17 @@
 eId(
-%22example%22
+serviceId
 );%0A 

use service id and version number from configuration