Refactor/ API version handling in ApiCollector and related files

Updated the ApiCollector implementations across multiple API versions to replace the deprecated ScannedApiVersion with the new ApiVersion utility. This change enhances consistency and maintainability in the API versioning approach. The affected files include ApiCollector.scala for AU, Bahrain, Polish, STET, and UK Open Banking APIs, as well as the ApiVersion.scala file where new constants were defined for these versions.
This commit is contained in:
hongwei 2026-02-02 11:48:24 +01:00
parent 66eec52845
commit 8ef0e7c5cb
7 changed files with 18 additions and 12 deletions

View File

@ -35,7 +35,7 @@ import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, ResourceDoc, getAllowedEndpoints}
import code.api.util.ScannedApis
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.{ApiVersionStatus, ScannedApiVersion}
import com.openbankproject.commons.util.{ApiVersion, ApiVersionStatus}
import scala.collection.mutable.ArrayBuffer
@ -47,7 +47,7 @@ This file defines which endpoints from all the versions are available in v1
*/
object ApiCollector extends OBPRestHelper with MdcLoggable with ScannedApis {
//please modify these three parameter if it is not correct.
override val apiVersion = ScannedApiVersion("cds-au", "AU", "v1.0.0")
override val apiVersion = ApiVersion.cdsAuV100
val versionStatus = ApiVersionStatus.DRAFT.toString
private[this] val endpoints =

View File

@ -35,7 +35,7 @@ import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, ResourceDoc, getAllowedEndpoints}
import code.api.util.{ScannedApis}
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.{ApiVersionStatus, ScannedApiVersion}
import com.openbankproject.commons.util.{ApiVersion, ApiVersionStatus}
import scala.collection.mutable.ArrayBuffer
@ -45,7 +45,7 @@ import scala.collection.mutable.ArrayBuffer
This file defines which endpoints from all the versions are available in v1
*/
object ApiCollector extends OBPRestHelper with MdcLoggable with ScannedApis {
override val apiVersion = ScannedApiVersion("BAHRAIN-OBF", "BAHRAIN-OBF", "v1.0.0")
override val apiVersion = ApiVersion.bahrainObfV100
val versionStatus = ApiVersionStatus.DRAFT.toString
private[this] val endpoints =

View File

@ -35,7 +35,7 @@ import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, ResourceDoc, getAllowedEndpoints}
import code.api.util.ScannedApis
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.{ApiVersionStatus, ScannedApiVersion}
import com.openbankproject.commons.util.{ApiVersion, ApiVersionStatus}
import scala.collection.mutable.ArrayBuffer
@ -47,7 +47,7 @@ This file defines which endpoints from all the versions are available in v1
*/
object OBP_PAPI_2_1_1_1 extends OBPRestHelper with MdcLoggable with ScannedApis {
//please modify these three parameter if it is not correct.
override val apiVersion = ScannedApiVersion("polish-api", "PAPI", "v2.1.1.1")
override val apiVersion = ApiVersion.polishApiV2111
val versionStatus = ApiVersionStatus.DRAFT.toString
private[this] val endpoints =

View File

@ -35,7 +35,7 @@ import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, ResourceDoc, getAllowedEndpoints}
import code.api.util.ScannedApis
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.{ApiVersionStatus, ScannedApiVersion}
import com.openbankproject.commons.util.{ApiVersion, ApiVersionStatus}
import scala.collection.mutable.ArrayBuffer
@ -47,7 +47,7 @@ This file defines which endpoints from all the versions are available in v1
*/
object OBP_STET_1_4 extends OBPRestHelper with MdcLoggable with ScannedApis {
//please modify these three parameter if it is not correct.
override val apiVersion = ScannedApiVersion("stet", "STET", "v1.4")
override val apiVersion = ApiVersion.stetV14
val versionStatus = ApiVersionStatus.DRAFT.toString
private[this] val endpoints =

View File

@ -33,7 +33,7 @@ import code.util.Helper.MdcLoggable
import scala.collection.immutable.Nil
import code.api.UKOpenBanking.v2_0_0.APIMethods_UKOpenBanking_200._
import com.openbankproject.commons.util.{ApiVersionStatus, ScannedApiVersion}
import com.openbankproject.commons.util.{ApiVersion, ApiVersionStatus}
/*
@ -43,7 +43,7 @@ This file defines which endpoints from all the versions are available in v1
object OBP_UKOpenBanking_200 extends OBPRestHelper with MdcLoggable with ScannedApis{
override val apiVersion = ScannedApiVersion("open-banking", "UK", "v2.0")
override val apiVersion = ApiVersion.ukOpenBankingV20
val versionStatus = ApiVersionStatus.DRAFT.toString
val allEndpoints =

View File

@ -35,7 +35,7 @@ import code.api.OBPRestHelper
import code.api.util.APIUtil.{OBPEndpoint, ResourceDoc, getAllowedEndpoints}
import code.api.util.ScannedApis
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.{ApiVersionStatus, ScannedApiVersion}
import com.openbankproject.commons.util.{ApiVersion, ApiVersionStatus}
import scala.collection.mutable.ArrayBuffer
@ -47,7 +47,7 @@ This file defines which endpoints from all the versions are available in v1
*/
object OBP_UKOpenBanking_310 extends OBPRestHelper with MdcLoggable with ScannedApis {
//please modify these three parameter if it is not correct.
override val apiVersion = ScannedApiVersion("open-banking", "UK", "v3.1")
override val apiVersion = ApiVersion.ukOpenBankingV31
val versionStatus = ApiVersionStatus.DRAFT.toString
private[this] val endpoints =

View File

@ -143,6 +143,12 @@ object ApiVersion {
val berlinGroupV13 = ScannedApiVersion("berlin-group", "BG", "v1.3")
val mxofV100 = ScannedApiVersion("mxof", "MXOF", "v1.0.0")
val cnbv9 = ScannedApiVersion("CNBV9", "CNBV9", "v1.0.0")
val ukOpenBankingV20 = ScannedApiVersion("open-banking", "UK", "v2.0")
val ukOpenBankingV31 = ScannedApiVersion("open-banking", "UK", "v3.1")
val stetV14 = ScannedApiVersion("stet", "STET", "v1.4")
val cdsAuV100 = ScannedApiVersion("cds-au", "AU", "v1.0.0")
val bahrainObfV100 = ScannedApiVersion("BAHRAIN-OBF", "BAHRAIN-OBF", "v1.0.0")
val polishApiV2111 = ScannedApiVersion("polish-api", "PAPI", "v2.1.1.1")
/**
* the ApiPathZero value must be got by obp-api project, so here is a workaround, let obp-api project modify this value