mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 17:17:09 +00:00
Merge pull request #2177 from hongwei1/bugfix/RootWrongVersion
bugfix/fix '/obp/v5.0.0/root' to show correct API version
This commit is contained in:
commit
d09bb363ac
@ -131,7 +131,7 @@ object ResourceDocs300 extends OBPRestHelper with ResourceDocsAPIMethods with Md
|
||||
|
||||
object ResourceDocs510 extends OBPRestHelper with ResourceDocsAPIMethods with MdcLoggable {
|
||||
val version: ApiVersion = ApiVersion.v5_1_0
|
||||
val versionStatus = ApiVersionStatus.`BLEEDING-EDGE`.toString
|
||||
val versionStatus = ApiVersionStatus.BLEEDING_EDGE.toString
|
||||
val routes = List(
|
||||
ImplementationsResourceDocs.getResourceDocsObpV400,
|
||||
ImplementationsResourceDocs.getResourceDocsSwagger,
|
||||
|
||||
@ -45,7 +45,7 @@ object OBPAPIDynamicEndpoint extends OBPRestHelper with MdcLoggable with Version
|
||||
|
||||
val version : ApiVersion = ApiVersion.`dynamic-endpoint`
|
||||
|
||||
val versionStatus = ApiVersionStatus.`BLEEDING-EDGE`.toString
|
||||
val versionStatus = ApiVersionStatus.BLEEDING_EDGE.toString
|
||||
|
||||
// if old version ResourceDoc objects have the same name endpoint with new version, omit old version ResourceDoc.
|
||||
def allResourceDocs = collectResourceDocs(ImplementationsDynamicEndpoint.resourceDocs)
|
||||
|
||||
@ -45,7 +45,7 @@ object OBPAPIDynamicEntity extends OBPRestHelper with MdcLoggable with Versioned
|
||||
|
||||
val version : ApiVersion = ApiVersion.`dynamic-entity`
|
||||
|
||||
val versionStatus = ApiVersionStatus.`BLEEDING-EDGE`.toString
|
||||
val versionStatus = ApiVersionStatus.BLEEDING_EDGE.toString
|
||||
|
||||
// if old version ResourceDoc objects have the same name endpoint with new version, omit old version ResourceDoc.
|
||||
def allResourceDocs = collectResourceDocs(ImplementationsDynamicEntity.resourceDocs)
|
||||
|
||||
@ -2637,8 +2637,7 @@ trait APIMethods400 {
|
||||
|
||||
|
||||
|
||||
private def getApiInfoJSON() = {
|
||||
val (apiVersion, apiVersionStatus) = (implementedInApiVersion, OBPAPI4_0_0.versionStatus)
|
||||
private def getApiInfoJSON(apiVersion : ApiVersion, apiVersionStatus : String) = {
|
||||
val organisation = APIUtil.getPropsValue("hosted_by.organisation", "TESOBE")
|
||||
val email = APIUtil.getPropsValue("hosted_by.email", "contact@tesobe.com")
|
||||
val phone = APIUtil.getPropsValue("hosted_by.phone", "+49 (0)30 8145 3994")
|
||||
@ -2672,7 +2671,7 @@ trait APIMethods400 {
|
||||
|
||||
|
||||
staticResourceDocs += ResourceDoc(
|
||||
root,
|
||||
root(OBPAPI4_0_0.version, OBPAPI4_0_0.versionStatus),
|
||||
implementedInApiVersion,
|
||||
"root",
|
||||
"GET",
|
||||
@ -2690,10 +2689,10 @@ trait APIMethods400 {
|
||||
List(UnknownError, "no connector set"),
|
||||
apiTagApi :: apiTagNewStyle :: Nil)
|
||||
|
||||
lazy val root : OBPEndpoint = {
|
||||
def root (apiVersion : ApiVersion, apiVersionStatus: String): OBPEndpoint = {
|
||||
case (Nil | "root" :: Nil) JsonGet _ => {
|
||||
cc => Future {
|
||||
getApiInfoJSON() -> HttpCode.`200`(cc.callContext)
|
||||
getApiInfoJSON(apiVersion, apiVersionStatus) -> HttpCode.`200`(cc.callContext)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ object OBPAPI4_0_0 extends OBPRestHelper with APIMethods130 with APIMethods140 w
|
||||
private val endpoints: List[OBPEndpoint] = OBPAPI3_1_0.routes ++ endpointsOf4_0_0
|
||||
|
||||
// Filter the possible endpoints by the disabled / enabled Props settings and add them together
|
||||
val routes : List[OBPEndpoint] = Implementations4_0_0.root :: // For now we make this mandatory
|
||||
val routes : List[OBPEndpoint] = Implementations4_0_0.root(version, versionStatus) :: // For now we make this mandatory
|
||||
getAllowedEndpoints(endpoints, allResourceDocs)
|
||||
|
||||
// register v4.0.0 apis first, Make them available for use!
|
||||
|
||||
@ -81,7 +81,8 @@ object OBPAPI5_0_0 extends OBPRestHelper
|
||||
private val endpoints: List[OBPEndpoint] = OBPAPI4_0_0.routes ++ endpointsOf5_0_0
|
||||
|
||||
// Filter the possible endpoints by the disabled / enabled Props settings and add them together
|
||||
val routes : List[OBPEndpoint] = getAllowedEndpoints(endpoints, allResourceDocs)
|
||||
val routes : List[OBPEndpoint] = Implementations4_0_0.root(version, versionStatus) :: // For now we make this mandatory
|
||||
getAllowedEndpoints(endpoints, allResourceDocs)
|
||||
|
||||
// register v5.0.0 apis first, Make them available for use!
|
||||
registerRoutes(routes, allResourceDocs, apiPrefix, true)
|
||||
|
||||
@ -48,7 +48,7 @@ trait APIMethods510 {
|
||||
|
||||
|
||||
staticResourceDocs += ResourceDoc(
|
||||
root,
|
||||
root(OBPAPI5_1_0.version, OBPAPI5_1_0.versionStatus),
|
||||
implementedInApiVersion,
|
||||
"root",
|
||||
"GET",
|
||||
@ -66,10 +66,10 @@ trait APIMethods510 {
|
||||
List(UnknownError, "no connector set"),
|
||||
apiTagApi :: apiTagNewStyle :: Nil)
|
||||
|
||||
lazy val root : OBPEndpoint = {
|
||||
def root (apiVersion : ApiVersion, apiVersionStatus: String) : OBPEndpoint = {
|
||||
case (Nil | "root" :: Nil) JsonGet _ => {
|
||||
cc => Future {
|
||||
JSONFactory510.getApiInfoJSON(implementedInApiVersion) -> HttpCode.`200`(cc.callContext)
|
||||
JSONFactory510.getApiInfoJSON(apiVersion,apiVersionStatus) -> HttpCode.`200`(cc.callContext)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ import code.api.Constant
|
||||
import code.api.util.APIUtil
|
||||
import code.api.util.APIUtil.gitCommit
|
||||
import code.api.v4_0_0.{EnergySource400, HostedAt400, HostedBy400}
|
||||
import com.openbankproject.commons.util.ScannedApiVersion
|
||||
import com.openbankproject.commons.util.{ApiVersion, ScannedApiVersion}
|
||||
|
||||
|
||||
case class APIInfoJsonV510(
|
||||
@ -48,8 +48,7 @@ case class APIInfoJsonV510(
|
||||
)
|
||||
|
||||
object JSONFactory510 {
|
||||
def getApiInfoJSON(implementedInApiVersion: ScannedApiVersion) = {
|
||||
val (apiVersion, apiVersionStatus) = (implementedInApiVersion, OBPAPI5_1_0.versionStatus)
|
||||
def getApiInfoJSON(apiVersion : ApiVersion, apiVersionStatus: String) = {
|
||||
val organisation = APIUtil.getPropsValue("hosted_by.organisation", "TESOBE")
|
||||
val email = APIUtil.getPropsValue("hosted_by.email", "contact@tesobe.com")
|
||||
val phone = APIUtil.getPropsValue("hosted_by.phone", "+49 (0)30 8145 3994")
|
||||
|
||||
@ -66,7 +66,7 @@ object OBPAPI5_1_0 extends OBPRestHelper
|
||||
|
||||
val version : ApiVersion = ApiVersion.v5_1_0
|
||||
|
||||
val versionStatus = ApiVersionStatus.`BLEEDING-EDGE`.toString
|
||||
val versionStatus = ApiVersionStatus.BLEEDING_EDGE.toString
|
||||
|
||||
// Possible Endpoints from 5.1.0, exclude one endpoint use - method,exclude multiple endpoints use -- method,
|
||||
// e.g getEndpoints(Implementations5_0_0) -- List(Implementations5_0_0.genericEndpoint, Implementations5_0_0.root)
|
||||
@ -89,7 +89,8 @@ object OBPAPI5_1_0 extends OBPRestHelper
|
||||
private val endpoints: List[OBPEndpoint] = OBPAPI5_0_0.routes ++ endpointsOf5_1_0
|
||||
|
||||
// Filter the possible endpoints by the disabled / enabled Props settings and add them together
|
||||
val routes : List[OBPEndpoint] = getAllowedEndpoints(endpoints, allResourceDocs)
|
||||
val routes : List[OBPEndpoint] = Implementations5_1_0.root(version, versionStatus) :: // For now we make this mandatory
|
||||
getAllowedEndpoints(endpoints, allResourceDocs)
|
||||
|
||||
// register v5.1.0 apis first, Make them available for use!
|
||||
registerRoutes(routes, allResourceDocs, apiPrefix, true)
|
||||
|
||||
@ -31,7 +31,7 @@ object ApiShortVersions extends Enumeration {
|
||||
|
||||
object ApiVersionStatus extends Enumeration {
|
||||
type Status = Value
|
||||
val STABLE, `BLEEDING-EDGE`,DRAFT = Value
|
||||
val STABLE, BLEEDING_EDGE,DRAFT = Value
|
||||
}
|
||||
|
||||
sealed trait ApiVersion {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user