Commit 9015e68d authored by Kostis Trantzas's avatar Kostis Trantzas
Browse files

Adding OAS support for the NFV Metrics API (fix for #12)

parent bf673ad4
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


@Tag(name = "NFV_MetricsApi")
@Tag(name = "NFV Metrics Api")
public interface MetricsApi {

    Logger log = LoggerFactory.getLogger(MetricsApi.class);
+29 −4
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ public class SwaggerConfig {
      	SpringDocUtils.getConfig().replaceWithClass(java.time.LocalDate.class, java.sql.Date.class);
	  	SpringDocUtils.getConfig().replaceWithClass(java.time.OffsetDateTime.class, java.util.Date.class);
      return GroupedOpenApi.builder()
      		.group("nfv-portal.api.controller-v1.0.0")
      		.group("nfv-portal.api.controller")
    		.addOpenApiCustomizer( this.apiInfoPortalAPI() )
            .packagesToScan("portal.api.controller")
            .build();
@@ -69,11 +69,36 @@ public class SwaggerConfig {
		
		return openApi -> openApi
				.specVersion( SpecVersion.V30 ).addSecurityItem(new SecurityRequirement().addList("security_auth")) 
	              .info(new Info().title("NFV portal API")
	            		  .description("## NFV portal API")
	              .info(new Info().title("NFV Portal API")
	            		  .description("## An API to manage NFV Artifacts")
	                      
		              .version("1.0.0")
		              .license(new License().name("Apache 2.0").url("http://openslice.io")));
		              .license(new License().name("Apache 2.0").url("https://osl.etsi.org")));
    }

	@Bean
	public GroupedOpenApi nfvportalmetrics(){
    	
      	SpringDocUtils.getConfig().replaceWithClass(java.time.LocalDate.class, java.sql.Date.class);
	  	SpringDocUtils.getConfig().replaceWithClass(java.time.OffsetDateTime.class, java.util.Date.class);
      return GroupedOpenApi.builder()
      		.group("nfv-portal.api.metrics")
    		.addOpenApiCustomizer( this.nfvPortalAPImetrics() )
            .packagesToScan("portal.api.metrics")
            .build();
      
    }
    
    OpenApiCustomizer nfvPortalAPImetrics() {

		
		return openApi -> openApi
				.specVersion( SpecVersion.V30 ).addSecurityItem(new SecurityRequirement().addList("security_auth")) 
	              .info(new Info().title("NFV Portal metrics API")
	            		  .description("## An API to retrieve metrics about NFV Portal")
	                      
		              .version("1.0.0")
		              .license(new License().name("Apache 2.0").url("https://osl.etsi.org")));
    }