diff --git a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/AccountsApi.scala b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/AccountsApi.scala index 1a3afe7955..93488b0a9a 100644 --- a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/AccountsApi.scala +++ b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/AccountsApi.scala @@ -43,7 +43,7 @@ object APIMethods_AccountsApi extends RestHelper { Obtain detailed information on a single account """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : "", "meta" : " ", @@ -83,7 +83,7 @@ object APIMethods_AccountsApi extends RestHelper { Obtain detailed information on a transaction for a specific account """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : "", "meta" : " ", @@ -137,7 +137,7 @@ Some general notes that apply to all end points that retrieve transactions: - For transaction amounts it should be assumed that a negative value indicates a reduction of the available balance on the account while a positive value indicates an increase in the available balance on the account """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "transactions" : [ { @@ -271,7 +271,7 @@ Some general notes that apply to all end points that retrieve transactions: // Obtain a list of accounts // // """, -// emptyObjectJson, +// EmptyBody, // json.parse("""{ // "data" : { // "accounts" : [ { @@ -370,7 +370,7 @@ Some general notes that apply to all end points that retrieve transactions: // Obtain the balance for a single specified account // // """, -// emptyObjectJson, +// EmptyBody, // json.parse("""{ // "data" : { // "accountId" : "accountId", @@ -439,7 +439,7 @@ Some general notes that apply to all end points that retrieve transactions: Obtain balances for multiple, filtered accounts """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "balances" : [ { diff --git a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/BankingApi.scala b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/BankingApi.scala index d9154b5470..21a2776d5a 100644 --- a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/BankingApi.scala +++ b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/BankingApi.scala @@ -56,7 +56,7 @@ object APIMethods_BankingApi extends RestHelper { Obtain detailed information on a single account """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : "", "meta" : " ", @@ -96,7 +96,7 @@ object APIMethods_BankingApi extends RestHelper { Obtain detailed information on a single payee """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : "", "meta" : " ", @@ -136,7 +136,7 @@ object APIMethods_BankingApi extends RestHelper { Obtain detailed information on a single product offered openly to the market """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : "", "meta" : " ", @@ -176,7 +176,7 @@ object APIMethods_BankingApi extends RestHelper { Obtain detailed information on a transaction for a specific account """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : "", "meta" : " ", @@ -230,7 +230,7 @@ Some general notes that apply to all end points that retrieve transactions: - For transaction amounts it should be assumed that a negative value indicates a reduction of the available balance on the account while a positive value indicates an increase in the available balance on the account """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "transactions" : [ { @@ -364,7 +364,7 @@ Some general notes that apply to all end points that retrieve transactions: Obtain a list of accounts """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "accounts" : [ { @@ -429,7 +429,7 @@ Some general notes that apply to all end points that retrieve transactions: Obtain the balance for a single specified account """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "accountId" : "accountId", @@ -478,7 +478,7 @@ Some general notes that apply to all end points that retrieve transactions: Obtain balances for multiple, filtered accounts """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "balances" : [ { @@ -711,7 +711,7 @@ Some general notes that apply to all end points that retrieve transactions: Obtain direct debit authorisations for a specific account """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "directDebitAuthorisations" : [ { @@ -813,7 +813,7 @@ Some general notes that apply to all end points that retrieve transactions: Obtain direct debit authorisations for multiple, filtered accounts """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "directDebitAuthorisations" : [ { @@ -1022,7 +1022,7 @@ Some general notes that apply to all end points that retrieve transactions: Obtain a list of pre-registered payees """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "payees" : [ { @@ -1146,7 +1146,7 @@ It is expected that data consumers needing this data will call relatively freque In addition, the concept of effective date and time has also been included. This allows for a product to be marked for obsolescence, or introduction, from a certain time without the need for an update to show that a product has been changed. The inclusion of these dates also removes the need to represent deleted products in the payload. Products that are no long offered can be marked not effective for a few weeks before they are then removed from the product set as an option entirely. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "products" : [ { @@ -1280,7 +1280,7 @@ In addition, the concept of effective date and time has also been included. This Obtain scheduled, outgoing payments for a specific account """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "scheduledPayments" : [ { @@ -1898,7 +1898,7 @@ In addition, the concept of effective date and time has also been included. This Obtain scheduled payments for multiple, filtered accounts that are the source of funds for the payments """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "scheduledPayments" : [ { diff --git a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/CommonApi.scala b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/CommonApi.scala index 84c7594019..d89052e675 100644 --- a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/CommonApi.scala +++ b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/CommonApi.scala @@ -40,7 +40,7 @@ object APIMethods_CommonApi extends RestHelper { Obtain basic information on the customer that has authorised the current session """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "person" : { @@ -134,7 +134,7 @@ object APIMethods_CommonApi extends RestHelper { Obtain detailed information on the authorised customer within the current session. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "person" : "", @@ -182,7 +182,7 @@ object APIMethods_CommonApi extends RestHelper { Obtain a list of scheduled outages for the implementation """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "outages" : [ { @@ -246,7 +246,7 @@ object APIMethods_CommonApi extends RestHelper { Obtain a health check status for the implementation """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "updateTime" : "updateTime", diff --git a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/CustomerApi.scala b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/CustomerApi.scala index 76a338080c..1f829ef995 100644 --- a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/CustomerApi.scala +++ b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/CustomerApi.scala @@ -38,7 +38,7 @@ object APIMethods_CustomerApi extends RestHelper { Obtain basic information on the customer that has authorised the current session """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "person" : { @@ -132,7 +132,7 @@ object APIMethods_CustomerApi extends RestHelper { Obtain detailed information on the authorised customer within the current session. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "person" : "", diff --git a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/DirectDebitsApi.scala b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/DirectDebitsApi.scala index e371be6833..4f3a82cac8 100644 --- a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/DirectDebitsApi.scala +++ b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/DirectDebitsApi.scala @@ -39,7 +39,7 @@ object APIMethods_DirectDebitsApi extends RestHelper { Obtain direct debit authorisations for a specific account """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "directDebitAuthorisations" : [ { @@ -141,7 +141,7 @@ object APIMethods_DirectDebitsApi extends RestHelper { Obtain direct debit authorisations for multiple, filtered accounts """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "directDebitAuthorisations" : [ { diff --git a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/DiscoveryApi.scala b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/DiscoveryApi.scala index 4dde057270..ea53f9af55 100644 --- a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/DiscoveryApi.scala +++ b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/DiscoveryApi.scala @@ -38,7 +38,7 @@ object APIMethods_DiscoveryApi extends RestHelper { Obtain a list of scheduled outages for the implementation """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "outages" : [ { @@ -102,7 +102,7 @@ object APIMethods_DiscoveryApi extends RestHelper { Obtain a health check status for the implementation """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "updateTime" : "updateTime", diff --git a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/PayeesApi.scala b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/PayeesApi.scala index 9f9a7b359d..1e71822efe 100644 --- a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/PayeesApi.scala +++ b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/PayeesApi.scala @@ -38,7 +38,7 @@ object APIMethods_PayeesApi extends RestHelper { Obtain detailed information on a single payee """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : "", "meta" : " ", @@ -78,7 +78,7 @@ object APIMethods_PayeesApi extends RestHelper { Obtain a list of pre-registered payees """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "payees" : [ { diff --git a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/ProductsApi.scala b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/ProductsApi.scala index 6de7562e23..12cbfe032b 100644 --- a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/ProductsApi.scala +++ b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/ProductsApi.scala @@ -38,7 +38,7 @@ object APIMethods_ProductsApi extends RestHelper { Obtain detailed information on a single product offered openly to the market """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : "", "meta" : " ", @@ -120,7 +120,7 @@ It is expected that data consumers needing this data will call relatively freque In addition, the concept of effective date and time has also been included. This allows for a product to be marked for obsolescence, or introduction, from a certain time without the need for an update to show that a product has been changed. The inclusion of these dates also removes the need to represent deleted products in the payload. Products that are no long offered can be marked not effective for a few weeks before they are then removed from the product set as an option entirely. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "products" : [ { diff --git a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/ScheduledPaymentsApi.scala b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/ScheduledPaymentsApi.scala index 93cc125180..363dbb5b5f 100644 --- a/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/ScheduledPaymentsApi.scala +++ b/obp-api/src/main/scala/code/api/AUOpenBanking/v1_0_0/ScheduledPaymentsApi.scala @@ -39,7 +39,7 @@ object APIMethods_ScheduledPaymentsApi extends RestHelper { Obtain scheduled, outgoing payments for a specific account """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "scheduledPayments" : [ { @@ -657,7 +657,7 @@ object APIMethods_ScheduledPaymentsApi extends RestHelper { Obtain scheduled payments for multiple, filtered accounts that are the source of funds for the payments """, - emptyObjectJson, + EmptyBody, json.parse("""{ "data" : { "scheduledPayments" : [ { diff --git a/obp-api/src/main/scala/code/api/Polish/v2_1_1_1/AISApi.scala b/obp-api/src/main/scala/code/api/Polish/v2_1_1_1/AISApi.scala index a271e66773..1c4b6fa182 100644 --- a/obp-api/src/main/scala/code/api/Polish/v2_1_1_1/AISApi.scala +++ b/obp-api/src/main/scala/code/api/Polish/v2_1_1_1/AISApi.scala @@ -47,7 +47,7 @@ Removes consent""", json.parse("""{ "consentId" : "consentId" }"""), - emptyObjectJson, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("AIS") :: apiTagMockedData :: Nil ) diff --git a/obp-api/src/main/scala/code/api/Polish/v2_1_1_1/ASApi.scala b/obp-api/src/main/scala/code/api/Polish/v2_1_1_1/ASApi.scala index d15f1f9b17..40a4131f26 100644 --- a/obp-api/src/main/scala/code/api/Polish/v2_1_1_1/ASApi.scala +++ b/obp-api/src/main/scala/code/api/Polish/v2_1_1_1/ASApi.scala @@ -1842,7 +1842,7 @@ Requests OAuth2 authorization code based One-time authorization code issued by E "state" : "state", "client_id" : "client_id" }"""), - emptyObjectJson, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("AS") :: apiTagMockedData :: Nil ) diff --git a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/ResourceDocs140.scala b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/ResourceDocs140.scala index 78c8a39649..c53650ef7f 100644 --- a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/ResourceDocs140.scala +++ b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/ResourceDocs140.scala @@ -12,7 +12,6 @@ object ResourceDocs140 extends OBPRestHelper with ResourceDocsAPIMethods with Md ImplementationsResourceDocs.getResourceDocsObp, ImplementationsResourceDocs.getBankLevelDynamicResourceDocsObp, ImplementationsResourceDocs.getResourceDocsSwagger, -// ImplementationsResourceDocs.getStaticResourceDocsObp ) routes.foreach(route => { oauthServe(apiPrefix{route}) @@ -28,7 +27,6 @@ object ResourceDocs200 extends OBPRestHelper with ResourceDocsAPIMethods with Md ImplementationsResourceDocs.getResourceDocsObp, ImplementationsResourceDocs.getResourceDocsSwagger, ImplementationsResourceDocs.getBankLevelDynamicResourceDocsObp, -// ImplementationsResourceDocs.getStaticResourceDocsObp ) routes.foreach(route => { oauthServe(apiPrefix{route}) @@ -44,7 +42,6 @@ object ResourceDocs210 extends OBPRestHelper with ResourceDocsAPIMethods with Md ImplementationsResourceDocs.getResourceDocsObp, ImplementationsResourceDocs.getResourceDocsSwagger, ImplementationsResourceDocs.getBankLevelDynamicResourceDocsObp, -// ImplementationsResourceDocs.getStaticResourceDocsObp ) routes.foreach(route => { oauthServe(apiPrefix{route}) @@ -59,7 +56,6 @@ object ResourceDocs220 extends OBPRestHelper with ResourceDocsAPIMethods with Md ImplementationsResourceDocs.getResourceDocsObp, ImplementationsResourceDocs.getResourceDocsSwagger, ImplementationsResourceDocs.getBankLevelDynamicResourceDocsObp, -// ImplementationsResourceDocs.getStaticResourceDocsObp ) routes.foreach(route => { oauthServe(apiPrefix{route}) @@ -74,7 +70,6 @@ object ResourceDocs300 extends OBPRestHelper with ResourceDocsAPIMethods with Md ImplementationsResourceDocs.getResourceDocsObp, ImplementationsResourceDocs.getResourceDocsSwagger, ImplementationsResourceDocs.getBankLevelDynamicResourceDocsObp, -// ImplementationsResourceDocs.getStaticResourceDocsObp ) routes.foreach(route => { oauthServe(apiPrefix{route}) @@ -88,7 +83,6 @@ object ResourceDocs300 extends OBPRestHelper with ResourceDocsAPIMethods with Md ImplementationsResourceDocs.getResourceDocsObp, ImplementationsResourceDocs.getResourceDocsSwagger, ImplementationsResourceDocs.getBankLevelDynamicResourceDocsObp, -// ImplementationsResourceDocs.getStaticResourceDocsObp ) routes.foreach(route => { oauthServe(apiPrefix { @@ -104,7 +98,6 @@ object ResourceDocs300 extends OBPRestHelper with ResourceDocsAPIMethods with Md ImplementationsResourceDocs.getResourceDocsObpV400, ImplementationsResourceDocs.getResourceDocsSwagger, ImplementationsResourceDocs.getBankLevelDynamicResourceDocsObp, -// ImplementationsResourceDocs.getStaticResourceDocsObp ) routes.foreach(route => { oauthServe(apiPrefix { @@ -120,7 +113,6 @@ object ResourceDocs300 extends OBPRestHelper with ResourceDocsAPIMethods with Md ImplementationsResourceDocs.getResourceDocsObpV400, ImplementationsResourceDocs.getResourceDocsSwagger, ImplementationsResourceDocs.getBankLevelDynamicResourceDocsObp, -// ImplementationsResourceDocs.getStaticResourceDocsObp ) routes.foreach(route => { oauthServe(apiPrefix { diff --git a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/ResourceDocsAPIMethods.scala b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/ResourceDocsAPIMethods.scala index 529d7c91ae..fc2935f7d5 100644 --- a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/ResourceDocsAPIMethods.scala +++ b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/ResourceDocsAPIMethods.scala @@ -72,7 +72,6 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth val ImplementationsResourceDocs = new Object() { val localResourceDocs = ArrayBuffer[ResourceDoc]() - val emptyObjectJson = EmptyClassJson() val implementedInApiVersion = ApiVersion.v1_4_0 @@ -231,12 +230,10 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth partialFunctionNames: Option[List[String]], locale: Option[String], isVersion4OrHigher: Boolean - ): JValue = { + ) = { logger.debug(s"Generating OBP-getStaticResourceDocsObpCached requestedApiVersion is $requestedApiVersionString") val requestedApiVersion = ApiVersionUtils.valueOf(requestedApiVersionString) - - val resourceDocJson = resourceDocsToResourceDocJson(getResourceDocsList(requestedApiVersion), resourceDocTags, partialFunctionNames, isVersion4OrHigher, locale) - resourceDocJson.map(resourceDocsJsonToJsonResponse).head + resourceDocsToResourceDocJson(getResourceDocsList(requestedApiVersion), resourceDocTags, partialFunctionNames, isVersion4OrHigher, locale) } /** @@ -254,7 +251,7 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth locale: Option[String], contentParam: Option[ContentParam], isVersion4OrHigher: Boolean - ): JValue = { + ) = { logger.debug(s"Generating getAllResourceDocsObpCached-Docs requestedApiVersion is $requestedApiVersionString") val requestedApiVersion = ApiVersionUtils.valueOf(requestedApiVersionString) @@ -287,8 +284,8 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth val allDocs = staticDocs.map(_ ++ filteredDocs) - val resourceDocJson = resourceDocsToResourceDocJson(allDocs, resourceDocTags, partialFunctionNames, isVersion4OrHigher, locale) - resourceDocJson.map(resourceDocsJsonToJsonResponse).head + resourceDocsToResourceDocJson(allDocs, resourceDocTags, partialFunctionNames, isVersion4OrHigher, locale) + } private def getResourceDocsObpDynamicCached( @@ -297,7 +294,7 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth locale: Option[String], bankId: Option[String], isVersion4OrHigher: Boolean - ): JValue = { + ) = { val dynamicDocs = allDynamicResourceDocs .filter(rd => if (bankId.isDefined) rd.createdByBankId == bankId else true) .map(it => it.specifiedUrl match { @@ -324,8 +321,8 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth case None => dynamicDocs } - val resourceDocJson = resourceDocsToResourceDocJson(Some(filteredDocs), resourceDocTags, partialFunctionNames, isVersion4OrHigher, locale) - resourceDocJson.map(resourceDocsJsonToJsonResponse).head + resourceDocsToResourceDocJson(Some(filteredDocs), resourceDocTags, partialFunctionNames, isVersion4OrHigher, locale) + } @@ -347,29 +344,6 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth } } - val exampleResourceDoc = ResourceDoc( - dummy(implementedInApiVersion.toString, "DUMMY"), - implementedInApiVersion, - "testResourceDoc", - "GET", - "/dummy", - "Test Resource Doc.", - """I am only a test Resource Doc""", - emptyObjectJson, - emptyObjectJson, - UnknownError :: Nil, - List(apiTagDocumentation), - Some(List(canGetCustomersJson)) - ) - - - val exampleResourceDocsJson = JSONFactory1_4_0.createResourceDocsJson(List(exampleResourceDoc), false, None) - - val exampleResourceDocsJsonV400 = JSONFactory1_4_0.createResourceDocsJson(List(exampleResourceDoc), true, None) - - - - def getResourceDocsDescription(isBankLevelResourceDoc: Boolean) = { val endpointBankIdPath = if (isBankLevelResourceDoc) "/banks/BANK_ID" else "" @@ -432,8 +406,8 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth "/resource-docs/API_VERSION/obp", "Get Resource Docs.", getResourceDocsDescription(false), - emptyObjectJson, - exampleResourceDocsJson, + EmptyBody, + EmptyBody, UnknownError :: Nil, List(apiTagDocumentation, apiTagApi), Some(List(canReadResourceDoc)) @@ -447,7 +421,7 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth val (tags, partialFunctions, locale, contentParam, apiCollectionIdParam) = ResourceDocsAPIMethodsUtil.getParams() cc => implicit val ec = EndpointContext(Some(cc)) - val resourceDocs = getApiLevelResourceDocs(cc,requestedApiVersionString, tags, partialFunctions, locale, contentParam, apiCollectionIdParam,false, false) + val resourceDocs = getApiLevelResourceDocs(cc,requestedApiVersionString, tags, partialFunctions, locale, contentParam, apiCollectionIdParam,false) resourceDocs } } @@ -460,8 +434,8 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth "/resource-docs/API_VERSION/obp", "Get Resource Docs", getResourceDocsDescription(false), - emptyObjectJson, - exampleResourceDocsJsonV400, + EmptyBody, + EmptyBody, UnknownError :: Nil, List(apiTagDocumentation, apiTagApi), Some(List(canReadResourceDoc)) @@ -472,44 +446,11 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth val (tags, partialFunctions, locale, contentParam, apiCollectionIdParam) = ResourceDocsAPIMethodsUtil.getParams() cc => implicit val ec = EndpointContext(Some(cc)) - val resourceDocs = getApiLevelResourceDocs(cc,requestedApiVersionString, tags, partialFunctions, locale, contentParam, apiCollectionIdParam,true, false) + val resourceDocs = getApiLevelResourceDocs(cc,requestedApiVersionString, tags, partialFunctions, locale, contentParam, apiCollectionIdParam,true) resourceDocs } } -// localResourceDocs += ResourceDoc( -// getStaticResourceDocsObp, -// implementedInApiVersion, -// nameOf(getStaticResourceDocsObp), -// "GET", -// "/static-resource-docs/API_VERSION/obp", -// "Get Static Resource Docs", -// getResourceDocsDescription(false), -// emptyObjectJson, -// exampleResourceDocsJsonV400, -// UnknownError :: Nil, -// List(apiTagDocumentation, apiTagApi), -// Some(List(canReadStaticResourceDoc)) -// ) -// -// def getStaticResourceDocsObp : OBPEndpoint = { -// case "static-resource-docs" :: requestedApiVersionString :: "obp" :: Nil JsonGet _ => { -// val (tags, partialFunctions, locale, contentParam, apiCollectionIdParam) = ResourceDocsAPIMethodsUtil.getParams() -// cc => -// getApiLevelResourceDocs( -// cc,requestedApiVersionString, -// tags, -// partialFunctions, -// locale, -// Some(ContentParam.STATIC) ,//Note: here it set to default STATIC value. -// apiCollectionIdParam, -// true, -// true -// ) -// } -// } - - //API level just mean, this response will be forward to liftweb directly. private def getApiLevelResourceDocs( cc: CallContext, @@ -520,7 +461,6 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth contentParam: Option[ContentParam], apiCollectionIdParam: Option[String], isVersion4OrHigher: Boolean, - isStaticResource: Boolean, ) = { for { (u: Box[User], callContext: Option[CallContext]) <- resourceDocsRequireRole match { @@ -529,10 +469,7 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth } _ <- resourceDocsRequireRole match { case false => Future() - case true => // If set resource_docs_requires_role=true, we need check the the roles as well - if(isStaticResource) - NewStyle.function.hasAtLeastOneEntitlement(failMsg = UserHasMissingRoles + canReadStaticResourceDoc.toString)("", u.map(_.userId).getOrElse(""), ApiRole.canReadStaticResourceDoc :: Nil, cc.callContext) - else + case true => // If set resource_docs_requires_role=true, we need check the roles as well NewStyle.function.hasAtLeastOneEntitlement(failMsg = UserHasMissingRoles + canReadResourceDoc.toString)("", u.map(_.userId).getOrElse(""), ApiRole.canReadResourceDoc :: Nil, cc.callContext) } requestedApiVersion <- NewStyle.function.tryons(s"$InvalidApiVersionString $requestedApiVersionString", 400, callContext) {ApiVersionUtils.valueOf(requestedApiVersionString)} @@ -552,8 +489,8 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth locale, contentParam, apiCollectionIdParam, - Some(isVersion4OrHigher), - Some(isStaticResource)) + Some(isVersion4OrHigher) + ) json <- locale match { case _ if (apiCollectionIdParam.isDefined) => val operationIds = MappedApiCollectionEndpointsProvider.getApiCollectionEndpoints(apiCollectionIdParam.getOrElse("")).map(_.operationId).map(getObpFormatOperationId) @@ -569,7 +506,8 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth if (cacheValueFromRedis.isDefined) { Full(json.parse(cacheValueFromRedis.get)) } else { - val resourceDocJsonJValue = getResourceDocsObpDynamicCached(tags, partialFunctions, locale, None, isVersion4OrHigher) + val resourceDocJson = getResourceDocsObpDynamicCached(tags, partialFunctions, locale, None, false) + val resourceDocJsonJValue = resourceDocJson.map(resourceDocsJsonToJsonResponse).head val jsonString = json.compactRender(resourceDocJsonJValue) Caching.setDynamicResourceDocCache(cacheKey, jsonString) Full(resourceDocJsonJValue) @@ -585,7 +523,8 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth if (cacheValueFromRedis.isDefined) { Full(json.parse(cacheValueFromRedis.get)) } else { - val resourceDocJsonJValue = getStaticResourceDocsObpCached(requestedApiVersionString, tags, partialFunctions, locale, isVersion4OrHigher) + val resourceDocJson = getStaticResourceDocsObpCached(requestedApiVersionString, tags, partialFunctions, locale, isVersion4OrHigher) + val resourceDocJsonJValue = resourceDocJson.map(resourceDocsJsonToJsonResponse).head val jsonString = json.compactRender(resourceDocJsonJValue) Caching.setStaticResourceDocCache(cacheKey, jsonString) Full(resourceDocJsonJValue) @@ -600,7 +539,8 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth if (cacheValueFromRedis.isDefined) { Full(json.parse(cacheValueFromRedis.get)) } else { - val resourceDocJsonJValue = getAllResourceDocsObpCached(requestedApiVersionString, tags, partialFunctions, locale, contentParam, isVersion4OrHigher) + val resourceDocJson = getAllResourceDocsObpCached(requestedApiVersionString, tags, partialFunctions, locale, contentParam, isVersion4OrHigher) + val resourceDocJsonJValue = resourceDocJson.map(resourceDocsJsonToJsonResponse).head val jsonString = json.compactRender(resourceDocJsonJValue) Caching.setAllResourceDocCache(cacheKey, jsonString) Full(resourceDocJsonJValue) @@ -623,8 +563,8 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth "/banks/BANK_ID/resource-docs/API_VERSION/obp", "Get Bank Level Dynamic Resource Docs.", getResourceDocsDescription(true), - emptyObjectJson, - exampleResourceDocsJson, + EmptyBody, + EmptyBody, UnknownError :: Nil, List(apiTagDocumentation, apiTagApi), Some(List(canReadDynamicResourceDocsAtOneBank)) @@ -665,14 +605,14 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth locale, contentParam, apiCollectionIdParam, - None, None) json <- NewStyle.function.tryons(s"$UnknownError Can not create dynamic resource docs.", 400, callContext) { val cacheValueFromRedis = Caching.getDynamicResourceDocCache(cacheKey) if (cacheValueFromRedis.isDefined) { json.parse(cacheValueFromRedis.get) } else { - val resourceDocJsonJValue = getResourceDocsObpDynamicCached(tags, partialFunctions, locale, None, false) + val resourceDocJson = getResourceDocsObpDynamicCached(tags, partialFunctions, locale, None, false) + val resourceDocJsonJValue = resourceDocJson.map(resourceDocsJsonToJsonResponse).head val jsonString = json.compactRender(resourceDocJsonJValue) Caching.setDynamicResourceDocCache(cacheKey, jsonString) resourceDocJsonJValue @@ -715,8 +655,8 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth |${getObpApiRoot}/v3.1.0/resource-docs/v3.1.0/swagger?tags=Account,Bank,PSD2&functions=getBanks,bankById | """, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, UnknownError :: Nil, List(apiTagDocumentation, apiTagApi) ) @@ -726,7 +666,7 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth case "resource-docs" :: requestedApiVersionString :: "swagger" :: Nil JsonGet _ => { cc => { implicit val ec = EndpointContext(Some(cc)) - val (resourceDocTags, partialFunctions, _, _, _) = ResourceDocsAPIMethodsUtil.getParams() + val (resourceDocTags, partialFunctions, locale, contentParam, apiCollectionIdParam) = ResourceDocsAPIMethodsUtil.getParams() for { requestedApiVersion <- NewStyle.function.tryons(s"$InvalidApiVersionString Current Version is $requestedApiVersionString", 400, cc.callContext) { ApiVersionUtils.valueOf(requestedApiVersionString) @@ -734,62 +674,78 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth _ <- Helper.booleanToFuture(failMsg = s"$ApiVersionNotSupported Current Version is $requestedApiVersionString", cc=cc.callContext) { versionIsAllowed(requestedApiVersion) } + _ <- if (locale.isDefined) { + Helper.booleanToFuture(failMsg = s"$InvalidLocale Current Locale is ${locale.get}" intern(), cc = cc.callContext) { + APIUtil.obpLocaleValidation(locale.get) == SILENCE_IS_GOLDEN + } + } else { + Future.successful(true) + } + + isVersion4OrHigher = true + resourceDocsJsonFiltered <- locale match { + case _ if (apiCollectionIdParam.isDefined) => + val operationIds = MappedApiCollectionEndpointsProvider.getApiCollectionEndpoints(apiCollectionIdParam.getOrElse("")).map(_.operationId).map(getObpFormatOperationId) + val resourceDocs = ResourceDoc.getResourceDocs(operationIds) + val resourceDocsJson = JSONFactory1_4_0.createResourceDocsJson(resourceDocs, isVersion4OrHigher, locale) + Future(resourceDocsJson.resource_docs) + case _ => + contentParam match { + case Some(DYNAMIC) => + Future(getResourceDocsObpDynamicCached(resourceDocTags, partialFunctions, locale, None, isVersion4OrHigher).head.resource_docs) + case Some(STATIC) => { + Future(getStaticResourceDocsObpCached(requestedApiVersionString, resourceDocTags, partialFunctions, locale, isVersion4OrHigher).head.resource_docs) + } + case _ => { + Future(getAllResourceDocsObpCached(requestedApiVersionString, resourceDocTags, partialFunctions, locale, contentParam, isVersion4OrHigher).head.resource_docs) + } + } + } + cacheKey = APIUtil.createResourceDocCacheKey( None, requestedApiVersionString, resourceDocTags, partialFunctions, - None, - None, - None, - None, - None) - staticJson <- NewStyle.function.tryons(s"$UnknownError Can not convert internal swagger file.", 400, cc.callContext) { + locale, + contentParam, + apiCollectionIdParam, + None + ) + swaggerJValue <- NewStyle.function.tryons(s"$UnknownError Can not convert internal swagger file.", 400, cc.callContext) { val cacheValueFromRedis = Caching.getStaticSwaggerDocCache(cacheKey) - + val dynamicDocs: JValue = if (cacheValueFromRedis.isDefined) { json.parse(cacheValueFromRedis.get) } else { - val resourceDocJsonJValue = getResourceDocsSwaggerCached(requestedApiVersionString, resourceDocTags, partialFunctions) - val jsonString = json.compactRender(resourceDocJsonJValue) - Caching.setStaticSwaggerDocCache(cacheKey, jsonString) - resourceDocJsonJValue + convertResourceDocsToSwaggerJvalueAndSetCache(cacheKey, requestedApiVersionString, resourceDocsJsonFiltered) } dynamicDocs } - dynamicJson <- Future(getResourceDocsSwagger(requestedApiVersionString, resourceDocTags, partialFunctions).getOrElse(JNull)) } yield { - (staticJson.merge(dynamicJson), HttpCode.`200`(cc.callContext)) + (swaggerJValue, HttpCode.`200`(cc.callContext)) } } } } - private def getResourceDocsSwaggerCached( - requestedApiVersionString: String, - resourceDocTags: Option[List[ResourceDocTag]], - partialFunctionNames: Option[List[String]] - ) : JValue = { - logger.debug(s"Generating Swagger-getResourceDocsSwaggerCached requestedApiVersion is $requestedApiVersionString") - - val a = Box.tryo(ApiVersionUtils.valueOf(requestedApiVersionString)) match { - case Full(requestedApiVersion) => - val resourceDocs: Option[List[ResourceDoc]] = getResourceDocsList(requestedApiVersion) - getResourceDocsSwagger(requestedApiVersionString, resourceDocTags, partialFunctionNames, resourceDocs) - case e => - (e ?~! InvalidApiVersionString).asInstanceOf[Box[JValue]] - } - - a.head + private def convertResourceDocsToSwaggerJvalueAndSetCache(cacheKey: String, requestedApiVersionString: String, resourceDocsJson: List[JSONFactory1_4_0.ResourceDocJson]) : JValue = { + logger.debug(s"Generating Swagger-getResourceDocsSwaggerAndSetCache requestedApiVersion is $requestedApiVersionString") + val swaggerDocJsonJValue = getResourceDocsSwagger(requestedApiVersionString, resourceDocsJson).head + + val jsonString = json.compactRender(swaggerDocJsonJValue) + Caching.setStaticSwaggerDocCache(cacheKey, jsonString) + + swaggerDocJsonJValue } // if not supply resourceDocs parameter, just get dynamic ResourceDocs swagger - private def getResourceDocsSwagger(requestedApiVersionString : String, - resourceDocTags: Option[List[ResourceDocTag]], - partialFunctionNames: Option[List[String]], - resourceDocs: Option[List[ResourceDoc]] = None) : Box[JValue] = { + private def getResourceDocsSwagger( + requestedApiVersionString : String, + resourceDocsJson: List[JSONFactory1_4_0.ResourceDocJson] + ) : Box[JValue] = { // build swagger and remove not used definitions def buildSwagger(resourceDoc: SwaggerJSONFactory.SwaggerResourceDoc, definitions: json.JValue) = { @@ -820,42 +776,39 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth jValue merge usedDefinitions } - def resourceDocsToJValue(resourceDocs: Option[List[ResourceDoc]]): Box[JValue] = { + def resourceDocsToJValue(resourceDocs: List[JSONFactory1_4_0.ResourceDocJson]): Box[JValue] = { for { requestedApiVersion <- Box.tryo(ApiVersionUtils.valueOf(requestedApiVersionString)) ?~! InvalidApiVersionString _ <- booleanToBox(versionIsAllowed(requestedApiVersion), ApiVersionNotSupported) - rd <- resourceDocs } yield { // Filter - val rdFiltered = ResourceDocsAPIMethodsUtil - .filterResourceDocs(rd, resourceDocTags, partialFunctionNames) + val rdFiltered = resourceDocsJson .map { /** * dynamic endpoints related structure is not STABLE structure, no need be parsed to a static structure. * So here filter out them. */ - case doc if (doc.partialFunctionName == nameOf(APIMethods400.Implementations4_0_0.createDynamicEndpoint) || - doc.partialFunctionName == nameOf(APIMethods400.Implementations4_0_0.createBankLevelDynamicEndpoint) ) => - doc.copy(exampleRequestBody = ExampleValue.dynamicEndpointRequestBodyEmptyExample, - successResponseBody = ExampleValue.dynamicEndpointResponseBodyEmptyExample + case doc if (doc.operation_id == buildOperationId(APIMethods400.Implementations4_0_0.implementedInApiVersion, nameOf(APIMethods400.Implementations4_0_0.createDynamicEndpoint)) || + doc.operation_id == buildOperationId(APIMethods400.Implementations4_0_0.implementedInApiVersion, nameOf(APIMethods400.Implementations4_0_0.createBankLevelDynamicEndpoint))) => + doc.copy(example_request_body = ExampleValue.dynamicEndpointRequestBodyEmptyExample, + success_response_body = ExampleValue.dynamicEndpointResponseBodyEmptyExample ) - case doc if (doc.partialFunctionName == nameOf(APIMethods400.Implementations4_0_0.createEndpointMapping) || - doc.partialFunctionName == nameOf(APIMethods400.Implementations4_0_0.createBankLevelEndpointMapping) ) => + case doc if (doc.operation_id == buildOperationId(APIMethods400.Implementations4_0_0.implementedInApiVersion, nameOf(APIMethods400.Implementations4_0_0.createEndpointMapping)) || + doc.operation_id == buildOperationId(APIMethods400.Implementations4_0_0.implementedInApiVersion, nameOf(APIMethods400.Implementations4_0_0.createBankLevelEndpointMapping))) => doc.copy( - exampleRequestBody = endpointMappingRequestBodyExample, - successResponseBody = endpointMappingRequestBodyExample + example_request_body = endpointMappingRequestBodyExample, + success_response_body = endpointMappingRequestBodyExample ) - case doc if ( doc.partialFunctionName == nameOf(APIMethods400.Implementations4_0_0.getDynamicEndpoint) || - doc.partialFunctionName == nameOf(APIMethods400.Implementations4_0_0.getBankLevelDynamicEndpoint)) => - doc.copy(successResponseBody = ExampleValue.dynamicEndpointResponseBodyEmptyExample) - - case doc if (doc.partialFunctionName == nameOf(APIMethods400.Implementations4_0_0.getDynamicEndpoints) || - doc.partialFunctionName == nameOf(APIMethods400.Implementations4_0_0.getMyDynamicEndpoints) || - doc.partialFunctionName == nameOf(APIMethods400.Implementations4_0_0.getBankLevelDynamicEndpoints) - )=> - doc.copy(successResponseBody = ListResult( + case doc if ( doc.operation_id == buildOperationId(APIMethods400.Implementations4_0_0.implementedInApiVersion, nameOf(APIMethods400.Implementations4_0_0.getDynamicEndpoint)) || + doc.operation_id == buildOperationId(APIMethods400.Implementations4_0_0.implementedInApiVersion, nameOf(APIMethods400.Implementations4_0_0.getBankLevelDynamicEndpoint))) => + doc.copy(success_response_body = ExampleValue.dynamicEndpointResponseBodyEmptyExample) + + case doc if (doc.operation_id == buildOperationId(APIMethods400.Implementations4_0_0.implementedInApiVersion, nameOf(APIMethods400.Implementations4_0_0.getDynamicEndpoints)) || + doc.operation_id == buildOperationId(APIMethods400.Implementations4_0_0.implementedInApiVersion, nameOf(APIMethods400.Implementations4_0_0.getMyDynamicEndpoints)) || + doc.operation_id == buildOperationId(APIMethods400.Implementations4_0_0.implementedInApiVersion, nameOf(APIMethods400.Implementations4_0_0.getBankLevelDynamicEndpoints)))=> + doc.copy(success_response_body = ListResult( "dynamic_endpoints", List(ExampleValue.dynamicEndpointResponseBodyEmptyExample) )) @@ -873,68 +826,7 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth } } - resourceDocs match { - case docs @Some(_) => resourceDocsToJValue(docs) - case _ => - val dynamicDocs = allDynamicResourceDocs - resourceDocsToJValue(Some(dynamicDocs)) - } - } - - if (Props.devMode) { - localResourceDocs += ResourceDoc( - dummy(implementedInApiVersion.vDottedApiVersion, "DUMMY"), - implementedInApiVersion, - "testResourceDoc", - "GET", - "/dummy", - "Test Resource Doc.", - """ - |I am only a test Resource Doc - | - |#This should be H1 - | - |##This should be H2 - | - |###This should be H3 - | - |####This should be H4 - | - |Here is a list with two items: - | - |* One - |* Two - | - |There are underscores by them selves _ - | - |There are _underscores_ around a word - | - |There are underscores_in_words - | - |There are 'underscores_in_words_inside_quotes' - | - |There are (underscores_in_words_in_brackets) - | - |_etc_...""", - emptyObjectJson, - emptyObjectJson, - UnknownError :: Nil, - List(apiTagDocumentation)) - } - - - - def dummy(apiVersion : String, apiVersionStatus: String) : OBPEndpoint = { - case "dummy" :: Nil JsonGet req => { - cc => - val apiDetails: JValue = { - val hostedBy = new HostedBy("Dummy Org", "contact@example.com", "12345", "http://www.example.com") - val apiInfoJSON = new APIInfoJSON(apiVersion, apiVersionStatus, gitCommit, "dummy-connector", hostedBy) - Extraction.decompose(apiInfoJSON) - } - - Full(successJsonResponse(apiDetails, 200)) - } + resourceDocsToJValue(resourceDocsJson) } } diff --git a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala index fa11b74262..42f0fb80ed 100644 --- a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala +++ b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerDefinitionsJSON.scala @@ -3644,6 +3644,21 @@ object SwaggerDefinitionsJSON { views_available = List(viewJsonV300), account_routings = List(accountRoutingJsonV121) ) + + val accountAttributeJson = AccountAttributeJson( + name = "OVERDRAFT_START_DATE", + `type` = "DATE_WITH_DAY", + value = "2012-04-23", + product_instance_code = Some("LKJL98769F"), + ) + val accountAttributeResponseJson = AccountAttributeResponseJson( + product_code = productCodeExample.value, + account_attribute_id = "613c83ea-80f9-4560-8404-b9cd4ec42a7f", + name = "OVERDRAFT_START_DATE", + `type` = "DATE_WITH_DAY", + value = "2012-04-23", + product_instance_code = Some("LKJL98769F"), + ) val moderatedCoreAccountJsonV300 = ModeratedCoreAccountJsonV300( id = accountIdExample.value, @@ -3654,7 +3669,8 @@ object SwaggerDefinitionsJSON { `type`= typeExample.value, balance = amountOfMoneyJsonV121, account_routings = List(accountRoutingJsonV121), - account_rules = List(accountRuleJsonV300) + account_rules = List(accountRuleJsonV300), + account_attributes= Some(List(accountAttributeResponseJson)) ) val moderatedCoreAccountsJsonV300 = ModeratedCoreAccountsJsonV300(List(moderatedCoreAccountJsonV300)) @@ -4063,22 +4079,7 @@ object SwaggerDefinitionsJSON { val atmAttributesResponseJsonV510 = AtmAttributesResponseJsonV510( List(atmAttributeResponseJsonV510) ) - - val accountAttributeJson = AccountAttributeJson( - name = "OVERDRAFT_START_DATE", - `type` = "DATE_WITH_DAY", - value = "2012-04-23", - product_instance_code = Some("LKJL98769F"), - ) - val accountAttributeResponseJson = AccountAttributeResponseJson( - product_code = productCodeExample.value, - account_attribute_id = "613c83ea-80f9-4560-8404-b9cd4ec42a7f", - name = "OVERDRAFT_START_DATE", - `type` = "DATE_WITH_DAY", - value = "2012-04-23", - product_instance_code = Some("LKJL98769F"), - ) - + val moderatedAccountJSON310 = ModeratedAccountJSON310( id = "5995d6a2-01b3-423c-a173-5481df49bdaf", label = "NoneLabel", @@ -5194,14 +5195,26 @@ object SwaggerDefinitionsJSON { consent_request_id = consentRequestIdExample.value, payload = json.parse(vrpConsentRequestPayloadExample.value), consumer_id = consumerIdExample.value - ) + ) + + val helperInfoJson = HelperInfoJson( + counterparty_id = List(counterpartyIdExample.value) + ) + + val consentAccountAccessJson= ConsentAccountAccessJson( + bank_id = bankIdExample.value, + account_id = accountIdExample.value, + view_id = viewIdExample.value, + helper_info = helperInfoJson + ) val consentJsonV500 = ConsentJsonV500( consent_id = "9d429899-24f5-42c8-8565-943ffa6a7945", jwt = "eyJhbGciOiJIUzI1NiJ9.eyJlbnRpdGxlbWVudHMiOltdLCJjcmVhdGVkQnlVc2VySWQiOiJhYjY1MzlhOS1iMTA1LTQ0ODktYTg4My0wYWQ4ZDZjNjE2NTciLCJzdWIiOiIyMWUxYzhjYy1mOTE4LTRlYWMtYjhlMy01ZTVlZWM2YjNiNGIiLCJhdWQiOiJlanpuazUwNWQxMzJyeW9tbmhieDFxbXRvaHVyYnNiYjBraWphanNrIiwibmJmIjoxNTUzNTU0ODk5LCJpc3MiOiJodHRwczpcL1wvd3d3Lm9wZW5iYW5rcHJvamVjdC5jb20iLCJleHAiOjE1NTM1NTg0OTksImlhdCI6MTU1MzU1NDg5OSwianRpIjoiMDlmODhkNWYtZWNlNi00Mzk4LThlOTktNjYxMWZhMWNkYmQ1Iiwidmlld3MiOlt7ImFjY291bnRfaWQiOiJtYXJrb19wcml2aXRlXzAxIiwiYmFua19pZCI6ImdoLjI5LnVrLngiLCJ2aWV3X2lkIjoib3duZXIifSx7ImFjY291bnRfaWQiOiJtYXJrb19wcml2aXRlXzAyIiwiYmFua19pZCI6ImdoLjI5LnVrLngiLCJ2aWV3X2lkIjoib3duZXIifV19.8cc7cBEf2NyQvJoukBCmDLT7LXYcuzTcSYLqSpbxLp4", status = ConsentStatus.INITIATED.toString, - consent_request_id = Some(consentRequestIdExample.value) - ) + consent_request_id = Some(consentRequestIdExample.value), + account_access= Some(consentAccountAccessJson) + ) val postConsentRequestJsonV500 = PostConsentRequestJsonV500( everything = false, diff --git a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerJSONFactory.scala b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerJSONFactory.scala index 6a644af249..8235228fed 100644 --- a/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerJSONFactory.scala +++ b/obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerJSONFactory.scala @@ -24,6 +24,7 @@ import code.api.UKOpenBanking.v2_0_0.OBP_UKOpenBanking_200 import code.api.UKOpenBanking.v3_1_0.OBP_UKOpenBanking_310 import code.api.berlin.group.v1.OBP_BERLIN_GROUP_1 import code.api.berlin.group.v1_3.{OBP_BERLIN_GROUP_1_3, OBP_BERLIN_GROUP_1_3_Alias} +import code.api.v1_4_0.JSONFactory1_4_0 import com.openbankproject.commons.model.JsonFieldReName import net.liftweb.util.StringHelpers @@ -140,14 +141,15 @@ object SwaggerJSONFactory extends MdcLoggable { def apply(jObject:JObject) = JObjectSchemaJson(jObject) - def getRequestBodySchema(rd: ResourceDoc): Option[ResponseObjectSchemaJson] = - getSchema(rd.exampleRequestBody) + def getRequestBodySchema(value: Any): Option[ResponseObjectSchemaJson] = + getSchema(value) - def getResponseBodySchema(rd: ResourceDoc): Option[ResponseObjectSchemaJson] = - getSchema(rd.successResponseBody) + def getResponseBodySchema(value: Any): Option[ResponseObjectSchemaJson] = + getSchema(value) private def getSchema(value: Any): Option[ResponseObjectSchemaJson] = { value match { + case JNothing => None case EmptyBody => None case example: PrimaryDataBody[_] => Some(ResponseObjectSchemaJson(example)) case example: JObject => Some(JObjectSchemaJson(example)) @@ -259,7 +261,7 @@ object SwaggerJSONFactory extends MdcLoggable { * @param requestedApiVersion eg: 2_2_0 * @return */ - def createSwaggerResourceDoc(resourceDocList: List[ResourceDoc], requestedApiVersion: ApiVersion): SwaggerResourceDoc = { + def createSwaggerResourceDoc(resourceDocList: List[JSONFactory1_4_0.ResourceDocJson], requestedApiVersion: ApiVersion): SwaggerResourceDoc = { //reference to referenceObject: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#referenceObject //according to the apiFunction name, prepare the reference @@ -323,7 +325,7 @@ object SwaggerJSONFactory extends MdcLoggable { // "400": { // "description": "Error", // "schema": {"$ref": "#/definitions/Error" - val paths: ListMap[String, Map[String, OperationObjectJson]] = resourceDocList.groupBy(x => x.specifiedUrl.getOrElse(x.requestUrl)).toSeq.sortBy(x => x._1).map { mrd => + val paths: ListMap[String, Map[String, OperationObjectJson]] = resourceDocList.groupBy(x => x.specified_url).toSeq.sortBy(x => x._1).map { mrd => //`/banks/BANK_ID` --> `/obp/v3.0.0/banks/BANK_ID` val pathAddedObpandVersion = mrd._1 @@ -496,20 +498,21 @@ object SwaggerJSONFactory extends MdcLoggable { pathParameters = OperationParameterPathJson(name="API_VERSION", description="eg:v2.2.0, v3.0.0") :: pathParameters val operationObjects: Map[String, OperationObjectJson] = mrd._2.map(rd => - (rd.requestVerb.toLowerCase, + (rd.request_verb.toLowerCase, OperationObjectJson( - tags = rd.tags.map(_.tag), + tags = rd.tags, summary = rd.summary, description = PegdownOptions.convertPegdownToHtmlTweaked(rd.description.stripMargin).replaceAll("\n", ""), - operationId = s"${rd.partialFunctionName}", + operationId = s"${rd.operation_id}", parameters ={ - val description = rd.exampleRequestBody match { + val description = rd.example_request_body match { + case JNothing => "" case EmptyBody => "" case example: PrimaryDataBody[_] => s"${example.swaggerDataTypeName} type value." case s:scala.Product => s"${s.getClass.getSimpleName} object that needs to be added." case _ => "NotSupportedYet type that needs to be added." } - ResponseObjectSchemaJson.getRequestBodySchema(rd) match { + ResponseObjectSchemaJson.getRequestBodySchema(rd.example_request_body) match { case Some(schema) => OperationParameterBodyJson( description = description, @@ -518,15 +521,15 @@ object SwaggerJSONFactory extends MdcLoggable { } }, responses = { - val successKey = rd.requestVerb.toLowerCase match { + val successKey = rd.request_verb.toLowerCase match { case "post" => "201" case "delete" => "204" case _ => "200" } Map( - successKey -> ResponseObjectJson(Some("Success"), ResponseObjectSchemaJson.getResponseBodySchema(rd)), - "400"-> ResponseObjectJson(Some("Error"), Some(ResponseObjectSchemaJson(s"#/definitions/Error${getFieldNameByValue(rd.errorResponseBodies.head)}"))) + successKey -> ResponseObjectJson(Some("Success"), ResponseObjectSchemaJson.getResponseBodySchema(rd.success_response_body)), + "400"-> ResponseObjectJson(Some("Error"), Some(ResponseObjectSchemaJson(s"#/definitions/Error${getFieldNameByValue(rd.error_response_bodies.head)}"))) ) } @@ -929,7 +932,7 @@ object SwaggerJSONFactory extends MdcLoggable { * } ... */ // link ->https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#definitionsObject - def loadDefinitions(resourceDocList: List[ResourceDoc], allSwaggerDefinitionCaseClasses: Seq[AnyRef]): liftweb.json.JValue = { + def loadDefinitions(resourceDocList: List[JSONFactory1_4_0.ResourceDocJson], allSwaggerDefinitionCaseClasses: Seq[AnyRef]): liftweb.json.JValue = { // filter function: not null and not type of EnumValue, PrimaryDataBody, JObject, JArray. val predicate: Any => Boolean = { @@ -938,8 +941,8 @@ object SwaggerJSONFactory extends MdcLoggable { } val docEntityExamples: List[AnyRef] = (List(notSupportedYet)::: - resourceDocList.map(_.exampleRequestBody.asInstanceOf[AnyRef]) ::: - resourceDocList.map(_.successResponseBody.asInstanceOf[AnyRef]) + resourceDocList.map(_.example_request_body.asInstanceOf[AnyRef]) ::: + resourceDocList.map(_.success_response_body.asInstanceOf[AnyRef]) ).filter(predicate) val allDocExamples = getAllEntities(docEntityExamples) @@ -957,7 +960,7 @@ object SwaggerJSONFactory extends MdcLoggable { .filter(predicate) .map(translateEntity) - val errorMessages: Set[AnyRef] = resourceDocList.flatMap(_.errorResponseBodies).toSet + val errorMessages: Set[AnyRef] = resourceDocList.flatMap(_.error_response_bodies).toSet val errorDefinitions = ErrorMessages.allFields .filterNot(null ==) diff --git a/obp-api/src/main/scala/code/api/STET/v1_4/AISPApi.scala b/obp-api/src/main/scala/code/api/STET/v1_4/AISPApi.scala index 6f4aa9f692..b6f624b275 100644 --- a/obp-api/src/main/scala/code/api/STET/v1_4/AISPApi.scala +++ b/obp-api/src/main/scala/code/api/STET/v1_4/AISPApi.scala @@ -74,7 +74,7 @@ The ASPSP answers by providing a list of balances on this account. """, - emptyObjectJson, + EmptyBody, json.parse("""{ | "balances": [ | { @@ -147,7 +147,7 @@ This call returns all payment accounts that are relevant the PSU on behalf of wh The TPP sends a request to the ASPSP for retrieving the list of the PSU payment accounts. The ASPSP computes the relevant PSU accounts and builds the answer as an accounts list. The result may be subject to pagination in order to avoid an excessive result set. Each payment account will be provided with its characteristics. """, - emptyObjectJson, + EmptyBody, json.parse("""{ | "accounts": [ | { @@ -246,7 +246,7 @@ The result may be subject to pagination (i.e. retrieving a partial result in cas The AISP requests the ASPSP on one of the PSU's accounts. It may specify some selection criteria. The ASPSP answers by a set of transactions that matches the query. The result may be subject to pagination in order to avoid an excessive result set. """, - emptyObjectJson, + EmptyBody, json.parse("""{ | "transactions": [ | { @@ -356,7 +356,7 @@ The PSU specifies to the AISP which of his/her accounts will be accessible and w "trustedBeneficiaries" : true, "psuIdentity" : true }"""), - emptyObjectJson, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("AISP") :: apiTagMockedData :: Nil ) @@ -397,8 +397,8 @@ This call returns the identity of the PSU (end-user). The AISP asks for the identity of the PSU. The ASPSP answers with the identity, i.e. first and last names of the end-user. """, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("AISP") :: apiTagMockedData :: Nil ) @@ -439,8 +439,8 @@ This call returns all trusted beneficiaries that have been set by the PSU. Those The AISP asks for the trusted beneficiaries list. The ASPSP answers with a list of beneficiary details structure. """, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("AISP") :: apiTagMockedData :: Nil ) diff --git a/obp-api/src/main/scala/code/api/STET/v1_4/CBPIIApi.scala b/obp-api/src/main/scala/code/api/STET/v1_4/CBPIIApi.scala index 1ab969e8d6..bd249bbc19 100644 --- a/obp-api/src/main/scala/code/api/STET/v1_4/CBPIIApi.scala +++ b/obp-api/src/main/scala/code/api/STET/v1_4/CBPIIApi.scala @@ -60,7 +60,7 @@ The CBPII requests the ASPSP for a payment coverage check against either a bank "iban" : "YY13RDHN98392489481620896668799742" } }"""), - emptyObjectJson, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("CBPII") :: apiTagMockedData :: Nil ) diff --git a/obp-api/src/main/scala/code/api/STET/v1_4/PISPApi.scala b/obp-api/src/main/scala/code/api/STET/v1_4/PISPApi.scala index d60d1f9213..1a3b504bc1 100644 --- a/obp-api/src/main/scala/code/api/STET/v1_4/PISPApi.scala +++ b/obp-api/src/main/scala/code/api/STET/v1_4/PISPApi.scala @@ -64,7 +64,7 @@ In REDIRECT and DECOUPLED approach, this confirmation is not a prerequisite to t json.parse("""{ "psuAuthenticationFactor" : "JJKJKJ788GKJKJBK" }"""), - emptyObjectJson, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("PISP") :: apiTagMockedData :: Nil ) @@ -278,8 +278,8 @@ The ASPSP returns the previously posted Payment/Transfer Request which is enrich The status information must be available during at least 30 calendar days after the posting of the Payment Request. However, the ASPSP may increase this availability duration, based on its own rules. """, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("PISP") :: apiTagMockedData :: Nil ) @@ -521,7 +521,7 @@ When the chosen authentication approach within the ASPSP answers is set to "EMBE "unsuccessfulReportUrl" : "http://myPisp/PaymentFailure" } }"""), - emptyObjectJson, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("PISP") :: apiTagMockedData :: Nil ) diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v2_0_0/APIMethods_UKOpenBanking_200.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v2_0_0/APIMethods_UKOpenBanking_200.scala index 3da4616fb9..9593a3c554 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v2_0_0/APIMethods_UKOpenBanking_200.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v2_0_0/APIMethods_UKOpenBanking_200.scala @@ -43,7 +43,7 @@ object APIMethods_UKOpenBanking_200 extends RestHelper{ | |This call is work in progress - Experimental! |""", - emptyObjectJson, + EmptyBody, SwaggerDefinitionsJSON.accountsJsonUKOpenBanking_v200, List(ErrorMessages.UserNotLoggedIn,ErrorMessages.UnknownError), List(apiTagUKOpenBanking, apiTagAccount, apiTagPrivateData)) @@ -77,7 +77,7 @@ object APIMethods_UKOpenBanking_200 extends RestHelper{ | |This call is work in progress - Experimental! |""", - emptyObjectJson, + EmptyBody, SwaggerDefinitionsJSON.transactionsJsonUKV200, List(UserNotLoggedIn,UnknownError), List(apiTagUKOpenBanking, apiTagTransaction, apiTagPrivateData, apiTagPsd2)) @@ -127,7 +127,7 @@ object APIMethods_UKOpenBanking_200 extends RestHelper{ | |This call is work in progress - Experimental! |""", - emptyObjectJson, + EmptyBody, SwaggerDefinitionsJSON.accountsJsonUKOpenBanking_v200, List(ErrorMessages.UserNotLoggedIn,ErrorMessages.UnknownError), List(apiTagUKOpenBanking, apiTagAccount, apiTagPrivateData)) @@ -165,7 +165,7 @@ object APIMethods_UKOpenBanking_200 extends RestHelper{ | |This call is work in progress - Experimental! |""", - emptyObjectJson, + EmptyBody, SwaggerDefinitionsJSON.accountBalancesUKV200, List(ErrorMessages.UserNotLoggedIn,ErrorMessages.UnknownError), List(apiTagUKOpenBanking, apiTagAccount, apiTagPrivateData)) @@ -210,7 +210,7 @@ object APIMethods_UKOpenBanking_200 extends RestHelper{ | |This call is work in progress - Experimental! |""", - emptyObjectJson, + EmptyBody, SwaggerDefinitionsJSON.accountBalancesUKV200, List(ErrorMessages.UserNotLoggedIn,ErrorMessages.UnknownError), List(apiTagUKOpenBanking, apiTagAccount, apiTagPrivateData)) diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountAccessApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountAccessApi.scala index 186eb24e0a..1b99efeb1b 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountAccessApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountAccessApi.scala @@ -146,8 +146,8 @@ object APIMethods_AccountAccessApi extends RestHelper { s"""${mockedDataText(false)} |Delete Account Access Consents |""".stripMargin, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("Account Access") :: Nil ) @@ -181,7 +181,7 @@ object APIMethods_AccountAccessApi extends RestHelper { |${mockedDataText(false)} |Get Account Access Consents |""".stripMargin, - emptyObjectJson, + EmptyBody, json.parse(s"""{ "Data": { "ConsentId": "string", diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountsApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountsApi.scala index f7a19ed2bb..d85e236eef 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountsApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/AccountsApi.scala @@ -38,7 +38,7 @@ object APIMethods_AccountsApi extends RestHelper { "/accounts", "Get Accounts", s"""""", - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -144,7 +144,7 @@ object APIMethods_AccountsApi extends RestHelper { "Get Accounts", s""" """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime": "2019-03-05T13:09:30.399Z", diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/BalancesApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/BalancesApi.scala index 6bc4d2e44b..7ce9f571c3 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/BalancesApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/BalancesApi.scala @@ -39,7 +39,7 @@ object APIMethods_BalancesApi extends RestHelper { "/accounts/ACCOUNT_ID/balances", "Get Balances", s"""""", - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -133,7 +133,7 @@ object APIMethods_BalancesApi extends RestHelper { "/balances", "Get Balances", s"""""", - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/BeneficiariesApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/BeneficiariesApi.scala index eee66e7579..8b2a9202f8 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/BeneficiariesApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/BeneficiariesApi.scala @@ -36,7 +36,7 @@ object APIMethods_BeneficiariesApi extends RestHelper { "Get Beneficiaries", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -200,7 +200,7 @@ object APIMethods_BeneficiariesApi extends RestHelper { "Get Beneficiaries", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DirectDebitsApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DirectDebitsApi.scala index 7dcf974618..0fa62f8616 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DirectDebitsApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DirectDebitsApi.scala @@ -36,7 +36,7 @@ object APIMethods_DirectDebitsApi extends RestHelper { "Get Direct Debits", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -136,7 +136,7 @@ object APIMethods_DirectDebitsApi extends RestHelper { "Get Direct Debits", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticPaymentsApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticPaymentsApi.scala index 8093e3f97c..a3eb5c672b 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticPaymentsApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticPaymentsApi.scala @@ -39,7 +39,7 @@ object APIMethods_DomesticPaymentsApi extends RestHelper { "Create Domestic Payment Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -247,7 +247,7 @@ object APIMethods_DomesticPaymentsApi extends RestHelper { "Create Domestic Payments", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -433,7 +433,7 @@ object APIMethods_DomesticPaymentsApi extends RestHelper { "Get Domestic Payment Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -641,7 +641,7 @@ object APIMethods_DomesticPaymentsApi extends RestHelper { "Get Domestic Payment Consents Funds Confirmation", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -705,7 +705,7 @@ object APIMethods_DomesticPaymentsApi extends RestHelper { "Get Domestic Payments", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticScheduledPaymentsApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticScheduledPaymentsApi.scala index dab8e6b7b8..235d2e139f 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticScheduledPaymentsApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticScheduledPaymentsApi.scala @@ -38,7 +38,7 @@ object APIMethods_DomesticScheduledPaymentsApi extends RestHelper { "Create Domestic Scheduled Payment Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -250,7 +250,7 @@ object APIMethods_DomesticScheduledPaymentsApi extends RestHelper { "Create Domestic Scheduled Payments", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -438,7 +438,7 @@ object APIMethods_DomesticScheduledPaymentsApi extends RestHelper { "Get Domestic Scheduled Payment Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -650,7 +650,7 @@ object APIMethods_DomesticScheduledPaymentsApi extends RestHelper { "Get Domestic Scheduled Payments", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticStandingOrdersApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticStandingOrdersApi.scala index 3ea5dc880d..ee21f7fc48 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticStandingOrdersApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/DomesticStandingOrdersApi.scala @@ -38,7 +38,7 @@ object APIMethods_DomesticStandingOrdersApi extends RestHelper { "Create Domestic Standing Order Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -232,7 +232,7 @@ object APIMethods_DomesticStandingOrdersApi extends RestHelper { "Create Domestic Standing Orders", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -402,7 +402,7 @@ object APIMethods_DomesticStandingOrdersApi extends RestHelper { "Get Domestic Standing Order Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -596,7 +596,7 @@ object APIMethods_DomesticStandingOrdersApi extends RestHelper { "Get Domestic Standing Orders", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/FilePaymentsApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/FilePaymentsApi.scala index aaea0f3997..216d31cc7c 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/FilePaymentsApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/FilePaymentsApi.scala @@ -41,7 +41,7 @@ object APIMethods_FilePaymentsApi extends RestHelper { "Create File Payment Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -183,8 +183,8 @@ object APIMethods_FilePaymentsApi extends RestHelper { "Create File Payment Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("File Payments") :: apiTagMockedData :: Nil ) @@ -209,7 +209,7 @@ object APIMethods_FilePaymentsApi extends RestHelper { "Create File Payments", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -357,7 +357,7 @@ object APIMethods_FilePaymentsApi extends RestHelper { "Get File Payment Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -499,8 +499,8 @@ object APIMethods_FilePaymentsApi extends RestHelper { "Get File Payment Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("File Payments") :: apiTagMockedData :: Nil ) @@ -525,7 +525,7 @@ object APIMethods_FilePaymentsApi extends RestHelper { "Get File Payments", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -673,8 +673,8 @@ object APIMethods_FilePaymentsApi extends RestHelper { "Get File Payments", s"""${mockedDataText(true)} """, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("File Payments") :: apiTagMockedData :: Nil ) diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/FundsConfirmationsApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/FundsConfirmationsApi.scala index b9e47730b0..3dce3f6b8f 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/FundsConfirmationsApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/FundsConfirmationsApi.scala @@ -38,7 +38,7 @@ object APIMethods_FundsConfirmationsApi extends RestHelper { "Create Funds Confirmation Consent", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -114,7 +114,7 @@ object APIMethods_FundsConfirmationsApi extends RestHelper { "Create Funds Confirmation", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -186,8 +186,8 @@ object APIMethods_FundsConfirmationsApi extends RestHelper { "Delete Funds Confirmation Consent", s"""${mockedDataText(true)} """, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("Funds Confirmations") :: apiTagMockedData :: Nil ) @@ -212,7 +212,7 @@ object APIMethods_FundsConfirmationsApi extends RestHelper { "Get Funds Confirmation Consent", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalPaymentsApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalPaymentsApi.scala index b787a6059e..d5206696dc 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalPaymentsApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalPaymentsApi.scala @@ -39,7 +39,7 @@ object APIMethods_InternationalPaymentsApi extends RestHelper { "Create International Payment Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -319,7 +319,7 @@ object APIMethods_InternationalPaymentsApi extends RestHelper { "Create International Payments", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -577,7 +577,7 @@ object APIMethods_InternationalPaymentsApi extends RestHelper { "Get International Payment Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -857,7 +857,7 @@ object APIMethods_InternationalPaymentsApi extends RestHelper { "Get International Payment Consents Funds Confirmation", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -921,7 +921,7 @@ object APIMethods_InternationalPaymentsApi extends RestHelper { "Get International Payments", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalScheduledPaymentsApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalScheduledPaymentsApi.scala index d1b1c888fe..e7f2ea6b04 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalScheduledPaymentsApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalScheduledPaymentsApi.scala @@ -39,7 +39,7 @@ object APIMethods_InternationalScheduledPaymentsApi extends RestHelper { "Create International Scheduled Payment Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -323,7 +323,7 @@ object APIMethods_InternationalScheduledPaymentsApi extends RestHelper { "Create International Scheduled Payments", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -583,7 +583,7 @@ object APIMethods_InternationalScheduledPaymentsApi extends RestHelper { "Get International Scheduled Payment Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -867,7 +867,7 @@ object APIMethods_InternationalScheduledPaymentsApi extends RestHelper { "Get International Scheduled Payment Consents Funds Confirmation", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -931,7 +931,7 @@ object APIMethods_InternationalScheduledPaymentsApi extends RestHelper { "Get International Scheduled Payments", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalStandingOrdersApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalStandingOrdersApi.scala index 342f4cf0cb..bb6b4f77f6 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalStandingOrdersApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/InternationalStandingOrdersApi.scala @@ -38,7 +38,7 @@ object APIMethods_InternationalStandingOrdersApi extends RestHelper { "Create International Standing Order Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -286,7 +286,7 @@ object APIMethods_InternationalStandingOrdersApi extends RestHelper { "Create International Standing Orders", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -510,7 +510,7 @@ object APIMethods_InternationalStandingOrdersApi extends RestHelper { "Get International Standing Order Consents", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -758,7 +758,7 @@ object APIMethods_InternationalStandingOrdersApi extends RestHelper { "Get International Standing Orders", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/OffersApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/OffersApi.scala index 15cc139ed7..eb7cfc90b4 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/OffersApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/OffersApi.scala @@ -36,7 +36,7 @@ object APIMethods_OffersApi extends RestHelper { "Get Offers", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -168,7 +168,7 @@ object APIMethods_OffersApi extends RestHelper { "Get Offers", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/PartysApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/PartysApi.scala index 24fca1fb8b..cc066d556a 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/PartysApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/PartysApi.scala @@ -36,7 +36,7 @@ object APIMethods_PartysApi extends RestHelper { "Get Party", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -146,7 +146,7 @@ object APIMethods_PartysApi extends RestHelper { "Get Party", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/ProductsApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/ProductsApi.scala index 596489ef54..a623afaa1f 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/ProductsApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/ProductsApi.scala @@ -35,8 +35,8 @@ object APIMethods_ProductsApi extends RestHelper { "/accounts/ACCOUNTID/product", "Get Products", s"""${mockedDataText(true)}""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("Products") :: apiTagMockedData :: Nil ) @@ -61,8 +61,8 @@ object APIMethods_ProductsApi extends RestHelper { "Get Products", s"""${mockedDataText(true)} """, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("Products") :: apiTagMockedData :: Nil ) diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/ScheduledPaymentsApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/ScheduledPaymentsApi.scala index a4273f7004..163759ba78 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/ScheduledPaymentsApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/ScheduledPaymentsApi.scala @@ -36,7 +36,7 @@ object APIMethods_ScheduledPaymentsApi extends RestHelper { "Get Scheduled Payments", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -172,7 +172,7 @@ object APIMethods_ScheduledPaymentsApi extends RestHelper { "Get Scheduled Payments", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/StandingOrdersApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/StandingOrdersApi.scala index 70d86e1181..48772074d5 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/StandingOrdersApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/StandingOrdersApi.scala @@ -36,7 +36,7 @@ object APIMethods_StandingOrdersApi extends RestHelper { "Get Standing Orders", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -220,7 +220,7 @@ object APIMethods_StandingOrdersApi extends RestHelper { "Get Standing Orders", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/StatementsApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/StatementsApi.scala index 5f6de06bce..69a893f0d6 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/StatementsApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/StatementsApi.scala @@ -39,7 +39,7 @@ object APIMethods_StatementsApi extends RestHelper { "Get Statements", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -447,7 +447,7 @@ object APIMethods_StatementsApi extends RestHelper { "Get Statements", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -855,8 +855,8 @@ object APIMethods_StatementsApi extends RestHelper { "Get Statements", s"""${mockedDataText(true)} """, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("Statements") :: apiTagMockedData :: Nil ) @@ -881,7 +881,7 @@ object APIMethods_StatementsApi extends RestHelper { "Get Transactions", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, @@ -1353,7 +1353,7 @@ object APIMethods_StatementsApi extends RestHelper { "Get Statements", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime" : { }, diff --git a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/TransactionsApi.scala b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/TransactionsApi.scala index ad3af12d92..838e4aac22 100644 --- a/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/TransactionsApi.scala +++ b/obp-api/src/main/scala/code/api/UKOpenBanking/v3_1_0/TransactionsApi.scala @@ -44,7 +44,7 @@ object APIMethods_TransactionsApi extends RestHelper { "Get Transactions", s"""${mockedDataText(true)} """, - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime": "2019-03-06T07:38:51.169Z", @@ -517,7 +517,7 @@ object APIMethods_TransactionsApi extends RestHelper { "/accounts/ACCOUNT_ID/transactions", "Get Transactions", s"""""", - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime": "2019-03-06T07:38:51.169Z", @@ -784,7 +784,7 @@ object APIMethods_TransactionsApi extends RestHelper { "/transactions", "Get Transactions", s"""""", - emptyObjectJson, + EmptyBody, json.parse("""{ "Meta" : { "FirstAvailableDateTime": "2019-03-06T07:38:51.169Z", diff --git a/obp-api/src/main/scala/code/api/berlin/group/v1/APIMethods_BERLIN_GROUP_1.scala b/obp-api/src/main/scala/code/api/berlin/group/v1/APIMethods_BERLIN_GROUP_1.scala index 59108fdb66..d6b24dafbc 100644 --- a/obp-api/src/main/scala/code/api/berlin/group/v1/APIMethods_BERLIN_GROUP_1.scala +++ b/obp-api/src/main/scala/code/api/berlin/group/v1/APIMethods_BERLIN_GROUP_1.scala @@ -44,7 +44,7 @@ object APIMethods_BERLIN_GROUP_1 extends RestHelper{ | |This endpoint is work in progress. Experimental! |""", - emptyObjectJson, + EmptyBody, CoreAccountsJsonV1(List(CoreAccountJsonV1( id = "3dc3d5b3-7023-4848-9853-f5400a64e80f", iban = "DE2310010010123456789", @@ -102,7 +102,7 @@ object APIMethods_BERLIN_GROUP_1 extends RestHelper{ | |This endpoint is work in progress. Experimental! |""", - emptyObjectJson, + EmptyBody, SwaggerDefinitionsJSON.accountBalances, List(UserNotLoggedIn, ViewNotFound, UserNoPermissionAccessView, UnknownError), List(apiTagBerlinGroup, apiTagAccount, apiTagPrivateData, apiTagPsd2)) @@ -142,7 +142,7 @@ object APIMethods_BERLIN_GROUP_1 extends RestHelper{ | |This endpoint is work in progress. Experimental! |""", - emptyObjectJson, + EmptyBody, SwaggerDefinitionsJSON.transactionsJsonV1, List(UserNotLoggedIn,UnknownError), List(apiTagBerlinGroup, apiTagTransaction, apiTagPrivateData, apiTagPsd2)) diff --git a/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala b/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala index cfde8412ed..c8fbc2dd42 100644 --- a/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala +++ b/obp-api/src/main/scala/code/api/berlin/group/v1_3/AccountInformationServiceAISApi.scala @@ -220,8 +220,8 @@ As a last option, an ASPSP might in addition accept a command with access rights "Delete Consent", s"""${mockedDataText(false)} The TPP can delete an account information consent object if needed.""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, UnknownError), ApiTag("Account Information Service (AIS)") :: apiTagBerlinGroupM :: Nil ) @@ -269,7 +269,7 @@ payment accounts of a PSU. In this case, this endpoint will deliver the information about all available payment accounts of the PSU at this ASPSP. """, - emptyObjectJson, + EmptyBody, json.parse("""{ | "accounts": [ | { @@ -341,7 +341,7 @@ This account-id then can be retrieved by the "GET Account List" call. The account-id is constant at least throughout the lifecycle of a given consent. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "account":{ "iban":"DE91 1000 0000 0123 4567 89" @@ -390,7 +390,7 @@ It is assumed that a consent of the PSU to this access is already given and stor The addressed list of card accounts depends then on the PSU ID and the stored consent addressed by consentId, respectively the OAuth2 access token. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "cardAccounts": [ { @@ -457,7 +457,7 @@ logged on intermediary servers within the ASPSP sphere. This account-id then can be retrieved by the "GET Card Account List" call """, - emptyObjectJson, + EmptyBody, json.parse("""{ "cardAccount":{ "iban":"DE91 1000 0000 0123 4567 89" @@ -502,7 +502,7 @@ This account-id then can be retrieved by the s"""${mockedDataText(false)} Reads account data from a given card account addressed by "account-id". """, - emptyObjectJson, + EmptyBody, json.parse("""{ "cardAccount": { "maskedPan": "525412******3241" @@ -602,7 +602,7 @@ Return a list of all authorisation subresources IDs which have been created. This function returns an array of hyperlinks to all generated authorisation sub-resources. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "authorisationIds" : "faa3657e-13f0-4feb-a6c3-34bf21a9ae8e" }"""), @@ -635,7 +635,7 @@ Returns the content of an account information consent object. This is returning the data for the TPP especially in cases, where the consent was directly managed between ASPSP and PSU e.g. in a re-direct SCA Approach. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "access": { "accounts": [ @@ -703,7 +703,7 @@ where the consent was directly managed between ASPSP and PSU e.g. in a re-direct s"""${mockedDataText(false)} This method returns the SCA status of a consent initiation's authorisation sub-resource. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "scaStatus" : "started" }"""), @@ -738,7 +738,7 @@ This method returns the SCA status of a consent initiation's authorisation sub-r "Consent status request", s"""${mockedDataText(false)} Read the status of an account information consent resource.""", - emptyObjectJson, + EmptyBody, json.parse("""{ "consentStatus": "received" }"""), @@ -779,7 +779,7 @@ by "account-id". This call is only available on transactions as reported in a JS of the "Read Transaction List" call within the _links subfield. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "description": "Example for transaction details", "value": { @@ -835,7 +835,7 @@ Read transaction reports or transaction lists of a given account ddressed by "ac depending on the steering parameter "bookingStatus" together with balances. For a given account, additional parameters are e.g. the attributes "dateFrom" and "dateTo". The ASPSP might add balance information, if transaction lists without balances are not supported. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "account": { "iban": "DE2310010010123456788" @@ -939,7 +939,7 @@ In this case the currency code is set to "XXX". Give detailed information about Give detailed information about the addressed account together with balance information """, - emptyObjectJson, + EmptyBody, json.parse("""{ "account": { "resourceId": "3dc3d5b3-7023-4848-9853-f5400a64e80f", @@ -989,7 +989,7 @@ It is assumed that a consent of the PSU to this access is already given and stor The addressed details of this account depends then on the stored consent addressed by consentId, respectively the OAuth2 access token. """, - emptyObjectJson, + EmptyBody, json.parse("""{ | "cardAccount": { | "resourceId": "3d9a81b3-a47d-4130-8765-a9c0ff861b99", diff --git a/obp-api/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala b/obp-api/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala index 3b196b7d49..eefcb86504 100644 --- a/obp-api/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala +++ b/obp-api/src/main/scala/code/api/berlin/group/v1_3/PaymentInitiationServicePISApi.scala @@ -97,7 +97,7 @@ for scheduled payments of the last business day before the scheduled execution d DELETE command will tell the TPP whether the * access method was rejected * access method was successful, or * access method is generally applicable, but further authorisation processes are needed. """, - emptyObjectJson, + EmptyBody, CancelPaymentResponseJson( "ACTC", _links = CancelPaymentResponseLinks( @@ -178,7 +178,7 @@ or * access method is generally applicable, but further authorisation processes s"""${mockedDataText(false)} This method returns the SCA status of a payment initiation's authorisation sub-resource. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "scaStatus" : "psuAuthenticated" }"""), @@ -215,7 +215,7 @@ This method returns the SCA status of a payment initiation's authorisation sub-r "Get Payment Information", s"""${mockedDataText(false)} Returns the content of a payment object""", - emptyObjectJson, + EmptyBody, json.parse("""{ "debtorAccount":{ "iban":"GR12 1234 5123 4511 3981 4475 477" @@ -269,7 +269,7 @@ Read a list of all authorisation subresources IDs which have been created. This function returns an array of hyperlinks to all generated authorisation sub-resources. """, - emptyObjectJson, + EmptyBody, json.parse("""[ { "scaStatus": "received", @@ -322,7 +322,7 @@ This function returns an array of hyperlinks to all generated authorisation sub- s"""${mockedDataText(false)} Retrieve a list of all created cancellation authorisation sub-resources. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "cancellationIds" : ["faa3657e-13f0-4feb-a6c3-34bf21a9ae8e]" }"""), @@ -359,7 +359,7 @@ Retrieve a list of all created cancellation authorisation sub-resources. s"""${mockedDataText(false)} This method returns the SCA status of a payment initiation's authorisation sub-resource. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "scaStatus" : "psuAuthenticated" }"""), @@ -398,7 +398,7 @@ This method returns the SCA status of a payment initiation's authorisation sub-r "Payment initiation status request", s"""${mockedDataText(false)} Check the transaction status of a payment initiation.""", - emptyObjectJson, + EmptyBody, json.parse("""{ "transactionStatus": "ACCP" }"""), diff --git a/obp-api/src/main/scala/code/api/berlin/group/v1_3/SigningBasketsApi.scala b/obp-api/src/main/scala/code/api/berlin/group/v1_3/SigningBasketsApi.scala index bcd78ef048..50936022d5 100644 --- a/obp-api/src/main/scala/code/api/berlin/group/v1_3/SigningBasketsApi.scala +++ b/obp-api/src/main/scala/code/api/berlin/group/v1_3/SigningBasketsApi.scala @@ -143,8 +143,8 @@ The undlerying transactions are not affected by this deletion. Remark: The signing basket as such is not deletable after a first (partial) authorisation has been applied. Nevertheless, single transactions might be cancelled on an individual basis on the XS2A interface. """, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, UnknownError), apiTagSigningBaskets :: Nil ) @@ -175,7 +175,7 @@ Nevertheless, single transactions might be cancelled on an individual basis on t "Returns the content of an signing basket object.", s"""${mockedDataText(false)} Returns the content of an signing basket object.""", - emptyObjectJson, + EmptyBody, json.parse("""{ "transactionStatus" : "ACCP", "payments" : "", @@ -214,7 +214,7 @@ Read a list of all authorisation subresources IDs which have been created. This function returns an array of hyperlinks to all generated authorisation sub-resources. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "authorisationIds" : "" }"""), @@ -245,7 +245,7 @@ This function returns an array of hyperlinks to all generated authorisation sub- s"""${mockedDataText(false)} This method returns the SCA status of a signing basket's authorisation sub-resource. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "scaStatus" : "psuAuthenticated" }"""), @@ -281,7 +281,7 @@ This method returns the SCA status of a signing basket's authorisation sub-resou s"""${mockedDataText(false)} Returns the status of a signing basket object. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "transactionStatus" : "RCVD" }"""), @@ -346,7 +346,7 @@ This applies in the following scenarios: executing the cancellation. * The signing basket needs to be authorised yet. """, - emptyObjectJson, + EmptyBody, json.parse("""{ "challengeData" : { "otpMaxLength" : 0, diff --git a/obp-api/src/main/scala/code/api/util/APIUtil.scala b/obp-api/src/main/scala/code/api/util/APIUtil.scala index c4d7e5458a..86c1842d82 100644 --- a/obp-api/src/main/scala/code/api/util/APIUtil.scala +++ b/obp-api/src/main/scala/code/api/util/APIUtil.scala @@ -186,7 +186,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{ implicit def errorToJson(error: ErrorMessage): JValue = Extraction.decompose(error) val headers = ("Access-Control-Allow-Origin","*") :: Nil val defaultJValue = Extraction.decompose(EmptyClassJson()) - val emptyObjectJson = EmptyClassJson() + lazy val initPasswd = try {System.getenv("UNLOCK")} catch {case _:Throwable => ""} import code.api.util.ErrorMessages._ @@ -3773,7 +3773,8 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{ messageDoc.exampleOutboundMessage, messageDoc.exampleInboundMessage, errorResponseBodies = List(InvalidJsonFormat), - List(apiTagBank) + List(apiTagBank), + specifiedUrl = Some(s"/obp-adapter/$connectorMethodName") ) } @@ -4342,7 +4343,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{ * */ private def getDependentConnectorMethods(endpoint: PartialFunction[_, _]): List[String] = - if (SHOW_USED_CONNECTOR_METHODS) { + if (SHOW_USED_CONNECTOR_METHODS && endpoint != null) { val connectorTypeName = classOf[Connector].getName val endpointClassName = endpoint.getClass.getName // not analyze dynamic code @@ -4927,10 +4928,9 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{ locale: Option[String], contentParam: Option[ContentParam], apiCollectionIdParam: Option[String], - isVersion4OrHigher: Option[Boolean], - isStaticResource: Option[Boolean], + isVersion4OrHigher: Option[Boolean] ) = s"requestedApiVersionString:$requestedApiVersionString-bankId:$bankId-tags:$tags-partialFunctions:$partialFunctions-locale:${locale.toString}" + - s"-contentParam:$contentParam-apiCollectionIdParam:$apiCollectionIdParam-isVersion4OrHigher:$isVersion4OrHigher-isStaticResource:$isStaticResource".intern() + s"-contentParam:$contentParam-apiCollectionIdParam:$apiCollectionIdParam-isVersion4OrHigher:$isVersion4OrHigher".intern() def getUserLacksRevokePermissionErrorMessage(sourceViewId: ViewId, targetViewId: ViewId) = if (isValidSystemViewId(targetViewId.value)) diff --git a/obp-api/src/main/scala/code/api/util/CodeGenerateUtils.scala b/obp-api/src/main/scala/code/api/util/CodeGenerateUtils.scala index 088485fdf8..5745208ea0 100644 --- a/obp-api/src/main/scala/code/api/util/CodeGenerateUtils.scala +++ b/obp-api/src/main/scala/code/api/util/CodeGenerateUtils.scala @@ -218,12 +218,12 @@ object CodeGenerateUtils { } else if(typeName.matches("""Array|List|Seq""")) { val TypeRef(_, _, args: List[Type]) = tp (example, typeName) match { - case (Some(v), "Array") if(args.head =:= typeOf[String]) => s"""$v.split("[,;]")""" - case (Some(v), "List") if(args.head =:= typeOf[String]) => s"""$v.split("[,;]").toList""" - case (Some(v), "Seq") if(args.head =:= typeOf[String]) => s"""$v.split("[,;]").toSeq""" - case (Some(v), "Array") if(args.head =:= typeOf[Date]) => s"""$v.split("[,;]").map(parseDate).flatMap(_.toSeq)""" - case (Some(v), "List") if(args.head =:= typeOf[Date]) => s"""$v.split("[,;]").map(parseDate).flatMap(_.toSeq).toList""" - case (Some(v), "Seq") if(args.head =:= typeOf[Date]) => s"""$v.split("[,;]").map(parseDate).flatMap(_.toSeq).toSeq""" + case (Some(v), "Array") if(args.head =:= typeOf[String]) => s"""$v.replaceAll("\\[","").replaceAll("\\]","").split(",")""" + case (Some(v), "List") if(args.head =:= typeOf[String]) => s"""$v.replaceAll("\\[","").replaceAll("\\]","").split(",").toList""" + case (Some(v), "Seq") if(args.head =:= typeOf[String]) => s"""$v.replaceAll("\\[","").replaceAll("\\]","").split(",").toSeq""" + case (Some(v), "Array") if(args.head =:= typeOf[Date]) => s"""$v.replaceAll("\\[","").replaceAll("\\]","").split(",").map(parseDate).flatMap(_.toSeq)""" + case (Some(v), "List") if(args.head =:= typeOf[Date]) => s"""$v.replaceAll("\\[","").replaceAll("\\]","").split(",").map(parseDate).flatMap(_.toSeq).toList""" + case (Some(v), "Seq") if(args.head =:= typeOf[Date]) => s"""$v.replaceAll("\\[","").replaceAll("\\]","").split(",").map(parseDate).flatMap(_.toSeq).toSeq""" case (_, collName) if ReflectUtils.isObpType(args.head) => val itemExpression = createDocExample(args.head, fieldName, parentFieldName, parentType) s"$collName($itemExpression)" diff --git a/obp-api/src/main/scala/code/api/v1_2_1/APIMethods121.scala b/obp-api/src/main/scala/code/api/v1_2_1/APIMethods121.scala index 0e1274906a..1970def6f3 100644 --- a/obp-api/src/main/scala/code/api/v1_2_1/APIMethods121.scala +++ b/obp-api/src/main/scala/code/api/v1_2_1/APIMethods121.scala @@ -108,7 +108,6 @@ trait APIMethods121 { val Implementations1_2_1 = new Object(){ val resourceDocs = ArrayBuffer[ResourceDoc]() - val emptyObjectJson = EmptyClassJson() val apiVersion = ApiVersion.v1_2_1 // was String "1_2_1" val apiVersionStatus : String = "STABLE" @@ -124,7 +123,7 @@ trait APIMethods121 { |* API version |* Hosted by information |* Git Commit""", - emptyObjectJson, + EmptyBody, apiInfoJSON, List(UnknownError, "no connector set"), apiTagApi :: Nil) @@ -156,7 +155,7 @@ trait APIMethods121 { |* Short and full name of bank |* Logo URL |* Website""", - emptyObjectJson, + EmptyBody, banksJSON, List(UnknownError), apiTagBank :: apiTagPsd2 :: apiTagOldStyle :: Nil) @@ -191,7 +190,7 @@ trait APIMethods121 { |* Short and full name of bank |* Logo URL |* Website""", - emptyObjectJson, + EmptyBody, bankJSON, List(UserNotLoggedIn, UnknownError, BankNotFound), apiTagBank :: apiTagPsd2 :: apiTagOldStyle :: Nil) @@ -223,7 +222,7 @@ trait APIMethods121 { | |${authenticationRequiredMessage(true)} |""".stripMargin, - emptyObjectJson, + EmptyBody, accountJSON, List(UserNotLoggedIn, UnknownError), apiTagAccount :: apiTagPsd2 :: apiTagOldStyle :: Nil) @@ -256,7 +255,7 @@ trait APIMethods121 { |Authentication via OAuth is required. | |""".stripMargin, - emptyObjectJson, + EmptyBody, accountJSON, List(UserNotLoggedIn, UnknownError), apiTagAccount :: apiTagPsd2 :: apiTagOldStyle :: Nil) @@ -288,7 +287,7 @@ trait APIMethods121 { |Authentication via OAuth is required. | |""".stripMargin, - emptyObjectJson, + EmptyBody, accountJSON, List(UnknownError), apiTagAccount :: apiTagOldStyle :: Nil) @@ -320,7 +319,7 @@ trait APIMethods121 { |${authenticationRequiredMessage(true)} | """, - emptyObjectJson, + EmptyBody, accountJSON, List(UserNotLoggedIn, UnknownError, BankNotFound), apiTagAccount :: apiTagOldStyle :: Nil) @@ -353,7 +352,7 @@ trait APIMethods121 { |${authenticationRequiredMessage(true)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, accountJSON, List(UserNotLoggedIn, UnknownError, BankNotFound), List(apiTagAccount, apiTagPsd2, apiTagOldStyle)) @@ -385,7 +384,7 @@ trait APIMethods121 { |Authentication via OAuth is not required. | |""".stripMargin, - emptyObjectJson, + EmptyBody, accountJSON, List(UserNotLoggedIn, UnknownError, BankNotFound), apiTagAccountPublic :: apiTagAccount :: apiTagPublicData :: apiTagOldStyle :: Nil) @@ -428,7 +427,7 @@ trait APIMethods121 { |Authentication is required if the 'is_public' field in view (VIEW_ID) is not set to `true`. | |""".stripMargin, - emptyObjectJson, + EmptyBody, moderatedAccountJSON, List(UserNotLoggedIn, UnknownError, BankAccountNotFound), apiTagAccount :: apiTagOldStyle :: Nil) @@ -530,7 +529,7 @@ trait APIMethods121 { |Returns the list of the views created for account ACCOUNT_ID at BANK_ID. | |${authenticationRequiredMessage(true)} and the user needs to have access to the owner view.""", - emptyObjectJson, + EmptyBody, viewsJSONV121, List(UserNotLoggedIn, BankAccountNotFound, UnknownError, "user does not have owner access"), List(apiTagView, apiTagAccount, apiTagOldStyle)) @@ -691,8 +690,8 @@ trait APIMethods121 { "/banks/BANK_ID/accounts/ACCOUNT_ID/views/VIEW_ID", "Delete Custom View", "Deletes the custom view specified by VIEW_ID on the bank account specified by ACCOUNT_ID at bank BANK_ID", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, BankAccountNotFound, @@ -741,7 +740,7 @@ trait APIMethods121 { s"""Returns the list of the permissions at BANK_ID for account ACCOUNT_ID, with each time a pair composed of the user and the views that he has access to. | |${authenticationRequiredMessage(true)} and the user needs to have access to the owner view.""", - emptyObjectJson, + EmptyBody, permissionsJSON, List(UserNotLoggedIn, UnknownError), List(apiTagView, apiTagAccount, apiTagEntitlement, apiTagOldStyle) @@ -779,7 +778,7 @@ trait APIMethods121 { |All url parameters must be [%-encoded](http://en.wikipedia.org/wiki/Percent-encoding), which is often especially relevant for USER_ID and PROVIDER_ID. | |${authenticationRequiredMessage(true)} and the user needs to have access to the owner view.""", - emptyObjectJson, + EmptyBody, viewsJSONV121, List( UserNotLoggedIn, @@ -877,7 +876,7 @@ trait APIMethods121 { |${authenticationRequiredMessage(true)} and the user needs to have access to the owner view. | |Granting access to a public view will return an error message, as the user already has access.""", - emptyObjectJson, // No Json body required + EmptyBody, // No Json body required viewJSONV121, List( UserNotLoggedIn, @@ -938,8 +937,8 @@ trait APIMethods121 { |$generalRevokeAccessToViewText | |${authenticationRequiredMessage(true)} and the user needs to have access to the owner view.""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, BankAccountNotFound, @@ -976,8 +975,8 @@ trait APIMethods121 { |$generalRevokeAccessToViewText | |${authenticationRequiredMessage(true)} and the user needs to have access to the owner view.""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, BankAccountNotFound, @@ -1011,7 +1010,7 @@ trait APIMethods121 { s"""Returns data about all the other accounts that have shared at least one transaction with the ACCOUNT_ID at BANK_ID. |${authenticationRequiredMessage(false)} |Authentication is required if the view VIEW_ID is not public.""", - emptyObjectJson, + EmptyBody, otherAccountsJSON, List( BankAccountNotFound, @@ -1044,7 +1043,7 @@ trait APIMethods121 { s"""Returns data about the Other Account that has shared at least one transaction with ACCOUNT_ID at BANK_ID. |${authenticationRequiredMessage(false)} |Authentication is required if the view is not public.""", - emptyObjectJson, + EmptyBody, otherAccountJSON, List(BankAccountNotFound, UnknownError), List(apiTagCounterparty, apiTagAccount, apiTagOldStyle)) @@ -1075,7 +1074,7 @@ trait APIMethods121 { |Returns only the metadata about one other bank account (OTHER_ACCOUNT_ID) that had shared at least one transaction with ACCOUNT_ID at BANK_ID. | |Authentication via OAuth is required if the view is not public.""", - emptyObjectJson, + EmptyBody, otherAccountMetadataJSON, List(UserNotLoggedIn, UnknownError, "the view does not allow metadata access"), List(apiTagCounterpartyMetaData, apiTagCounterparty)) @@ -1109,7 +1108,7 @@ trait APIMethods121 { s"""Returns the public alias of the other account OTHER_ACCOUNT_ID. |${authenticationRequiredMessage(false)} |${authenticationRequiredMessage(true)} if the view is not public.""", - emptyObjectJson, + EmptyBody, aliasJSON, List( BankAccountNotFound, @@ -1263,8 +1262,8 @@ trait APIMethods121 { | |${authenticationRequiredMessage(false)} |Authentication is required if the view is not public.""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( BankAccountNotFound, "the view does not allow metadata access", @@ -1311,7 +1310,7 @@ trait APIMethods121 { | |${authenticationRequiredMessage(false)} |Authentication is required if the view is not public.""", - emptyObjectJson, + EmptyBody, aliasJSON, List( UserNotLoggedIn, @@ -1459,8 +1458,8 @@ trait APIMethods121 { | |${authenticationRequiredMessage(false)} |Authentication is required if the view is not public.""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, BankAccountNotFound, @@ -1605,8 +1604,8 @@ trait APIMethods121 { "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/more_info", "Delete more info of other bank account", "", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, BankAccountNotFound, @@ -1751,8 +1750,8 @@ trait APIMethods121 { "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/url", "Delete url of other bank account", "", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, BankAccountNotFound, @@ -1895,8 +1894,8 @@ trait APIMethods121 { "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/image_url", "Delete Counterparty Image URL", "Delete image url of other bank account", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UnknownError), List(apiTagCounterpartyMetaData, apiTagCounterparty)) // Tag general then specific for consistent sorting @@ -2033,8 +2032,8 @@ trait APIMethods121 { "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/open_corporates_url", "Delete Counterparty Open Corporates URL", "Delete open corporate url of other bank account", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, BankAccountNotFound, @@ -2187,8 +2186,8 @@ trait APIMethods121 { "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/corporate_location", "Delete Counterparty Corporate Location", "Delete corporate location of other bank account. Delete the geolocation of the counterparty's registered address", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, BankAccountNotFound, @@ -2344,8 +2343,8 @@ trait APIMethods121 { "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/physical_location", "Delete Counterparty Physical Location", "Delete physical location of other bank account", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, BankAccountNotFound, @@ -2397,7 +2396,7 @@ trait APIMethods121 { |${urlParametersDocument(true, true)} | |""", - emptyObjectJson, + EmptyBody, transactionsJSON, List(BankAccountNotFound, UnknownError), List(apiTagTransaction, apiTagAccount, apiTagPsd2, apiTagOldStyle)) @@ -2463,7 +2462,7 @@ trait APIMethods121 { | | |""", - emptyObjectJson, + EmptyBody, transactionJSON, List(BankAccountNotFound, UnknownError), List(apiTagTransaction, apiTagPsd2, apiTagOldStyle)) @@ -2493,7 +2492,7 @@ trait APIMethods121 { """Returns the account owner description of the transaction [moderated](#1_2_1-getViewsForBankAccount) by the view. | |Authentication via OAuth is required if the view is not public.""", - emptyObjectJson, + EmptyBody, transactionNarrativeJSON, List( BankAccountNotFound, @@ -2611,8 +2610,8 @@ trait APIMethods121 { """Deletes the description of the transaction TRANSACTION_ID. | |Authentication via OAuth is required if the view is not public.""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, BankAccountNotFound, @@ -2648,7 +2647,7 @@ trait APIMethods121 { """Returns the transaction TRANSACTION_ID comments made on a [view](#1_2_1-getViewsForBankAccount) (VIEW_ID). | |Authentication via OAuth is required if the view is not public.""", - emptyObjectJson, + EmptyBody, transactionCommentsJSON, List( UserNotLoggedIn, @@ -2731,8 +2730,8 @@ trait APIMethods121 { """Delete the comment COMMENT_ID about the transaction TRANSACTION_ID made on [view](#1_2_1-getViewsForBankAccount). | |Authentication via OAuth is required. The user must either have owner privileges for this account, or must be the user that posted the comment.""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( BankAccountNotFound, NoViewPermission, @@ -2769,7 +2768,7 @@ trait APIMethods121 { "Get Transaction Tags", """Returns the transaction TRANSACTION_ID tags made on a [view](#1_2_1-getViewsForBankAccount) (VIEW_ID). Authentication via OAuth is required if the view is not public.""", - emptyObjectJson, + EmptyBody, transactionTagJSON, List( BankAccountNotFound, @@ -2853,8 +2852,8 @@ trait APIMethods121 { |Authentication via OAuth is required. The user must either have owner privileges for this account, |or must be the user that posted the tag. |""".stripMargin, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(NoViewPermission, ViewNotFound, UnknownError), @@ -2889,7 +2888,7 @@ trait APIMethods121 { "Get Transaction Images", """Returns the transaction TRANSACTION_ID images made on a [view](#1_2_1-getViewsForBankAccount) (VIEW_ID). Authentication via OAuth is required if the view is not public.""", - emptyObjectJson, + EmptyBody, transactionImagesJSON, List( UserNotLoggedIn, @@ -2972,8 +2971,8 @@ trait APIMethods121 { """Deletes the image IMAGE_ID about the transaction TRANSACTION_ID made on [view](#1_2_1-getViewsForBankAccount). | |Authentication via OAuth is required. The user must either have owner privileges for this account, or must be the user that posted the image.""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( BankAccountNotFound, NoViewPermission, @@ -3015,7 +3014,7 @@ trait APIMethods121 { |It represents the location where the transaction has been initiated. | |Authentication via OAuth is required if the view is not public.""", - emptyObjectJson, + EmptyBody, transactionWhereJSON, List(BankAccountNotFound, NoViewPermission, @@ -3145,8 +3144,8 @@ trait APIMethods121 { |${authenticationRequiredMessage(true)} | |The user must either have owner privileges for this account, or must be the user that posted the geo tag.""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, BankAccountNotFound, @@ -3187,7 +3186,7 @@ trait APIMethods121 { """Get other account of a transaction. |Returns details of the other party involved in the transaction, moderated by the [view](#1_2_1-getViewsForBankAccount) (VIEW_ID). Authentication via OAuth is required if the view is not public.""", - emptyObjectJson, + EmptyBody, otherAccountJSON, List(BankAccountNotFound, UnknownError), List(apiTagTransaction, apiTagCounterparty)) diff --git a/obp-api/src/main/scala/code/api/v1_3_0/APIMethods130.scala b/obp-api/src/main/scala/code/api/v1_3_0/APIMethods130.scala index 59d1c1456e..4d62eede9a 100644 --- a/obp-api/src/main/scala/code/api/v1_3_0/APIMethods130.scala +++ b/obp-api/src/main/scala/code/api/v1_3_0/APIMethods130.scala @@ -28,7 +28,6 @@ trait APIMethods130 { val Implementations1_3_0 = new Object(){ val resourceDocs = ArrayBuffer[ResourceDoc]() - val emptyObjectJson = EmptyClassJson() val apiVersion = ApiVersion.v1_3_0 // was String "1_3_0" @@ -44,7 +43,7 @@ trait APIMethods130 { |* API version |* Hosted by information |* Git Commit""", - emptyObjectJson, + EmptyBody, apiInfoJSON, List(UnknownError, "no connector set"), apiTagApi :: Nil) @@ -69,7 +68,7 @@ trait APIMethods130 { "/cards", "Get cards for the current user", "Returns data about all the physical cards a user has been issued. These could be debit cards, credit cards, etc.", - emptyObjectJson, + EmptyBody, physicalCardsJSON, List(UserNotLoggedIn, UnknownError), List(apiTagCard)) @@ -97,7 +96,7 @@ trait APIMethods130 { "/banks/BANK_ID/cards", "Get cards for the specified bank", "", - emptyObjectJson, + EmptyBody, physicalCardsJSON, List(UserNotLoggedIn,BankNotFound, UnknownError), List(apiTagCard, apiTagOldStyle)) diff --git a/obp-api/src/main/scala/code/api/v1_4_0/APIMethods140.scala b/obp-api/src/main/scala/code/api/v1_4_0/APIMethods140.scala index b6d5ef0332..82ad035b31 100644 --- a/obp-api/src/main/scala/code/api/v1_4_0/APIMethods140.scala +++ b/obp-api/src/main/scala/code/api/v1_4_0/APIMethods140.scala @@ -60,7 +60,6 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{ val Implementations1_4_0 = new Object() { val resourceDocs = ArrayBuffer[ResourceDoc]() - val emptyObjectJson = EmptyClassJson() val apiVersion = ApiVersion.v1_4_0 // was noV i.e. "1_4_0" val apiVersionStatus : String = "STABLE" @@ -77,7 +76,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{ |* API version |* Hosted by information |* Git Commit""", - emptyObjectJson, + EmptyBody, apiInfoJSON, List(UnknownError, "no connector set"), apiTagApi :: Nil) @@ -104,7 +103,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{ """Information about the currently authenticated user. | |Authentication via OAuth is required.""", - emptyObjectJson, + EmptyBody, customerJsonV140, List(UserNotLoggedIn, UnknownError), List(apiTagCustomer, apiTagOldStyle)) @@ -139,7 +138,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{ |Messages sent to the currently authenticated user. | |Authentication via OAuth is required.""", - emptyObjectJson, + EmptyBody, customerMessagesJson, List(UserNotLoggedIn, UnknownError), List(apiTagMessage, apiTagCustomer)) @@ -224,7 +223,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{ |You can use the url query parameters *limit* and *offset* for pagination | |${authenticationRequiredMessage(!getBranchesIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, branchesJson, List( UserNotLoggedIn, @@ -276,7 +275,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{ |${urlParametersDocument(false,false)} | |${authenticationRequiredMessage(!getAtmsIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, atmsJson, List( UserNotLoggedIn, @@ -334,7 +333,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{ |* Terms and Conditions |* License the data under this endpoint is released under |${authenticationRequiredMessage(!getProductsIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, productsJson, List( UserNotLoggedIn, @@ -375,7 +374,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{ "/banks/BANK_ID/crm-events", "Get CRM Events", "", - emptyObjectJson, + EmptyBody, crmEventsJson, List( UserNotLoggedIn, @@ -430,7 +429,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{ | This approach aims to provide only one endpoint for initiating transactions, and one that handles challenges, whilst still allowing flexibility with the payload and internal logic. | """.stripMargin, - emptyObjectJson, + EmptyBody, transactionRequestTypesJsonV140, List( UserNotLoggedIn, @@ -485,7 +484,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{ "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-requests", "Get all Transaction Requests", "", - emptyObjectJson, + EmptyBody, transactionRequestJson, List( UserNotLoggedIn, @@ -745,9 +744,9 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{ if (Props.devMode) { resourceDocs += ResourceDoc( - dummy(apiVersion, apiVersionStatus), + testResourceDoc, apiVersion, - "testResourceDoc", + nameOf(testResourceDoc), "GET", "/dummy", "I am only a test resource Doc", @@ -777,15 +776,15 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{ |There are (underscores_in_words_in_brackets) | |_etc_...""", - emptyObjectJson, + EmptyBody, apiInfoJSON, - List(UserNotLoggedIn, UnknownError), + List(UnknownError), List(apiTagDocumentation, apiTagOldStyle)) } - def dummy(apiVersion : ApiVersion, apiVersionStatus: String) : OBPEndpoint = { + lazy val testResourceDoc : OBPEndpoint = { case "dummy" :: Nil JsonGet req => { cc => val apiDetails: JValue = { diff --git a/obp-api/src/main/scala/code/api/v1_4_0/OBPAPI1_4_0.scala b/obp-api/src/main/scala/code/api/v1_4_0/OBPAPI1_4_0.scala index 0e4585cb27..cd2ef4d938 100644 --- a/obp-api/src/main/scala/code/api/v1_4_0/OBPAPI1_4_0.scala +++ b/obp-api/src/main/scala/code/api/v1_4_0/OBPAPI1_4_0.scala @@ -106,7 +106,8 @@ object OBPAPI1_4_0 extends OBPRestHelper with APIMethods140 with MdcLoggable wit Implementations1_4_0.createTransactionRequest, Implementations1_4_0.getTransactionRequests, Implementations1_4_0.getTransactionRequestTypes, - Implementations1_4_0.answerTransactionRequestChallenge + Implementations1_4_0.answerTransactionRequestChallenge, + Implementations1_4_0.testResourceDoc ) diff --git a/obp-api/src/main/scala/code/api/v2_0_0/APIMethods200.scala b/obp-api/src/main/scala/code/api/v2_0_0/APIMethods200.scala index 6f00768f82..99ec31b780 100644 --- a/obp-api/src/main/scala/code/api/v2_0_0/APIMethods200.scala +++ b/obp-api/src/main/scala/code/api/v2_0_0/APIMethods200.scala @@ -128,7 +128,7 @@ trait APIMethods200 { val resourceDocs = ArrayBuffer[ResourceDoc]() val apiRelations = ArrayBuffer[ApiRelation]() - val emptyObjectJson = EmptyClassJson() + val apiVersion = ApiVersion.v2_0_0 // was String "2_0_0" val codeContext = CodeContext(resourceDocs, apiRelations) @@ -147,7 +147,7 @@ trait APIMethods200 { |* API version |* Hosted by information |* Git Commit""", - emptyObjectJson, + EmptyBody, apiInfoJSON, List(UnknownError, "no connector set"), apiTagApi :: Nil) @@ -180,7 +180,7 @@ trait APIMethods200 { |${authenticationRequiredMessage(true)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, basicAccountsJSON, List(UserNotLoggedIn, UnknownError), List(apiTagAccount, apiTagPrivateData, apiTagPublicData, apiTagOldStyle)) @@ -214,7 +214,7 @@ trait APIMethods200 { |${authenticationRequiredMessage(true)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, coreAccountsJSON, List(UnknownError), List(apiTagAccount, apiTagPrivateData, apiTagPsd2, apiTagOldStyle)) @@ -257,7 +257,7 @@ trait APIMethods200 { |${authenticationRequiredMessage(false)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, basicAccountsJSON, List(UserNotLoggedIn, CannotGetAccounts, UnknownError), List(apiTagAccountPublic, apiTagAccount, apiTagPublicData) @@ -294,7 +294,7 @@ trait APIMethods200 { | |${authenticationRequiredMessage(true)} """.stripMargin, - emptyObjectJson, + EmptyBody, basicAccountsJSON, List(BankNotFound, UnknownError), List(apiTagAccount, apiTagPrivateData, apiTagPublicData) @@ -339,7 +339,7 @@ trait APIMethods200 { |${authenticationRequiredMessage(true)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, coreAccountsJSON, List(UserNotLoggedIn, UnknownError), List(apiTagAccount, apiTagPrivateData, apiTagPsd2)) @@ -411,7 +411,7 @@ trait APIMethods200 { |${authenticationRequiredMessage(true)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, basicAccountsJSON, List(UserNotLoggedIn, BankNotFound, UnknownError), List(apiTagAccount, apiTagPsd2) @@ -449,7 +449,7 @@ trait APIMethods200 { |${authenticationRequiredMessage(false)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, basicAccountsJSON, List(UnknownError), List(apiTagAccountPublic, apiTagAccount, apiTagPublicData)) @@ -480,7 +480,7 @@ trait APIMethods200 { |Get a list of documents that affirm the identity of the customer |Passport, driving licence etc. |${authenticationRequiredMessage(false)}""".stripMargin, - emptyObjectJson, + EmptyBody, kycDocumentsJSON, List(UserNotLoggedIn, CustomerNotFoundByCustomerId, UnknownError), List(apiTagKyc, apiTagCustomer), @@ -517,7 +517,7 @@ trait APIMethods200 { s"""Get KYC media (scans, pictures, videos) that affirms the identity of the customer. | |${authenticationRequiredMessage(true)}""".stripMargin, - emptyObjectJson, + EmptyBody, kycMediasJSON, List(UserNotLoggedIn, CustomerNotFoundByCustomerId, UnknownError), List(apiTagKyc, apiTagCustomer), @@ -550,7 +550,7 @@ trait APIMethods200 { s"""Get KYC checks for the Customer specified by CUSTOMER_ID. | |${authenticationRequiredMessage(true)}""".stripMargin, - emptyObjectJson, + EmptyBody, kycChecksJSON, List(UserNotLoggedIn, CustomerNotFoundByCustomerId, UnknownError), List(apiTagKyc, apiTagCustomer), @@ -583,7 +583,7 @@ trait APIMethods200 { s"""Get the KYC statuses for a customer specified by CUSTOMER_ID over time. | |${authenticationRequiredMessage(true)}""".stripMargin, - emptyObjectJson, + EmptyBody, kycStatusesJSON, List(UserNotLoggedIn, CustomerNotFoundByCustomerId, UnknownError), List(apiTagKyc, apiTagCustomer), @@ -617,7 +617,7 @@ trait APIMethods200 { s"""Get social media handles for a customer specified by CUSTOMER_ID. | |${authenticationRequiredMessage(true)}""".stripMargin, - emptyObjectJson, + EmptyBody, socialMediasJSON, List(UserNotLoggedIn, UserHasMissingRoles, CustomerNotFoundByCustomerId, UnknownError), List(apiTagCustomer), @@ -915,7 +915,7 @@ trait APIMethods200 { |${authenticationRequiredMessage(true)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, moderatedCoreAccountJSON, List(BankAccountNotFound,UnknownError), apiTagAccount :: apiTagPsd2 :: apiTagOldStyle :: Nil) @@ -957,7 +957,7 @@ trait APIMethods200 { |${urlParametersDocument(true, true)} | |""", - emptyObjectJson, + EmptyBody, coreTransactionsJSON, List(BankAccountNotFound, UnknownError), List(apiTagTransaction, apiTagAccount, apiTagPsd2, apiTagOldStyle)) @@ -1009,7 +1009,7 @@ trait APIMethods200 { |${authenticationRequiredMessage(true)} if the 'is_public' field in view (VIEW_ID) is not set to `true`. | |""".stripMargin, - emptyObjectJson, + EmptyBody, moderatedAccountJSON, List(BankNotFound,AccountNotFound,ViewNotFound, UserNoPermissionAccessView, UnknownError), apiTagAccount :: apiTagOldStyle :: Nil) @@ -1046,7 +1046,7 @@ trait APIMethods200 { |and the user needs to have access to the owner view. | |""", - emptyObjectJson, + EmptyBody, permissionsJSON, List(UserNotLoggedIn, BankNotFound, AccountNotFound ,UnknownError), List(apiTagView, apiTagAccount, apiTagUser, apiTagEntitlement) @@ -1088,7 +1088,7 @@ trait APIMethods200 { |${authenticationRequiredMessage(true)} | |The user needs to have access to the owner view.""", - emptyObjectJson, + EmptyBody, viewsJSONV121, List(UserNotLoggedIn,BankNotFound, AccountNotFound,UnknownError), List(apiTagView, apiTagAccount, apiTagUser, apiTagOldStyle)) @@ -1266,7 +1266,7 @@ trait APIMethods200 { | * charge : The charge to the customer for each one of these | |${authenticationRequiredMessage(!getTransactionTypesIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, transactionTypesJsonV200, List(BankNotFound, UnknownError), List(apiTagBank, apiTagPSD2AIS, apiTagPsd2) @@ -1340,7 +1340,7 @@ trait APIMethods200 { | |""".stripMargin, transactionRequestBodyJsonV200, - emptyObjectJson, + transactionRequestWithChargesJson, List( UserNotLoggedIn, InvalidJsonFormat, @@ -1517,7 +1517,7 @@ trait APIMethods200 { |The customer can proceed with the Transaction by answering the security challenge. | """.stripMargin, - emptyObjectJson, + EmptyBody, transactionRequestWithChargesJson, List(UserNotLoggedIn, BankNotFound, AccountNotFound, UserNoPermissionAccessView, UnknownError), List(apiTagTransactionRequest, apiTagPsd2, apiTagOldStyle)) @@ -1695,7 +1695,7 @@ trait APIMethods200 { // | // |This call is **experimental** and will require further authorisation in the future. // """.stripMargin, -// emptyObjectJson, +// EmptyBody, // meetingsJson, // List( // UserNotLoggedIn, @@ -1750,7 +1750,7 @@ trait APIMethods200 { // | // |This call is **experimental** and will require further authorisation in the future. // """.stripMargin, -// emptyObjectJson, +// EmptyBody, // meetingJson, // List( // UserNotLoggedIn, @@ -1887,7 +1887,7 @@ trait APIMethods200 { | |Login is required. """.stripMargin, - emptyObjectJson, + EmptyBody, userJsonV200, List(UserNotLoggedIn, UnknownError), List(apiTagUser, apiTagOldStyle)) @@ -1921,7 +1921,7 @@ trait APIMethods200 { |CanGetAnyUser entitlement is required, | """.stripMargin, - emptyObjectJson, + EmptyBody, usersJsonV200, List(UserNotLoggedIn, UserHasMissingRoles, UserNotFoundByEmail, UnknownError), List(apiTagUser, apiTagOldStyle), @@ -2102,7 +2102,7 @@ trait APIMethods200 { | | """.stripMargin, - emptyObjectJson, + EmptyBody, entitlementJSONs, List(UserNotLoggedIn, UserHasMissingRoles, UnknownError), List(apiTagRole, apiTagEntitlement, apiTagUser, apiTagOldStyle), @@ -2147,8 +2147,8 @@ trait APIMethods200 { | | """.stripMargin, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, UserHasMissingRoles, EntitlementNotFound, UnknownError), List(apiTagRole, apiTagUser, apiTagEntitlement)) @@ -2185,7 +2185,7 @@ trait APIMethods200 { | | """.stripMargin, - emptyObjectJson, + EmptyBody, entitlementJSONs, List(UserNotLoggedIn, UnknownError), List(apiTagRole, apiTagEntitlement)) @@ -2279,8 +2279,8 @@ trait APIMethods200 { |You can specify the esType thus: /search/warehouse/esType=type&q=a | """, - emptyObjectJson, - emptyObjectJson, //TODO what is output here? + EmptyBody, + emptyElasticSearch, //TODO what is output here? List(UserNotLoggedIn, BankNotFound, UserHasMissingRoles, UnknownError), List(apiTagSearchWarehouse, apiTagOldStyle), Some(List(canSearchWarehouse))) @@ -2365,8 +2365,8 @@ trait APIMethods200 { | | """, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + emptyElasticSearch, List(UserNotLoggedIn, UserHasMissingRoles, UnknownError), List(apiTagMetric, apiTagApi, apiTagOldStyle), Some(List(canSearchMetrics))) @@ -2395,7 +2395,7 @@ trait APIMethods200 { """Information about the currently authenticated user. | |Authentication via OAuth is required.""", - emptyObjectJson, + EmptyBody, customersJsonV140, List(UserNotLoggedIn, UserCustomerLinksNotFoundForUser, UnknownError), List(apiTagPerson, apiTagCustomer, apiTagOldStyle)) diff --git a/obp-api/src/main/scala/code/api/v2_1_0/APIMethods210.scala b/obp-api/src/main/scala/code/api/v2_1_0/APIMethods210.scala index af85c7a96b..a4ae0ccfab 100644 --- a/obp-api/src/main/scala/code/api/v2_1_0/APIMethods210.scala +++ b/obp-api/src/main/scala/code/api/v2_1_0/APIMethods210.scala @@ -72,7 +72,7 @@ trait APIMethods210 { val resourceDocs = ArrayBuffer[ResourceDoc]() val apiRelations = ArrayBuffer[ApiRelation]() - val emptyObjectJson = EmptyClassJson() + val apiVersion = ApiVersion.v2_1_0 // was String "2_1_0" val codeContext = CodeContext(resourceDocs, apiRelations) @@ -90,7 +90,7 @@ trait APIMethods210 { |* API version |* Hosted by information |* Git Commit""", - emptyObjectJson, + EmptyBody, apiInfoJSON, List(UnknownError, "no connector set"), apiTagApi :: Nil) @@ -177,7 +177,7 @@ trait APIMethods210 { | |${authenticationRequiredMessage(!getTransactionRequestTypesIsPublic)} |""", - emptyObjectJson, + EmptyBody, transactionRequestTypesJSON, List(UserNotLoggedIn, UnknownError), List(apiTagTransactionRequest, apiTagBank)) @@ -734,7 +734,7 @@ trait APIMethods210 { |The customer can proceed with the Transaction by answering the security challenge. | """.stripMargin, - emptyObjectJson, + EmptyBody, transactionRequestWithChargeJSONs210, List( UserNotLoggedIn, @@ -781,7 +781,7 @@ trait APIMethods210 { | |${authenticationRequiredMessage(true)} """.stripMargin, - emptyObjectJson, + EmptyBody, availableRolesJSON, List(UserNotLoggedIn, UnknownError), List(apiTagRole)) @@ -815,7 +815,7 @@ trait APIMethods210 { | | """.stripMargin, - emptyObjectJson, + EmptyBody, entitlementJSONs, List( UserNotLoggedIn, @@ -866,7 +866,7 @@ trait APIMethods210 { s"""Get the Consumer specified by CONSUMER_ID. | |""", - emptyObjectJson, + EmptyBody, consumerJSON, List( UserNotLoggedIn, @@ -905,7 +905,7 @@ trait APIMethods210 { s"""Get the all Consumers. | |""", - emptyObjectJson, + EmptyBody, consumersJson, List( UserNotLoggedIn, @@ -1072,7 +1072,7 @@ trait APIMethods210 { |* locked_status (if null ignore) | """.stripMargin, - emptyObjectJson, + EmptyBody, usersJsonV200, List( UserNotLoggedIn, @@ -1166,7 +1166,7 @@ trait APIMethods210 { |* License the data under this endpoint is released under | |${authenticationRequiredMessage(!getAtmsIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, atmJson, List(UserNotLoggedIn, BankNotFound, AtmNotFoundByAtmId, UnknownError), List(apiTagATM, apiTagOldStyle) @@ -1211,7 +1211,7 @@ trait APIMethods210 { |* License the data under this endpoint is released under | |${authenticationRequiredMessage(!getBranchesIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, branchJson, List( UserNotLoggedIn, @@ -1262,7 +1262,7 @@ trait APIMethods210 { |* Terms and Conditions |* License the data under this endpoint is released under |${authenticationRequiredMessage(!getProductsIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, productJsonV210, List( UserNotLoggedIn, @@ -1312,7 +1312,7 @@ trait APIMethods210 { |* Terms and Conditions |* License the data under this endpoint is released under |${authenticationRequiredMessage(!getProductsIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, productsJsonV210, List( UserNotLoggedIn, @@ -1443,7 +1443,7 @@ trait APIMethods210 { """Gets all Customers that are linked to a User. | |Authentication via OAuth is required.""", - emptyObjectJson, + EmptyBody, customerJsonV210, List( UserNotLoggedIn, @@ -1477,7 +1477,7 @@ trait APIMethods210 { | | |${authenticationRequiredMessage(true)}""".stripMargin, - emptyObjectJson, + EmptyBody, customerJSONs, List( UserNotLoggedIn, @@ -1711,7 +1711,7 @@ trait APIMethods210 { |16 duration (if null ignore) non digit chars will be silently omitted | """.stripMargin, - emptyObjectJson, + EmptyBody, metricsJson, List( UserNotLoggedIn, diff --git a/obp-api/src/main/scala/code/api/v2_2_0/APIMethods220.scala b/obp-api/src/main/scala/code/api/v2_2_0/APIMethods220.scala index d2fc23e924..3ebdd49db3 100644 --- a/obp-api/src/main/scala/code/api/v2_2_0/APIMethods220.scala +++ b/obp-api/src/main/scala/code/api/v2_2_0/APIMethods220.scala @@ -51,7 +51,7 @@ trait APIMethods220 { val resourceDocs = ArrayBuffer[ResourceDoc]() val apiRelations = ArrayBuffer[ApiRelation]() - val emptyObjectJson = EmptyClassJson() + val implementedInApiVersion = ApiVersion.v2_2_0 val codeContext = CodeContext(resourceDocs, apiRelations) @@ -69,7 +69,7 @@ trait APIMethods220 { |* API version |* Hosted by information |* Git Commit""", - emptyObjectJson, + EmptyBody, apiInfoJSON, List(UnknownError, "no connector set"), apiTagApi :: Nil) @@ -119,7 +119,7 @@ trait APIMethods220 { |Returns the list of the views created for account ACCOUNT_ID at BANK_ID. | |${authenticationRequiredMessage(true)} and the user needs to have access to the owner view.""", - emptyObjectJson, + EmptyBody, viewsJSONV220, List( UserNotLoggedIn, @@ -303,7 +303,7 @@ trait APIMethods220 { |![FX Flow](https://user-images.githubusercontent.com/485218/60005085-1eded600-966e-11e9-96fb-798b102d9ad0.png) | """.stripMargin, - emptyObjectJson, + EmptyBody, fXRateJSON, List(InvalidISOCurrencyCode,UserNotLoggedIn,FXCurrencyCodeCombinationsNotSupported, UnknownError), List(apiTagFx)) @@ -346,7 +346,7 @@ trait APIMethods220 { | |${authenticationRequiredMessage(true)} |""".stripMargin, - emptyObjectJson, + EmptyBody, counterpartiesJsonV220, List( UserNotLoggedIn, @@ -402,7 +402,7 @@ trait APIMethods220 { | |${authenticationRequiredMessage(true)} |""".stripMargin, - emptyObjectJson, + EmptyBody, counterpartyWithMetadataJson, List(UserNotLoggedIn, BankNotFound, UnknownError), List(apiTagCounterparty, apiTagPSD2PIS, apiTagCounterpartyMetaData, apiTagPsd2) @@ -441,7 +441,7 @@ trait APIMethods220 { | | `CONNECTOR`: kafka_vSept2018, stored_procedure_vDec2019 ... """.stripMargin, - emptyObjectJson, + EmptyBody, messageDocsJson, List(InvalidConnector, UnknownError), List(apiTagDocumentation, apiTagApi) @@ -905,7 +905,7 @@ trait APIMethods220 { |* Akka ports |* Elastic search ports |* Cached function """, - emptyObjectJson, + EmptyBody, configurationJSON, List( UserNotLoggedIn, @@ -964,7 +964,7 @@ trait APIMethods220 { |7 correlation_id (if null ignore) | """.stripMargin, - emptyObjectJson, + EmptyBody, connectorMetricsJson, List( InvalidDateFormat, @@ -1254,7 +1254,7 @@ trait APIMethods220 { |* View: view_id | |${authenticationRequiredMessage(true)}""".stripMargin, - emptyObjectJson, + EmptyBody, customerViewsJsonV220, List( UserNotLoggedIn, diff --git a/obp-api/src/main/scala/code/api/v3_0_0/APIMethods300.scala b/obp-api/src/main/scala/code/api/v3_0_0/APIMethods300.scala index 0cc72bb052..c1cc6b1994 100644 --- a/obp-api/src/main/scala/code/api/v3_0_0/APIMethods300.scala +++ b/obp-api/src/main/scala/code/api/v3_0_0/APIMethods300.scala @@ -80,7 +80,7 @@ trait APIMethods300 { |* API version |* Hosted by information |* Git Commit""", - emptyObjectJson, + EmptyBody, apiInfoJSON, List(UnknownError, "no connector set"), apiTagApi :: Nil) @@ -828,7 +828,7 @@ trait APIMethods300 { | """, elasticSearchJsonV300, - emptyObjectJson, //TODO what is output here? + emptyElasticSearch, //TODO what is output here? List(UserNotLoggedIn, UserHasMissingRoles, UnknownError), List(apiTagSearchWarehouse), Some(List(canSearchWarehouse))) @@ -907,7 +907,7 @@ trait APIMethods300 { | """, elasticSearchJsonV300, - emptyObjectJson, //TODO what is output here? + emptyElasticSearch, //TODO what is output here? List(UserNotLoggedIn, UserHasMissingRoles, UnknownError), List(apiTagSearchWarehouse), Some(List(canSearchWarehouseStatistics)) diff --git a/obp-api/src/main/scala/code/api/v3_1_0/APIMethods310.scala b/obp-api/src/main/scala/code/api/v3_1_0/APIMethods310.scala index cebd32e1fc..a4f827843b 100644 --- a/obp-api/src/main/scala/code/api/v3_1_0/APIMethods310.scala +++ b/obp-api/src/main/scala/code/api/v3_1_0/APIMethods310.scala @@ -8,7 +8,7 @@ import java.util.UUID import java.util.regex.Pattern import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._ import code.api.ResourceDocs1_4_0.{MessageDocsSwaggerDefinitions, ResourceDocsAPIMethodsUtil, SwaggerDefinitionsJSON, SwaggerJSONFactory} -import code.api.cache.Redis +import code.api.cache.{Caching, Redis} import code.api.util.APIUtil.{getWebUIPropsPairs, _} import code.api.util.ApiRole._ import code.api.util.ApiTag._ @@ -19,6 +19,7 @@ import code.api.util.NewStyle.HttpCode import code.api.util._ import code.api.util.newstyle.BalanceNewStyle import code.api.v1_2_1.{JSONFactory, RateLimiting} +import code.api.v1_4_0.JSONFactory1_4_0 import code.api.v2_0_0.CreateMeetingJson import code.api.v2_1_0._ import code.api.v2_2_0.{CreateAccountJSONV220, JSONFactory220} @@ -64,6 +65,8 @@ import scala.collection.immutable.{List, Nil} import scala.collection.mutable.ArrayBuffer import com.openbankproject.commons.ExecutionContext.Implicits.global import com.openbankproject.commons.dto.GetProductsParam +import net.liftweb.json +import net.liftweb.json.JsonAST.JValue import scala.concurrent.Future import scala.util.Random @@ -96,7 +99,7 @@ trait APIMethods310 { |* API version |* Hosted by information |* Git Commit""", - emptyObjectJson, + EmptyBody, apiInfoJSON, List(UnknownError, "no connector set"), apiTagApi :: Nil) @@ -3186,7 +3189,7 @@ trait APIMethods310 { | """.stripMargin, EmptyBody, - messageDocsJson, + EmptyBody, List(UnknownError), List(apiTagDocumentation, apiTagApi) ) @@ -3198,15 +3201,40 @@ trait APIMethods310 { implicit val ec = EndpointContext(Some(cc)) for { (_, callContext) <- anonymousAccess(cc) - messageDocsSwagger = RestConnector_vMar2019.messageDocs.map(toResourceDoc).toList - resourceDocListFiltered = ResourceDocsAPIMethodsUtil.filterResourceDocs(messageDocsSwagger, resourceDocTags, partialFunctions) - json <- Future {SwaggerJSONFactory.createSwaggerResourceDoc(resourceDocListFiltered, ApiVersion.v3_1_0)} - //For this connector swagger, it share some basic fields with api swagger, eg: BankId, AccountId. So it need to merge here. + convertedToResourceDocs = RestConnector_vMar2019.messageDocs.map(toResourceDoc).toList + resourceDocListFiltered = ResourceDocsAPIMethodsUtil.filterResourceDocs(convertedToResourceDocs, resourceDocTags, partialFunctions) + resourceDocJsonList = JSONFactory1_4_0.createResourceDocsJson(resourceDocListFiltered, true, None).resource_docs + swaggerResourceDoc <- Future {SwaggerJSONFactory.createSwaggerResourceDoc(resourceDocJsonList, ApiVersion.v3_1_0)} + //For this connector swagger, it shares some basic fields with api swagger, eg: BankId, AccountId. So it need to merge here. allSwaggerDefinitionCaseClasses = MessageDocsSwaggerDefinitions.allFields++SwaggerDefinitionsJSON.allFields - jsonAST <- Future{SwaggerJSONFactory.loadDefinitions(resourceDocListFiltered, allSwaggerDefinitionCaseClasses)} + + + cacheKey = APIUtil.createResourceDocCacheKey( + None, + restConnectorVersion, + resourceDocTags, + partialFunctions, + locale, + contentParam, + apiCollectionIdParam, + None + ) + swaggerJValue <- NewStyle.function.tryons(s"$UnknownError Can not convert internal swagger file.", 400, cc.callContext) { + val cacheValueFromRedis = Caching.getStaticSwaggerDocCache(cacheKey) + if (cacheValueFromRedis.isDefined) { + json.parse(cacheValueFromRedis.get) + } else { + val jsonAST = SwaggerJSONFactory.loadDefinitions(resourceDocJsonList, allSwaggerDefinitionCaseClasses) + val swaggerDocJsonJValue = Extraction.decompose(swaggerResourceDoc) merge jsonAST + val jsonString = json.compactRender(swaggerDocJsonJValue) + Caching.setStaticSwaggerDocCache(cacheKey, jsonString) + swaggerDocJsonJValue + } + } + } yield { // Merge both results and return - (Extraction.decompose(json) merge jsonAST, HttpCode.`200`(callContext)) + (swaggerJValue, HttpCode.`200`(callContext)) } } } diff --git a/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala b/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala index 66214c2870..9e131c48ff 100644 --- a/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala +++ b/obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala @@ -673,7 +673,7 @@ trait APIMethods510 { """Get Currencies specified by BANK_ID | """.stripMargin, - emptyObjectJson, + EmptyBody, currenciesJsonV510, List( $UserNotLoggedIn, @@ -1534,7 +1534,7 @@ trait APIMethods510 { |16 duration (if null ignore) non digit chars will be silently omitted | """.stripMargin, - emptyObjectJson, + EmptyBody, metricsJsonV510, List( UserNotLoggedIn, diff --git a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala index 187e1f8bde..105ab0ee8f 100644 --- a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala +++ b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala @@ -96,7 +96,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable //---------------- dynamic start -------------------please don't modify this line -// ---------- created on 2024-01-29T13:59:34Z +// ---------- created on 2024-09-30T23:50:52Z messageDocs += getAdapterInfoDoc def getAdapterInfoDoc = MessageDoc( @@ -319,7 +319,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable OutBoundCreateChallenges(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, bankId=BankId(bankIdExample.value), accountId=AccountId(accountIdExample.value), - userIds=listExample.value.split("[,;]").toList, + userIds=listExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList, transactionRequestType=TransactionRequestType(transactionRequestTypeExample.value), transactionRequestId=transactionRequestIdExample.value, scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS)) @@ -327,7 +327,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable exampleInboundMessage = ( InBoundCreateChallenges(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, status=MessageDocsSwaggerDefinitions.inboundStatus, - data=listExample.value.split("[,;]").toList) + data=listExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -348,7 +348,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable inboundTopic = None, exampleOutboundMessage = ( OutBoundCreateChallengesC2(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - userIds=listExample.value.split("[,;]").toList, + userIds=listExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList, challengeType=com.openbankproject.commons.model.enums.ChallengeType.example, transactionRequestId=Some(transactionRequestIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), @@ -392,7 +392,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable inboundTopic = None, exampleOutboundMessage = ( OutBoundCreateChallengesC3(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, - userIds=listExample.value.split("[,;]").toList, + userIds=listExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList, challengeType=com.openbankproject.commons.model.enums.ChallengeType.example, transactionRequestId=Some(transactionRequestIdExample.value), scaMethod=Some(com.openbankproject.commons.model.enums.StrongCustomerAuthentication.SMS), @@ -741,8 +741,8 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable accountType=accountTypeExample.value, balanceAmount=balanceAmountExample.value, balanceCurrency=balanceCurrencyExample.value, - owners=inboundAccountOwnersExample.value.split("[,;]").toList, - viewsToGenerate=inboundAccountViewsToGenerateExample.value.split("[,;]").toList, + owners=inboundAccountOwnersExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList, + viewsToGenerate=inboundAccountViewsToGenerateExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList, bankRoutingScheme=bankRoutingSchemeExample.value, bankRoutingAddress=bankRoutingAddressExample.value, branchRoutingScheme=branchRoutingSchemeExample.value, @@ -1643,7 +1643,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable cancelled=cancelledExample.value.toBoolean, onHotList=onHotListExample.value.toBoolean, technology=technologyExample.value, - networks=networksExample.value.split("[,;]").toList, + networks=networksExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList, allows=List(com.openbankproject.commons.model.CardAction.DEBIT), account= BankAccountCommons(accountId=AccountId(accountIdExample.value), accountType=accountTypeExample.value, @@ -1711,7 +1711,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable cancelled=cancelledExample.value.toBoolean, onHotList=onHotListExample.value.toBoolean, technology=technologyExample.value, - networks=networksExample.value.split("[,;]").toList, + networks=networksExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList, allows=List(com.openbankproject.commons.model.CardAction.DEBIT), account= BankAccountCommons(accountId=AccountId(accountIdExample.value), accountType=accountTypeExample.value, @@ -1827,7 +1827,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable cancelled=cancelledExample.value.toBoolean, onHotList=onHotListExample.value.toBoolean, technology=technologyExample.value, - networks=networksExample.value.split("[,;]").toList, + networks=networksExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList, allows=List(com.openbankproject.commons.model.CardAction.DEBIT), account= BankAccountCommons(accountId=AccountId(accountIdExample.value), accountType=accountTypeExample.value, @@ -1887,8 +1887,8 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable cancelled=cancelledExample.value.toBoolean, onHotList=onHotListExample.value.toBoolean, technology=technologyExample.value, - networks=networksExample.value.split("[,;]").toList, - allows=allowsExample.value.split("[,;]").toList, + networks=networksExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList, + allows=allowsExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList, accountId=accountIdExample.value, bankId=bankIdExample.value, replacement=Some( CardReplacementInfo(requestedDate=toDate(requestedDateExample), @@ -1917,7 +1917,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable cancelled=cancelledExample.value.toBoolean, onHotList=onHotListExample.value.toBoolean, technology=technologyExample.value, - networks=networksExample.value.split("[,;]").toList, + networks=networksExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList, allows=List(com.openbankproject.commons.model.CardAction.DEBIT), account= BankAccountCommons(accountId=AccountId(accountIdExample.value), accountType=accountTypeExample.value, @@ -1978,8 +1978,8 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable cancelled=cancelledExample.value.toBoolean, onHotList=onHotListExample.value.toBoolean, technology=technologyExample.value, - networks=networksExample.value.split("[,;]").toList, - allows=allowsExample.value.split("[,;]").toList, + networks=networksExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList, + allows=allowsExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList, accountId=accountIdExample.value, bankId=bankIdExample.value, replacement=Some( CardReplacementInfo(requestedDate=toDate(requestedDateExample), @@ -2006,7 +2006,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable cancelled=cancelledExample.value.toBoolean, onHotList=onHotListExample.value.toBoolean, technology=technologyExample.value, - networks=networksExample.value.split("[,;]").toList, + networks=networksExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList, allows=List(com.openbankproject.commons.model.CardAction.DEBIT), account= BankAccountCommons(accountId=AccountId(accountIdExample.value), accountType=accountTypeExample.value, @@ -2256,7 +2256,12 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable other_bank_routing_scheme="string", other_bank_routing_address="string", is_beneficiary=true, - future_date=Some("string"))) + future_date=Some("string"), + payment_start_date=Some(toDate(dateExample)), + payment_end_date=Some(toDate(dateExample)), + payment_execution_Rule=Some("string"), + payment_frequency=Some("string"), + payment_day_of_execution=Some("string"))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -2414,7 +2419,12 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable other_bank_routing_scheme="string", other_bank_routing_address="string", is_beneficiary=true, - future_date=Some("string"))) + future_date=Some("string"), + payment_start_date=Some(toDate(dateExample)), + payment_end_date=Some(toDate(dateExample)), + payment_execution_Rule=Some("string"), + payment_frequency=Some("string"), + payment_day_of_execution=Some("string"))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -2540,7 +2550,12 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable other_bank_routing_scheme="string", other_bank_routing_address="string", is_beneficiary=true, - future_date=Some("string")))) + future_date=Some("string"), + payment_start_date=Some(toDate(dateExample)), + payment_end_date=Some(toDate(dateExample)), + payment_execution_Rule=Some("string"), + payment_frequency=Some("string"), + payment_day_of_execution=Some("string")))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -2639,7 +2654,12 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable other_bank_routing_scheme="string", other_bank_routing_address="string", is_beneficiary=true, - future_date=Some("string"))) + future_date=Some("string"), + payment_start_date=Some(toDate(dateExample)), + payment_end_date=Some(toDate(dateExample)), + payment_execution_Rule=Some("string"), + payment_frequency=Some("string"), + payment_day_of_execution=Some("string"))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -2751,7 +2771,12 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable other_bank_routing_scheme="string", other_bank_routing_address="string", is_beneficiary=true, - future_date=Some("string"))) + future_date=Some("string"), + payment_start_date=Some(toDate(dateExample)), + payment_end_date=Some(toDate(dateExample)), + payment_execution_Rule=Some("string"), + payment_frequency=Some("string"), + payment_day_of_execution=Some("string"))) ), exampleInboundMessage = ( InBoundCreateTransactionAfterChallengeV210(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, @@ -2829,7 +2854,12 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable other_bank_routing_scheme="string", other_bank_routing_address="string", is_beneficiary=true, - future_date=Some("string"))) + future_date=Some("string"), + payment_start_date=Some(toDate(dateExample)), + payment_end_date=Some(toDate(dateExample)), + payment_execution_Rule=Some("string"), + payment_frequency=Some("string"), + payment_day_of_execution=Some("string"))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -2978,7 +3008,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable exampleOutboundMessage = ( OutBoundGetProducts(bankId=BankId(bankIdExample.value), params=List( GetProductsParam(name=nameExample.value, - value=valueExample.value.split("[,;]").toList))) + value=valueExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList))) ), exampleInboundMessage = ( InBoundGetProducts(status=MessageDocsSwaggerDefinitions.inboundStatus, @@ -3266,12 +3296,12 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable locatedAt=Some(locatedAtExample.value), moreInfo=Some(moreInfoExample.value), hasDepositCapability=Some(hasDepositCapabilityExample.value.toBoolean), - supportedLanguages=Some(supportedLanguagesExample.value.split("[,;]").toList), - services=Some(listExample.value.split("[,;]").toList), - accessibilityFeatures=Some(accessibilityFeaturesExample.value.split("[,;]").toList), - supportedCurrencies=Some(supportedCurrenciesExample.value.split("[,;]").toList), - notes=Some(listExample.value.split("[,;]").toList), - locationCategories=Some(listExample.value.split("[,;]").toList), + supportedLanguages=Some(supportedLanguagesExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList), + services=Some(listExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList), + accessibilityFeatures=Some(accessibilityFeaturesExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList), + supportedCurrencies=Some(supportedCurrenciesExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList), + notes=Some(listExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList), + locationCategories=Some(listExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList), minimumWithdrawal=Some("string"), branchIdentification=Some("string"), siteIdentification=Some(siteIdentification.value), @@ -3347,12 +3377,12 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable locatedAt=Some(locatedAtExample.value), moreInfo=Some(moreInfoExample.value), hasDepositCapability=Some(hasDepositCapabilityExample.value.toBoolean), - supportedLanguages=Some(supportedLanguagesExample.value.split("[,;]").toList), - services=Some(listExample.value.split("[,;]").toList), - accessibilityFeatures=Some(accessibilityFeaturesExample.value.split("[,;]").toList), - supportedCurrencies=Some(supportedCurrenciesExample.value.split("[,;]").toList), - notes=Some(listExample.value.split("[,;]").toList), - locationCategories=Some(listExample.value.split("[,;]").toList), + supportedLanguages=Some(supportedLanguagesExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList), + services=Some(listExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList), + accessibilityFeatures=Some(accessibilityFeaturesExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList), + supportedCurrencies=Some(supportedCurrenciesExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList), + notes=Some(listExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList), + locationCategories=Some(listExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList), minimumWithdrawal=Some("string"), branchIdentification=Some("string"), siteIdentification=Some(siteIdentification.value), @@ -3521,7 +3551,12 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable other_bank_routing_scheme="string", other_bank_routing_address="string", is_beneficiary=true, - future_date=Some("string"))) + future_date=Some("string"), + payment_start_date=Some(toDate(dateExample)), + payment_end_date=Some(toDate(dateExample)), + payment_execution_Rule=Some("string"), + payment_frequency=Some("string"), + payment_day_of_execution=Some("string"))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -3786,7 +3821,12 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable other_bank_routing_scheme="string", other_bank_routing_address="string", is_beneficiary=true, - future_date=Some("string"))) + future_date=Some("string"), + payment_start_date=Some(toDate(dateExample)), + payment_end_date=Some(toDate(dateExample)), + payment_execution_Rule=Some("string"), + payment_frequency=Some("string"), + payment_day_of_execution=Some("string"))) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -3880,7 +3920,12 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable other_bank_routing_scheme="string", other_bank_routing_address="string", is_beneficiary=true, - future_date=Some("string")), + future_date=Some("string"), + payment_start_date=Some(toDate(dateExample)), + payment_end_date=Some(toDate(dateExample)), + payment_execution_Rule=Some("string"), + payment_frequency=Some("string"), + payment_day_of_execution=Some("string")), reasons=Some(List( TransactionRequestReason(code=codeExample.value, documentNumber=Some(documentNumberExample.value), amount=Some(amountExample.value), @@ -4035,7 +4080,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable dateOfBirth=toDate(dateOfBirthExample), relationshipStatus=relationshipStatusExample.value, dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.split("[,;]").map(parseDate).flatMap(_.toSeq).toList, + dobOfDependents=dobOfDependentsExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").map(parseDate).flatMap(_.toSeq).toList, highestEducationAttained=highestEducationAttainedExample.value, employmentStatus=employmentStatusExample.value, kycStatus=kycStatusExample.value.toBoolean, @@ -4062,7 +4107,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable dateOfBirth=toDate(dateOfBirthExample), relationshipStatus=relationshipStatusExample.value, dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.split("[,;]").map(parseDate).flatMap(_.toSeq).toList, + dobOfDependents=dobOfDependentsExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").map(parseDate).flatMap(_.toSeq).toList, highestEducationAttained=highestEducationAttainedExample.value, employmentStatus=employmentStatusExample.value, creditRating= CreditRating(rating=ratingExample.value, @@ -4113,7 +4158,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable dateOfBirth=toDate(dateOfBirthExample), relationshipStatus=relationshipStatusExample.value, dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.split("[,;]").map(parseDate).flatMap(_.toSeq).toList, + dobOfDependents=dobOfDependentsExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").map(parseDate).flatMap(_.toSeq).toList, highestEducationAttained=highestEducationAttainedExample.value, employmentStatus=employmentStatusExample.value, creditRating= CreditRating(rating=ratingExample.value, @@ -4165,7 +4210,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable dateOfBirth=toDate(dateOfBirthExample), relationshipStatus=relationshipStatusExample.value, dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.split("[,;]").map(parseDate).flatMap(_.toSeq).toList, + dobOfDependents=dobOfDependentsExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").map(parseDate).flatMap(_.toSeq).toList, highestEducationAttained=highestEducationAttainedExample.value, employmentStatus=employmentStatusExample.value, creditRating= CreditRating(rating=ratingExample.value, @@ -4224,7 +4269,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable dateOfBirth=toDate(dateOfBirthExample), relationshipStatus=relationshipStatusExample.value, dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.split("[,;]").map(parseDate).flatMap(_.toSeq).toList, + dobOfDependents=dobOfDependentsExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").map(parseDate).flatMap(_.toSeq).toList, highestEducationAttained=highestEducationAttainedExample.value, employmentStatus=employmentStatusExample.value, creditRating= CreditRating(rating=ratingExample.value, @@ -4272,7 +4317,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable dateOfBirth=toDate(dateOfBirthExample), relationshipStatus=relationshipStatusExample.value, dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.split("[,;]").map(parseDate).flatMap(_.toSeq).toList, + dobOfDependents=dobOfDependentsExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").map(parseDate).flatMap(_.toSeq).toList, highestEducationAttained=highestEducationAttainedExample.value, employmentStatus=employmentStatusExample.value, creditRating= CreditRating(rating=ratingExample.value, @@ -4320,7 +4365,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable dateOfBirth=toDate(dateOfBirthExample), relationshipStatus=relationshipStatusExample.value, dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.split("[,;]").map(parseDate).flatMap(_.toSeq).toList, + dobOfDependents=dobOfDependentsExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").map(parseDate).flatMap(_.toSeq).toList, highestEducationAttained=highestEducationAttainedExample.value, employmentStatus=employmentStatusExample.value, creditRating= CreditRating(rating=ratingExample.value, @@ -4369,7 +4414,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable dateOfBirth=toDate(dateOfBirthExample), relationshipStatus=relationshipStatusExample.value, dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.split("[,;]").map(parseDate).flatMap(_.toSeq).toList, + dobOfDependents=dobOfDependentsExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").map(parseDate).flatMap(_.toSeq).toList, highestEducationAttained=highestEducationAttainedExample.value, employmentStatus=employmentStatusExample.value, creditRating= CreditRating(rating=ratingExample.value, @@ -4667,7 +4712,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable dateOfBirth=toDate(dateOfBirthExample), relationshipStatus=relationshipStatusExample.value, dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.split("[,;]").map(parseDate).flatMap(_.toSeq).toList, + dobOfDependents=dobOfDependentsExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").map(parseDate).flatMap(_.toSeq).toList, highestEducationAttained=highestEducationAttainedExample.value, employmentStatus=employmentStatusExample.value, creditRating= CreditRating(rating=ratingExample.value, @@ -4716,7 +4761,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable dateOfBirth=toDate(dateOfBirthExample), relationshipStatus=relationshipStatusExample.value, dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.split("[,;]").map(parseDate).flatMap(_.toSeq).toList, + dobOfDependents=dobOfDependentsExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").map(parseDate).flatMap(_.toSeq).toList, highestEducationAttained=highestEducationAttainedExample.value, employmentStatus=employmentStatusExample.value, creditRating= CreditRating(rating=ratingExample.value, @@ -5387,7 +5432,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable exampleInboundMessage = ( InBoundGetCustomerIdsByAttributeNameValues(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, status=MessageDocsSwaggerDefinitions.inboundStatus, - data=listExample.value.split("[,;]").toList) + data=listExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -5419,7 +5464,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable dateOfBirth=toDate(dateOfBirthExample), relationshipStatus=relationshipStatusExample.value, dependents=dependentsExample.value.toInt, - dobOfDependents=dobOfDependentsExample.value.split("[,;]").map(parseDate).flatMap(_.toSeq).toList, + dobOfDependents=dobOfDependentsExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").map(parseDate).flatMap(_.toSeq).toList, highestEducationAttained=highestEducationAttainedExample.value, employmentStatus=employmentStatusExample.value, creditRating= CreditRating(rating=ratingExample.value, @@ -5468,7 +5513,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable exampleInboundMessage = ( InBoundGetTransactionIdsByAttributeNameValues(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, status=MessageDocsSwaggerDefinitions.inboundStatus, - data=listExample.value.split("[,;]").toList) + data=listExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList) ), adapterImplementation = Some(AdapterImplementation("- Core", 1)) ) @@ -5777,7 +5822,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable exampleOutboundMessage = ( OutBoundGetOrCreateProductCollection(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, collectionCode=collectionCodeExample.value, - productCodes=listExample.value.split("[,;]").toList) + productCodes=listExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList) ), exampleInboundMessage = ( InBoundGetOrCreateProductCollection(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, @@ -5832,7 +5877,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable exampleOutboundMessage = ( OutBoundGetOrCreateProductCollectionItem(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext, collectionCode=collectionCodeExample.value, - memberProductCodes=listExample.value.split("[,;]").toList) + memberProductCodes=listExample.value.replaceAll("\\[","").replaceAll("\\]","").split(",").toList) ), exampleInboundMessage = ( InBoundGetOrCreateProductCollectionItem(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext, @@ -6581,10 +6626,10 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable response.map(convertToTuple[Boolean](callContext)) } -// ---------- created on 2024-01-29T13:59:34Z -//---------------- dynamic end ---------------------please don't modify this line +// ---------- created on 2024-09-30T23:50:52Z +//---------------- dynamic end ---------------------please don't modify this line - private val availableOperation = DynamicEntityOperation.values.map(it => s""""$it"""").mkString("[", ", ", "]") + private val availableOperation = DynamicEntityOperation.values.map(it => s""""$it"""").mkString("\\[", ", ", "\\]") messageDocs += dynamicEntityProcessDoc def dynamicEntityProcessDoc = MessageDoc( diff --git a/obp-api/src/test/scala/code/api/ResourceDocs1_4_0/ResourceDocsTest.scala b/obp-api/src/test/scala/code/api/ResourceDocs1_4_0/ResourceDocsTest.scala index f8382c5954..0e97b84358 100644 --- a/obp-api/src/test/scala/code/api/ResourceDocs1_4_0/ResourceDocsTest.scala +++ b/obp-api/src/test/scala/code/api/ResourceDocs1_4_0/ResourceDocsTest.scala @@ -10,7 +10,6 @@ import code.api.v1_4_0.JSONFactory1_4_0.ResourceDocsJson import code.setup.{DefaultUsers, PropsReset} import com.openbankproject.commons.util.{ApiVersion, Functions} import com.github.dwickern.macros.NameOf.nameOf -import io.swagger.parser.OpenAPIParser import net.liftweb.json import net.liftweb.json.JsonAST._ import net.liftweb.json.{Formats, JString, Serializer, TypeInfo} @@ -22,10 +21,7 @@ import scala.xml.NodeSeq class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with DefaultUsers{ object VersionOfApi extends Tag(ApiVersion.v1_4_0.toString) object ApiEndpoint1 extends Tag(nameOf(ImplementationsResourceDocs.getResourceDocsObp)) - object ApiEndpoint2 extends Tag(nameOf(ImplementationsResourceDocs.getResourceDocsSwagger)) - object ApiEndpoint3 extends Tag(nameOf(ImplementationsResourceDocs.getBankLevelDynamicResourceDocsObp)) -// object ApiEndpoint4 extends Tag(nameOf(ImplementationsResourceDocs.getStaticResourceDocsObp)) - + object ApiEndpoint2 extends Tag(nameOf(ImplementationsResourceDocs.getBankLevelDynamicResourceDocsObp)) override def beforeEach() = { super.beforeEach() @@ -365,140 +361,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with } feature(s"test ${ApiEndpoint2.name} ") { - scenario(s"We will test ${ApiEndpoint2.name} Api - v5.0.0/v5.0.0 ", ApiEndpoint2, VersionOfApi) { - val requestGetObp = (ResourceDocsV5_0Request / "resource-docs" / "v5.0.0" / "swagger").GET - val responseGetObp = makeGetRequest(requestGetObp) - And("We should get 200 and the response can be extract to case classes") - responseGetObp.code should equal(200) - val swaggerJsonString = json.compactRender(responseGetObp.body) - val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) - val errors = validatedSwaggerResult._1 - if (!errors.isEmpty) logger.info(s"Here is the wrong swagger json: $swaggerJsonString") - errors.isEmpty should be (true) - } - - scenario(s"We will test ${ApiEndpoint2.name} Api - v5.0.0/v4.0.0", ApiEndpoint2, VersionOfApi) { - val requestGetObp = (ResourceDocsV5_0Request / "resource-docs" / "v4.0.0" / "swagger").GET - val responseGetObp = makeGetRequest(requestGetObp) - And("We should get 200 and the response can be extract to case classes") - responseGetObp.code should equal(200) - val swaggerJsonString = json.compactRender(responseGetObp.body) - val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) - val errors = validatedSwaggerResult._1 - if (!errors.isEmpty) logger.info(s"Here is the wrong swagger json: $swaggerJsonString") - errors.isEmpty should be (true) - } - - scenario(s"We will test ${ApiEndpoint2.name} Api - v4.0.0", ApiEndpoint2, VersionOfApi) { - val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v4.0.0" / "swagger").GET - val responseGetObp = makeGetRequest(requestGetObp) - And("We should get 200 and the response can be extract to case classes") - responseGetObp.code should equal(200) - val swaggerJsonString = json.compactRender(responseGetObp.body) - val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) - val errors = validatedSwaggerResult._1 - if (!errors.isEmpty) logger.info(s"Here is the wrong swagger json: $swaggerJsonString") - errors.isEmpty should be (true) - } - - scenario(s"We will test ${ApiEndpoint2.name} Api - v3.1.1", ApiEndpoint2, VersionOfApi) { - val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v3.1.0" / "swagger").GET - val responseGetObp = makeGetRequest(requestGetObp) - And("We should get 200 and the response can be extract to case classes") - responseGetObp.code should equal(200) - val swaggerJsonString = json.compactRender(responseGetObp.body) - - val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) - val errors = validatedSwaggerResult._1 - errors.isEmpty should be (true) - } - - scenario(s"We will test ${ApiEndpoint2.name} Api - v3.0.0", ApiEndpoint2, VersionOfApi) { - val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v3.0.0" / "swagger").GET - val responseGetObp = makeGetRequest(requestGetObp) - And("We should get 200 and the response can be extract to case classes") - responseGetObp.code should equal(200) - val swaggerJsonString = json.compactRender(responseGetObp.body) - val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) - val errors = validatedSwaggerResult._1 - errors.isEmpty should be (true) - } - - scenario(s"We will test ${ApiEndpoint2.name} Api - v2.2.0", ApiEndpoint2, VersionOfApi) { - val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v2.2.0" / "swagger").GET - val responseGetObp = makeGetRequest(requestGetObp) - And("We should get 200 and the response can be extract to case classes") - responseGetObp.code should equal(200) - val swaggerJsonString = json.compactRender(responseGetObp.body) - - val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) - val errors = validatedSwaggerResult._1 - errors.isEmpty should be (true) - } - - scenario(s"We will test ${ApiEndpoint2.name} Api - v2.1.0", ApiEndpoint2, VersionOfApi) { - val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v2.1.0" / "swagger").GET - val responseGetObp = makeGetRequest(requestGetObp) - And("We should get 200 and the response can be extract to case classes") - responseGetObp.code should equal(200) - val swaggerJsonString = json.compactRender(responseGetObp.body) - val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) - val errors = validatedSwaggerResult._1 - errors.isEmpty should be (true) - } - - scenario(s"We will test ${ApiEndpoint2.name} Api - v2.0.0", ApiEndpoint2, VersionOfApi) { - val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v2.0.0" / "swagger").GET - val responseGetObp = makeGetRequest(requestGetObp) - And("We should get 200 and the response can be extract to case classes") - responseGetObp.code should equal(200) - val swaggerJsonString = json.compactRender(responseGetObp.body) - - val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) - val errors = validatedSwaggerResult._1 - errors.isEmpty should be (true) - } - - scenario(s"We will test ${ApiEndpoint2.name} Api - v1.4.0", ApiEndpoint2, VersionOfApi) { - val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v1.4.0" / "swagger").GET - val responseGetObp = makeGetRequest(requestGetObp) - And("We should get 200 and the response can be extract to case classes") - responseGetObp.code should equal(200) - val swaggerJsonString = json.compactRender(responseGetObp.body) - - val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) - val errors = validatedSwaggerResult._1 - errors.isEmpty should be (true) - } - - scenario(s"We will test ${ApiEndpoint2.name} Api - v1.3.0", ApiEndpoint2, VersionOfApi) { - val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v1.3.0" / "swagger").GET - val responseGetObp = makeGetRequest(requestGetObp) - And("We should get 200 and the response can be extract to case classes") - responseGetObp.code should equal(200) - val swaggerJsonString = json.compactRender(responseGetObp.body) - - val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) - val errors = validatedSwaggerResult._1 - errors.isEmpty should be (true) - } - - scenario(s"We will test ${ApiEndpoint2.name} Api - v1.2.1", ApiEndpoint2, VersionOfApi) { - val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v1.2.1" / "swagger").GET - val responseGetObp = makeGetRequest(requestGetObp) - And("We should get 200 and the response can be extract to case classes") - responseGetObp.code should equal(200) - val swaggerJsonString = json.compactRender(responseGetObp.body) - - val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) - val errors = validatedSwaggerResult._1 - errors.isEmpty should be (true) - } - - } - - feature(s"test ${ApiEndpoint3.name} ") { - scenario(s"We will test ${ApiEndpoint3.name} Api -v5.0.0/v4.0.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -v5.0.0/v4.0.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v5.0.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -508,7 +371,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -v4.0.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -v4.0.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v4.0.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -518,7 +381,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -OBPv4.0.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -OBPv4.0.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "OBPv4.0.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -528,7 +391,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -v3.1.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -v3.1.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v3.1.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -539,7 +402,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -OBPv3.1.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -OBPv3.1.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "OBPv3.1.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -549,7 +412,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -v3.0.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -v3.0.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v3.0.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -559,7 +422,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -OBPv3.0.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -OBPv3.0.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "OBPv3.0.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -569,7 +432,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -v2.2.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -v2.2.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v2.2.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -579,7 +442,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -OBPv2.2.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -OBPv2.2.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "OBPv2.2.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -589,7 +452,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -v2.1.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -v2.1.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v2.1.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -599,7 +462,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -OBPv2.1.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -OBPv2.1.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "OBPv2.1.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -609,7 +472,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -v2.0.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -v2.0.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v2.0.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -619,7 +482,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -OBPv2.0.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -OBPv2.0.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "OBPv2.0.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -629,7 +492,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -v1.4.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -v1.4.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v1.4.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -637,7 +500,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseGetObp.code should equal(200) } - scenario(s"We will test ${ApiEndpoint3.name} Api -OBPv1.4.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -OBPv1.4.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "OBPv1.4.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -647,7 +510,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -v1.3.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -v1.3.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v1.3.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -657,7 +520,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -OBPv1.3.0", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -OBPv1.3.0", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "OBPv1.3.0" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -667,7 +530,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -v1.2.1", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -v1.2.1", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v1.2.1" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -677,7 +540,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -OBPv1.2.1", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -OBPv1.2.1", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "OBPv1.2.1" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -688,7 +551,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with } - scenario(s"We will test ${ApiEndpoint3.name} Api -BGv1", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -BGv1", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "BGv1" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -698,7 +561,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -v1.3", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -v1.3", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v1.3" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -708,7 +571,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -BGv1.3", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -BGv1.3", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "BGv1.3" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -718,7 +581,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -v3.1", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -v3.1", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "v3.1" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -728,7 +591,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -UKv3.1", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -UKv3.1", ApiEndpoint1, VersionOfApi) { val requestGetObp = (ResourceDocsV1_4Request /"banks"/ testBankId1.value/ "resource-docs" / "UKv3.1" / "obp").GET val responseGetObp = makeGetRequest(requestGetObp) And("We should get 200 and the response can be extract to case classes") @@ -738,7 +601,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) } - scenario(s"We will test ${ApiEndpoint3.name} Api -v4.0.0 - resource_docs_requires_role props", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -v4.0.0 - resource_docs_requires_role props", ApiEndpoint1, VersionOfApi) { setPropsValues( "resource_docs_requires_role" -> "true", ) @@ -750,7 +613,7 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with responseGetObp.toString contains(UserNotLoggedIn) should be (true) } - scenario(s"We will test ${ApiEndpoint3.name} Api -v4.0.0 - resource_docs_requires_role props- login in user", ApiEndpoint1, VersionOfApi) { + scenario(s"We will test ${ApiEndpoint2.name} Api -v4.0.0 - resource_docs_requires_role props- login in user", ApiEndpoint1, VersionOfApi) { setPropsValues( "resource_docs_requires_role" -> "true", ) @@ -764,305 +627,5 @@ class ResourceDocsTest extends ResourceDocsV140ServerSetup with PropsReset with } } -// -// feature(s"test ${ApiEndpoint4.name} ") { -// scenario(s"We will test ${ApiEndpoint1.name} Api -v4.0.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "v4.0.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -OBPv4.0.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "OBPv4.0.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -v3.1.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "v3.1.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// org.scalameta.logger.elem(responseGetObp) -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -OBPv3.1.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "OBPv3.1.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -v3.0.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "v3.0.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -OBPv3.0.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "OBPv3.0.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -v2.2.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "v2.2.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -OBPv2.2.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "OBPv2.2.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -v2.1.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "v2.1.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -OBPv2.1.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "OBPv2.1.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -v2.0.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "v2.0.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -OBPv2.0.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "OBPv2.0.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -v1.4.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "v1.4.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -OBPv1.4.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "OBPv1.4.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -v1.3.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "v1.3.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -OBPv1.3.0", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "OBPv1.3.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -v1.2.1", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "v1.2.1" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -OBPv1.2.1", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "OBPv1.2.1" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -BGv1", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "BGv1" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -v1.3", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "v1.3" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -BGv1.3", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "BGv1.3" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -v3.1", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "v3.1" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -UKv3.1", ApiEndpoint1, VersionOfApi) { -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "UKv3.1" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(200) -// //This should not throw any exceptions -// responseDocs.resource_docs.map(responseDoc => stringToNodeSeq(responseDoc.description)) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -v4.0.0 - resource_docs_requires_role props", ApiEndpoint1, VersionOfApi) { -// setPropsValues( -// "resource_docs_requires_role" -> "true", -// ) -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "v4.0.0" / "obp").GET -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(401) -// responseGetObp.toString contains(UserNotLoggedIn) should be (true) -// } -// -// scenario(s"We will test ${ApiEndpoint1.name} Api -v4.0.0 - resource_docs_requires_role props- login in user", ApiEndpoint1, VersionOfApi) { -// setPropsValues( -// "resource_docs_requires_role" -> "true", -// ) -// val requestGetObp = (ResourceDocsV4_0Request / "static-resource-docs" / "v4.0.0" / "obp").GET <@ (user1) -// val responseGetObp = makeGetRequest(requestGetObp) -// And("We should get 200 and the response can be extract to case classes") -// val responseDocs = responseGetObp.body.extract[ResourceDocsJson] -// responseGetObp.code should equal(403) -// responseGetObp.toString contains(UserHasMissingRoles) should be (true) -// responseGetObp.toString contains( ApiRole.canReadStaticResourceDoc.toString()) should be (true) -// } -// -// } - - //Note: it is tricky to validate the swagger string, I just find this : https://github.com/swagger-api/swagger-parser/issues/718 - //So follow it to call the `Validate` method: - //https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Validate.java#L46 - def ValidateSwaggerString (swaggerJsonString: String)= { - val result = new OpenAPIParser().readContents(swaggerJsonString, null, null) - val messageList: util.List[String] = result.getMessages() - - val errors = new util.HashSet[String](messageList) - val warnings = new util.HashSet[String] - - val sb = new StringBuilder - - if (!errors.isEmpty) { - sb.append("Errors:").append(System.lineSeparator) - errors.forEach((msg: String) => sb.append("\t-").append(msg).append(System.lineSeparator)) - } - - if (!warnings.isEmpty) { - sb.append("Warnings: ").append(System.lineSeparator) - warnings.forEach((msg: String) => sb.append("\t-").append(msg).append(System.lineSeparator)) - } - - if (!errors.isEmpty) { - sb.append(System.lineSeparator) - sb.append("[error] Spec has ").append(errors.size).append(" errors.") - System.err.println(sb.toString) - System.exit(1) - } - else if (!warnings.isEmpty) { - sb.append(System.lineSeparator) - sb.append("[info] Spec has ").append(warnings.size).append(" recommendation(s).") - } - else { // we say "issues" here rather than "errors" to account for both errors and issues. - sb.append("No validation issues detected.") - } - val allMessages = sb.toString - logger.info(s"validatedSwaggerResult.errors $errors") - logger.info(s"validatedSwaggerResult.warnings $warnings") - logger.info(s"validatedSwaggerResult.allMessages $allMessages") - - (errors, warnings, allMessages) - } + } diff --git a/obp-api/src/test/scala/code/api/ResourceDocs1_4_0/SwaggerDocsTest.scala b/obp-api/src/test/scala/code/api/ResourceDocs1_4_0/SwaggerDocsTest.scala new file mode 100644 index 0000000000..593de538b4 --- /dev/null +++ b/obp-api/src/test/scala/code/api/ResourceDocs1_4_0/SwaggerDocsTest.scala @@ -0,0 +1,247 @@ +package code.api.ResourceDocs1_4_0 + +import code.api.ResourceDocs1_4_0.ResourceDocs140.ImplementationsResourceDocs +import code.api.util.{ApiRole, CustomJsonFormats} +import code.setup.{DefaultUsers, PropsReset} +import com.github.dwickern.macros.NameOf.nameOf +import com.openbankproject.commons.util.{ApiVersion, Functions} +import io.swagger.parser.OpenAPIParser +import net.liftweb.json +import net.liftweb.json.JsonAST._ +import net.liftweb.json.{Formats, JString, Serializer, TypeInfo} +import net.liftweb.util.Html5 +import org.scalatest.Tag + +import java.util +import scala.xml.NodeSeq + +class SwaggerDocsTest extends ResourceDocsV140ServerSetup with PropsReset with DefaultUsers{ + object VersionOfApi extends Tag(ApiVersion.v1_4_0.toString) + object ApiEndpoint1 extends Tag(nameOf(ImplementationsResourceDocs.getResourceDocsSwagger)) + + override def beforeEach() = { + super.beforeEach() + setPropsValues( + "api_disabled_versions" -> "[]", + "api_enabled_versions" -> "[]" + ) + } + + // here must supply a Serializer of json, to support Product type, because the follow type are Product: + //ResourceDocsJson#ResourceDocJson.example_request_body + //ResourceDocsJson#ResourceDocJson.success_response_body + object ProductSerializer extends Serializer[Product] { + private val CLAZZ = classOf[Product] + + override def deserialize(implicit format: Formats): PartialFunction[(TypeInfo, json.JValue), Product] = { + case (TypeInfo(CLAZZ, _), json) if json == JNull || json == JNothing => null + case (TypeInfo(CLAZZ, _), json: JObject) => json + } + + override def serialize(implicit format: Formats): PartialFunction[Any, json.JValue] = Functions.doNothing + } + // here must supply a Serializer of json, to support Product type, because the follow type are ApiRole: + //ResourceDocsJson#ResourceDocJson.roles + object ApiRoleSerializer extends Serializer[ApiRole] { + private val CLAZZ = classOf[ApiRole] + override def deserialize(implicit format: Formats): PartialFunction[(TypeInfo, json.JValue), ApiRole] = { + case (TypeInfo(CLAZZ, _), role) => { + val roleName = (role \ "role").asInstanceOf[JString].s + ApiRole.valueOf(roleName) + } + } + + override def serialize(implicit format: Formats): PartialFunction[Any, json.JValue] = { + case null => JNull // not need do serialize + } + } + override implicit val formats = CustomJsonFormats.formats + ProductSerializer + ApiRoleSerializer + + /** + * API_Explorer side use this method, so it need to be right. + * @param html + * @return + */ + def stringToNodeSeq(html : String) : NodeSeq = { + val newHtmlString =scala.xml.XML.loadString("
" + html + "
").toString() + //Note: `parse` method: We much enclose the div, otherwise only the first element is returned. + Html5.parse(newHtmlString).head + } + + + feature(s"test ${ApiEndpoint1.name} ") { + scenario(s"We will test ${ApiEndpoint1.name} Api - v5.0.0/v5.0.0 ", ApiEndpoint1, VersionOfApi) { + val requestGetObp = (ResourceDocsV5_0Request / "resource-docs" / "v5.0.0" / "swagger").GET + val responseGetObp = makeGetRequest(requestGetObp) + And("We should get 200 and the response can be extract to case classes") + responseGetObp.code should equal(200) + val swaggerJsonString = json.compactRender(responseGetObp.body) + val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) + val errors = validatedSwaggerResult._1 + if (!errors.isEmpty) logger.info(s"Here is the wrong swagger json: $swaggerJsonString") + errors.isEmpty should be (true) + } + + scenario(s"We will test ${ApiEndpoint1.name} Api - v5.0.0/v4.0.0", ApiEndpoint1, VersionOfApi) { + val requestGetObp = (ResourceDocsV5_0Request / "resource-docs" / "v4.0.0" / "swagger").GET + val responseGetObp = makeGetRequest(requestGetObp) + And("We should get 200 and the response can be extract to case classes") + responseGetObp.code should equal(200) + val swaggerJsonString = json.compactRender(responseGetObp.body) + val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) + val errors = validatedSwaggerResult._1 + if (!errors.isEmpty) logger.info(s"Here is the wrong swagger json: $swaggerJsonString") + errors.isEmpty should be (true) + } + + scenario(s"We will test ${ApiEndpoint1.name} Api - v4.0.0", ApiEndpoint1, VersionOfApi) { + val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v4.0.0" / "swagger").GET + val responseGetObp = makeGetRequest(requestGetObp) + And("We should get 200 and the response can be extract to case classes") + responseGetObp.code should equal(200) + val swaggerJsonString = json.compactRender(responseGetObp.body) + val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) + val errors = validatedSwaggerResult._1 + if (!errors.isEmpty) logger.info(s"Here is the wrong swagger json: $swaggerJsonString") + errors.isEmpty should be (true) + } + + scenario(s"We will test ${ApiEndpoint1.name} Api - v3.1.1", ApiEndpoint1, VersionOfApi) { + val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v3.1.0" / "swagger").GET + val responseGetObp = makeGetRequest(requestGetObp) + And("We should get 200 and the response can be extract to case classes") + responseGetObp.code should equal(200) + val swaggerJsonString = json.compactRender(responseGetObp.body) + + val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) + val errors = validatedSwaggerResult._1 + errors.isEmpty should be (true) + } + + scenario(s"We will test ${ApiEndpoint1.name} Api - v3.0.0", ApiEndpoint1, VersionOfApi) { + val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v3.0.0" / "swagger").GET + val responseGetObp = makeGetRequest(requestGetObp) + And("We should get 200 and the response can be extract to case classes") + responseGetObp.code should equal(200) + val swaggerJsonString = json.compactRender(responseGetObp.body) + val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) + val errors = validatedSwaggerResult._1 + errors.isEmpty should be (true) + } + + scenario(s"We will test ${ApiEndpoint1.name} Api - v2.2.0", ApiEndpoint1, VersionOfApi) { + val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v2.2.0" / "swagger").GET + val responseGetObp = makeGetRequest(requestGetObp) + And("We should get 200 and the response can be extract to case classes") + responseGetObp.code should equal(200) + val swaggerJsonString = json.compactRender(responseGetObp.body) + + val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) + val errors = validatedSwaggerResult._1 + errors.isEmpty should be (true) + } + + scenario(s"We will test ${ApiEndpoint1.name} Api - v2.1.0", ApiEndpoint1, VersionOfApi) { + val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v2.1.0" / "swagger").GET + val responseGetObp = makeGetRequest(requestGetObp) + And("We should get 200 and the response can be extract to case classes") + responseGetObp.code should equal(200) + val swaggerJsonString = json.compactRender(responseGetObp.body) + val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) + val errors = validatedSwaggerResult._1 + errors.isEmpty should be (true) + } + + scenario(s"We will test ${ApiEndpoint1.name} Api - v2.0.0", ApiEndpoint1, VersionOfApi) { + val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v2.0.0" / "swagger").GET + val responseGetObp = makeGetRequest(requestGetObp) + And("We should get 200 and the response can be extract to case classes") + responseGetObp.code should equal(200) + val swaggerJsonString = json.compactRender(responseGetObp.body) + + val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) + val errors = validatedSwaggerResult._1 + errors.isEmpty should be (true) + } + + scenario(s"We will test ${ApiEndpoint1.name} Api - v1.4.0", ApiEndpoint1, VersionOfApi) { + val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v1.4.0" / "swagger").GET + val responseGetObp = makeGetRequest(requestGetObp) + And("We should get 200 and the response can be extract to case classes") + responseGetObp.code should equal(200) + val swaggerJsonString = json.compactRender(responseGetObp.body) + + val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) + val errors = validatedSwaggerResult._1 + errors.isEmpty should be (true) + } + + scenario(s"We will test ${ApiEndpoint1.name} Api - v1.3.0", ApiEndpoint1, VersionOfApi) { + val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v1.3.0" / "swagger").GET + val responseGetObp = makeGetRequest(requestGetObp) + And("We should get 200 and the response can be extract to case classes") + responseGetObp.code should equal(200) + val swaggerJsonString = json.compactRender(responseGetObp.body) + + val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) + val errors = validatedSwaggerResult._1 + errors.isEmpty should be (true) + } + + scenario(s"We will test ${ApiEndpoint1.name} Api - v1.2.1", ApiEndpoint1, VersionOfApi) { + val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v1.2.1" / "swagger").GET + val responseGetObp = makeGetRequest(requestGetObp) + And("We should get 200 and the response can be extract to case classes") + responseGetObp.code should equal(200) + val swaggerJsonString = json.compactRender(responseGetObp.body) + + val validatedSwaggerResult = ValidateSwaggerString(swaggerJsonString) + val errors = validatedSwaggerResult._1 + errors.isEmpty should be (true) + } + + } + + //Note: it is tricky to validate the swagger string, I just find this : https://github.com/swagger-api/swagger-parser/issues/718 + //So follow it to call the `Validate` method: + //https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Validate.java#L46 + def ValidateSwaggerString (swaggerJsonString: String)= { + val result = new OpenAPIParser().readContents(swaggerJsonString, null, null) + val messageList: util.List[String] = result.getMessages() + + val errors = new util.HashSet[String](messageList) + val warnings = new util.HashSet[String] + + val sb = new StringBuilder + + if (!errors.isEmpty) { + sb.append("Errors:").append(System.lineSeparator) + errors.forEach((msg: String) => sb.append("\t-").append(msg).append(System.lineSeparator)) + } + + if (!warnings.isEmpty) { + sb.append("Warnings: ").append(System.lineSeparator) + warnings.forEach((msg: String) => sb.append("\t-").append(msg).append(System.lineSeparator)) + } + + if (!errors.isEmpty) { + sb.append(System.lineSeparator) + sb.append("[error] Spec has ").append(errors.size).append(" errors.") + System.err.println(sb.toString) + System.exit(1) + } + else if (!warnings.isEmpty) { + sb.append(System.lineSeparator) + sb.append("[info] Spec has ").append(warnings.size).append(" recommendation(s).") + } + else { // we say "issues" here rather than "errors" to account for both errors and issues. + sb.append("No validation issues detected.") + } + val allMessages = sb.toString + logger.info(s"validatedSwaggerResult.errors $errors") + logger.info(s"validatedSwaggerResult.warnings $warnings") + logger.info(s"validatedSwaggerResult.allMessages $allMessages") + + (errors, warnings, allMessages) + } +} diff --git a/obp-api/src/test/scala/code/api/v3_1_0/GetMessageDocsSwaggerTest.scala b/obp-api/src/test/scala/code/api/v3_1_0/GetMessageDocsSwaggerTest.scala new file mode 100644 index 0000000000..647ce0e78f --- /dev/null +++ b/obp-api/src/test/scala/code/api/v3_1_0/GetMessageDocsSwaggerTest.scala @@ -0,0 +1,60 @@ +/** +Open Bank Project - API +Copyright (C) 2011-2019, TESOBE GmbH + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . + +Email: contact@tesobe.com +TESOBE GmbH +Osloerstrasse 16/17 +Berlin 13359, Germany + +This product includes software developed at +TESOBE (http://www.tesobe.com/) + */ +package code.api.v3_1_0 + +import code.api.v2_2_0.JSONFactory220.MessageDocsJson +import code.api.v3_1_0.OBPAPI3_1_0.Implementations3_1_0 +import code.setup.DefaultUsers +import com.github.dwickern.macros.NameOf.nameOf +import com.openbankproject.commons.util.ApiVersion +import org.scalatest.Tag + +class GetMessageDocsSwaggerTest extends V310ServerSetup with DefaultUsers { + + /** + * Test tags + * Example: To run tests with tag "getPermissions": + * mvn test -D tagsToInclude + * + * This is made possible by the scalatest maven plugin + */ + object VersionOfApi extends Tag(ApiVersion.v3_1_0.toString) + object ApiEndpoint extends Tag(nameOf(Implementations3_1_0.getMessageDocsSwagger)) + + feature("Get Message Docs Swagger v3.1.0") + { + scenario(s"should return proper response", ApiEndpoint, VersionOfApi) { + When("We make a request v3.1.0") + val request310 = (v3_1_0_Request / "message-docs" / "rest_vMar2019" / "swagger2.0").GET + val response310 = makeGetRequest(request310) + Then("We should get a 200") + response310.code should equal(200) + //TODO can add more tests for the swagger validation here. + } + } + + +}