From aed23ebc8584327e4f3c71e52a3a5e742a31e924 Mon Sep 17 00:00:00 2001 From: hongwei Date: Mon, 31 Oct 2022 13:35:59 +0100 Subject: [PATCH 1/4] refactor/added the COUNTERPARTY_NAME the swagger resourceDocs --- .../scala/code/api/ResourceDocs1_4_0/SwaggerJSONFactory.scala | 3 +++ 1 file changed, 3 insertions(+) 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 939a19f46..30aa308c9 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 @@ -379,6 +379,7 @@ object SwaggerJSONFactory extends MdcLoggable { .replaceAll("/MEETING_ID", "/{MEETING_ID}") .replaceAll("/COLLECTION_CODE", "/{COLLECTION_CODE}") .replaceAll("/COUNTERPARTY_ID", "/{COUNTERPARTY_ID}") + .replaceAll("/COUNTERPARTY_NAME", "/{COUNTERPARTY_NAME}") var pathParameters = List.empty[OperationParameter] if(path.contains("/{BANK_ID}")) @@ -483,6 +484,8 @@ object SwaggerJSONFactory extends MdcLoggable { pathParameters = OperationParameterPathJson(name="COLLECTION_CODE", description= "the collection code") :: pathParameters if(path.contains("/{COUNTERPARTY_ID}")) pathParameters = OperationParameterPathJson(name="COUNTERPARTY_ID", description= "the counterparty id") :: pathParameters + if(path.contains("/{COUNTERPARTY_NAME}")) + pathParameters = OperationParameterPathJson(name="COUNTERPARTY_NAME", description= "the counterparty name") :: pathParameters if(path.contains("/{API_VERSION}")) pathParameters = OperationParameterPathJson(name="API_VERSION", description="eg:v2.2.0, v3.0.0") :: pathParameters From 05df401e60b28a8b31b689e420fe7b1e74fbfdf6 Mon Sep 17 00:00:00 2001 From: hongwei Date: Mon, 31 Oct 2022 13:41:47 +0100 Subject: [PATCH 2/4] refactor/use json instead of emptyObjectJson --- .../scala/code/api/v3_0_0/APIMethods300.scala | 82 +++++------ .../scala/code/api/v3_1_0/APIMethods310.scala | 136 +++++++++--------- .../scala/code/api/v4_0_0/APIMethods400.scala | 14 +- .../scala/code/api/v5_0_0/APIMethods500.scala | 22 +-- 4 files changed, 127 insertions(+), 127 deletions(-) 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 d94cab176..6a6232d67 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 @@ -93,7 +93,7 @@ trait APIMethods300 { |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, viewsJsonV300, List( UserNotLoggedIn, @@ -198,7 +198,7 @@ trait APIMethods300 { |${authenticationRequiredMessage(true)} | |The user needs to have access to the owner view.""", - emptyObjectJson, + EmptyBody, viewsJsonV300, List(UserNotLoggedIn,BankNotFound, AccountNotFound,UnknownError), List(apiTagView, apiTagAccount, apiTagUser, apiTagNewStyle)) @@ -302,7 +302,7 @@ trait APIMethods300 { | |Authentication is required if the 'is_public' field in view (VIEW_ID) is not set to `true`. |""".stripMargin, - emptyObjectJson, + EmptyBody, moderatedCoreAccountJsonV300, List(BankNotFound,AccountNotFound,ViewNotFound, UserNoPermissionAccessView, UnknownError), apiTagAccount :: apiTagNewStyle :: Nil) @@ -345,7 +345,7 @@ trait APIMethods300 { |${authenticationRequiredMessage(false)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, moderatedCoreAccountJsonV300, List(BankNotFound,AccountNotFound,ViewNotFound, UnknownError), apiTagAccountPublic :: apiTagAccount :: apiTagNewStyle :: Nil) @@ -387,7 +387,7 @@ trait APIMethods300 { |${authenticationRequiredMessage(true)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, newModeratedCoreAccountJsonV300, List(BankAccountNotFound,UnknownError), apiTagAccount :: apiTagPSD2AIS :: apiTagNewStyle :: apiTagPsd2 :: Nil) @@ -422,7 +422,7 @@ trait APIMethods300 { | |${authenticationRequiredMessage(true)} |""", - emptyObjectJson, + EmptyBody, coreAccountsJsonV300, List(UserNotLoggedIn,UnknownError), List(apiTagAccount, apiTagPSD2AIS, apiTagPrivateData, apiTagPsd2, apiTagNewStyle) @@ -479,7 +479,7 @@ trait APIMethods300 { |${authenticationRequiredMessage(true)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, moderatedCoreAccountsJsonV300, List(UserNotLoggedIn,AccountFirehoseNotAllowedOnThisInstance,UnknownError), List(apiTagAccount, apiTagAccountFirehose, apiTagFirehoseData, apiTagNewStyle), @@ -567,7 +567,7 @@ trait APIMethods300 { |${authenticationRequiredMessage(true)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, transactionsJsonV300, List(UserNotLoggedIn, AccountFirehoseNotAllowedOnThisInstance, UserHasMissingRoles, UnknownError), List(apiTagTransaction, apiTagAccountFirehose, apiTagTransactionFirehose, apiTagFirehoseData, apiTagNewStyle), @@ -629,7 +629,7 @@ trait APIMethods300 { |${urlParametersDocument(true, true)} | |""", - emptyObjectJson, + EmptyBody, coreTransactionsJsonV300, List( FilterSortDirectionError, @@ -687,7 +687,7 @@ trait APIMethods300 { |${urlParametersDocument(true, true)} | |""", - emptyObjectJson, + EmptyBody, transactionsJsonV300, List( FilterSortDirectionError, @@ -766,7 +766,7 @@ trait APIMethods300 { | """, elasticSearchJsonV300, - emptyObjectJson, //TODO what is output here? + EmptyBody, //TODO what is output here? List(UserNotLoggedIn, UserHasMissingRoles, UnknownError), List(apiTagSearchWarehouse, apiTagNewStyle), Some(List(canSearchWarehouse))) @@ -845,7 +845,7 @@ trait APIMethods300 { | """, elasticSearchJsonV300, - emptyObjectJson, //TODO what is output here? + EmptyBody, //TODO what is output here? List(UserNotLoggedIn, UserHasMissingRoles, UnknownError), List(apiTagSearchWarehouse, apiTagNewStyle), Some(List(canSearchWarehouseStatistics)) @@ -899,7 +899,7 @@ trait APIMethods300 { |CanGetAnyUser entitlement is required, | """.stripMargin, - emptyObjectJson, + EmptyBody, usersJsonV200, List(UserNotLoggedIn, UserHasMissingRoles, UserNotFoundByEmail, UnknownError), List(apiTagUser, apiTagNewStyle), @@ -932,7 +932,7 @@ trait APIMethods300 { |CanGetAnyUser entitlement is required, | """.stripMargin, - emptyObjectJson, + EmptyBody, usersJsonV200, List(UserNotLoggedIn, UserHasMissingRoles, UserNotFoundById, UnknownError), List(apiTagUser, apiTagNewStyle), @@ -969,7 +969,7 @@ trait APIMethods300 { |CanGetAnyUser entitlement is required, | """.stripMargin, - emptyObjectJson, + EmptyBody, usersJsonV200, List(UserNotLoggedIn, UserHasMissingRoles, UserNotFoundByUsername, UnknownError), List(apiTagUser, apiTagNewStyle), @@ -1005,7 +1005,7 @@ trait APIMethods300 { |${authenticationRequiredMessage(false)} | """.stripMargin, - emptyObjectJson, + EmptyBody, adapterInfoJsonV300, List(UserNotLoggedIn, UserHasMissingRoles, UnknownError), List(apiTagApi, apiTagNewStyle), @@ -1200,7 +1200,7 @@ trait APIMethods300 { |* License the data under this endpoint is released under. | |${authenticationRequiredMessage(!getBranchesIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, branchJsonV300, List( UserNotLoggedIn, @@ -1261,7 +1261,7 @@ trait APIMethods300 { |note: withinMetersOf, nearLatitude and nearLongitude either all empty or all have value. | |${authenticationRequiredMessage(!getBranchesIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, branchesJsonV300, List( UserNotLoggedIn, @@ -1377,7 +1377,7 @@ trait APIMethods300 { | | |${authenticationRequiredMessage(!getAtmsIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, atmJsonV300, List(UserNotLoggedIn, BankNotFound, AtmNotFoundByAtmId, UnknownError), List(apiTagATM, apiTagNewStyle) @@ -1418,7 +1418,7 @@ trait APIMethods300 { |You can use the url query parameters *limit* and *offset* for pagination | |${authenticationRequiredMessage(!getAtmsIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, atmJsonV300, List( UserNotLoggedIn, @@ -1496,7 +1496,7 @@ trait APIMethods300 { |* locked_status (if null ignore) | """.stripMargin, - emptyObjectJson, + EmptyBody, usersJsonV200, List( UserNotLoggedIn, @@ -1538,7 +1538,7 @@ trait APIMethods300 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, + EmptyBody, customersWithAttributesJsonV300, List( UserNotLoggedIn, @@ -1586,7 +1586,7 @@ trait APIMethods300 { | |${authenticationRequiredMessage(true)} """.stripMargin, - emptyObjectJson, + EmptyBody, userJsonV200, List(UserNotLoggedIn, UnknownError), List(apiTagUser, apiTagNewStyle)) @@ -1620,7 +1620,7 @@ trait APIMethods300 { |${accountTypeFilterText("/banks/BANK_ID/accounts/private")} | |${authenticationRequiredMessage(true)}""".stripMargin, - emptyObjectJson, + EmptyBody, coreAccountsJsonV300, List(UserNotLoggedIn, BankNotFound, UnknownError), List(apiTagAccount,apiTagPSD2AIS, apiTagNewStyle, apiTagPsd2) @@ -1659,7 +1659,7 @@ trait APIMethods300 { |${accountTypeFilterText("/banks/BANK_ID/accounts/account_ids/private")} | |${authenticationRequiredMessage(true)}""".stripMargin, - emptyObjectJson, + EmptyBody, accountsIdsJsonV300, List(UserNotLoggedIn, BankNotFound, UnknownError), List(apiTagAccount, apiTagPSD2AIS, apiTagPsd2, apiTagNewStyle) @@ -1694,7 +1694,7 @@ trait APIMethods300 { |${authenticationRequiredMessage(false)} | |Authentication is required if the view VIEW_ID is not public.""", - emptyObjectJson, + EmptyBody, otherAccountsJsonV300, List( UserNotLoggedIn, @@ -1731,7 +1731,7 @@ trait APIMethods300 { |${authenticationRequiredMessage(false)} | |Authentication is required if the view is not public.""", - emptyObjectJson, + EmptyBody, otherAccountJsonV300, List( UserNotLoggedIn, @@ -1836,7 +1836,7 @@ trait APIMethods300 { | |${authenticationRequiredMessage(true)} """.stripMargin, - emptyObjectJson, + EmptyBody, entitlementRequestsJSON, List( UserNotLoggedIn, @@ -1875,7 +1875,7 @@ trait APIMethods300 { |${authenticationRequiredMessage(true)} | """.stripMargin, - emptyObjectJson, + EmptyBody, entitlementRequestsJSON, List( UserNotLoggedIn, @@ -1914,7 +1914,7 @@ trait APIMethods300 { |${authenticationRequiredMessage(true)} | """.stripMargin, - emptyObjectJson, + EmptyBody, entitlementRequestsJSON, List( UserNotLoggedIn, @@ -1949,8 +1949,8 @@ trait APIMethods300 { | |${authenticationRequiredMessage(true)} """.stripMargin, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, InvalidConnectorResponse, @@ -1989,7 +1989,7 @@ trait APIMethods300 { |${authenticationRequiredMessage(true)} | """.stripMargin, - emptyObjectJson, + EmptyBody, entitlementJSONs, List( UserNotLoggedIn, @@ -2024,7 +2024,7 @@ trait APIMethods300 { |Returns the glossary of the API | |""", - emptyObjectJson, + EmptyBody, glossaryItemsJsonV300, List(UnknownError), apiTagDocumentation :: apiTagNewStyle :: Nil) @@ -2066,7 +2066,7 @@ trait APIMethods300 { | | """.stripMargin, - emptyObjectJson, + EmptyBody, coreAccountsHeldJsonV300, List(UserNotLoggedIn, UnknownError), List(apiTagAccount, apiTagPSD2AIS, apiTagView, apiTagPsd2, apiTagNewStyle) @@ -2142,7 +2142,7 @@ trait APIMethods300 { |${authenticationRequiredMessage(true)} | """.stripMargin, - emptyObjectJson, + EmptyBody, aggregateMetricsJSONV300, List( UserNotLoggedIn, @@ -2267,8 +2267,8 @@ trait APIMethods300 { | | """.stripMargin, - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List(UserNotLoggedIn, EntitlementNotFound, UnknownError), List(apiTagScope, apiTagConsumer, apiTagNewStyle)) @@ -2305,7 +2305,7 @@ trait APIMethods300 { | | """.stripMargin, - emptyObjectJson, + EmptyBody, scopeJsons, List(UserNotLoggedIn, EntitlementNotFound, UnknownError), List(apiTagScope, apiTagConsumer, apiTagNewStyle)) @@ -2339,7 +2339,7 @@ trait APIMethods300 { |* Short and full name of bank |* Logo URL |* Website""", - emptyObjectJson, + EmptyBody, banksJSON, List(UnknownError), apiTagBank :: apiTagPSD2AIS:: apiTagPsd2 :: apiTagNewStyle :: Nil) @@ -2369,7 +2369,7 @@ trait APIMethods300 { |* Short and full name of bank |* Logo URL |* Website""", - emptyObjectJson, + EmptyBody, bankJson400, List(UserNotLoggedIn, UnknownError, BankNotFound), apiTagBank :: apiTagPSD2AIS :: apiTagPsd2 :: apiTagNewStyle :: Nil 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 a7f17f7a7..69472c656 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 @@ -84,7 +84,7 @@ trait APIMethods310 { "/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/checkbook/orders", "Get Checkbook orders", s"""${mockedDataText(false)}Get all checkbook orders""", - emptyObjectJson, + EmptyBody, checkbookOrdersJson, List( UserNotLoggedIn, @@ -125,7 +125,7 @@ trait APIMethods310 { s"""${mockedDataText(false)}Get status of Credit Card orders |Get all orders |""", - emptyObjectJson, + EmptyBody, creditCardOrderStatusResponseJson, List( UserNotLoggedIn, @@ -198,7 +198,7 @@ trait APIMethods310 { s"""${mockedDataText(true)} |Get Credit Limit Order Requests |""", - emptyObjectJson, + EmptyBody, creditLimitOrderJson, List(UnknownError), apiTagCustomer :: apiTagNewStyle :: Nil) @@ -228,7 +228,7 @@ trait APIMethods310 { s"""${mockedDataText(true)} Get Credit Limit Order Request By Request Id |""", - emptyObjectJson, + EmptyBody, creditLimitOrderJson, List(UnknownError), apiTagCustomer :: apiTagNewStyle :: Nil) @@ -298,7 +298,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | """.stripMargin, - emptyObjectJson, + EmptyBody, topApisJson, List( UserNotLoggedIn, @@ -385,7 +385,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | """.stripMargin, - emptyObjectJson, + EmptyBody, topConsumersJson, List( UserNotLoggedIn, @@ -447,7 +447,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, customerJSONs, List(UserNotLoggedIn, CustomerFirehoseNotAllowedOnThisInstance, UserHasMissingRoles, UnknownError), List(apiTagCustomer, apiTagFirehoseData, apiTagNewStyle), @@ -497,7 +497,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, badLoginStatusJson, List(UserNotLoggedIn, UserNotFoundByUsername, UserHasMissingRoles, UnknownError), List(apiTagUser, apiTagNewStyle), @@ -533,7 +533,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, badLoginStatusJson, List(UserNotLoggedIn, UserNotFoundByUsername, UserHasMissingRoles, UnknownError), List(apiTagUser, apiTagNewStyle), @@ -635,7 +635,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""".stripMargin, - emptyObjectJson, + EmptyBody, callLimitJson, List( UserNotLoggedIn, @@ -682,7 +682,7 @@ trait APIMethods310 { |* currency=STRING | """.stripMargin, - emptyObjectJson, + EmptyBody, checkFundsAvailableJson, List( UserNotLoggedIn, @@ -747,7 +747,7 @@ trait APIMethods310 { s"""Get the Consumer specified by CONSUMER_ID. | |""", - emptyObjectJson, + EmptyBody, consumerJSON, List( UserNotLoggedIn, @@ -784,7 +784,7 @@ trait APIMethods310 { s"""Get the Consumers for logged in User. | |""", - emptyObjectJson, + EmptyBody, consumersJson310, List( UserNotLoggedIn, @@ -818,7 +818,7 @@ trait APIMethods310 { s"""Get the all Consumers. | |""", - emptyObjectJson, + EmptyBody, consumersJson310, List( UserNotLoggedIn, @@ -977,7 +977,7 @@ trait APIMethods310 { | | |""", - emptyObjectJson, + EmptyBody, accountWebhooksJson, List( UserNotLoggedIn, @@ -1020,7 +1020,7 @@ trait APIMethods310 { |* Akka configuration |* Elastic Search configuration |* Cached functions """, - emptyObjectJson, + EmptyBody, configurationJSON, List( UserNotLoggedIn, @@ -1053,7 +1053,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(false)} | """.stripMargin, - emptyObjectJson, + EmptyBody, adapterInfoJsonV300, List(UserNotLoggedIn,UserHasMissingRoles, UnknownError), List(apiTagApi, apiTagNewStyle), @@ -1089,7 +1089,7 @@ trait APIMethods310 { | | |""", - emptyObjectJson, + EmptyBody, transactionJsonV300, List(UserNotLoggedIn, BankAccountNotFound ,ViewNotFound, UserNoPermissionAccessView, UnknownError), List(apiTagTransaction, apiTagNewStyle)) @@ -1146,7 +1146,7 @@ trait APIMethods310 { |The customer can proceed with the Transaction by answering the security challenge. | """.stripMargin, - emptyObjectJson, + EmptyBody, transactionRequestWithChargeJSONs210, List( UserNotLoggedIn, @@ -1272,7 +1272,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | """.stripMargin, - emptyObjectJson, + EmptyBody, rateLimitingInfoV310, List(UnknownError), List(apiTagApi, apiTagNewStyle)) @@ -1313,7 +1313,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, + EmptyBody, customerWithAttributesJsonV310, List( UserNotLoggedIn, @@ -1442,7 +1442,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, + EmptyBody, userAuthContextsJson, List( UserNotLoggedIn, @@ -1481,8 +1481,8 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, UserHasMissingRoles, @@ -1519,8 +1519,8 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, UserHasMissingRoles, @@ -1600,7 +1600,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, + EmptyBody, taxResidencesJsonV310, List( UserNotLoggedIn, @@ -1638,8 +1638,8 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, UserHasMissingRoles, @@ -1679,7 +1679,7 @@ trait APIMethods310 { | | """.stripMargin, - emptyObjectJson, + EmptyBody, entitlementJSONs, List(UserNotLoggedIn, UserHasMissingRoles, UnknownError), List(apiTagRole, apiTagEntitlement, apiTagNewStyle)) @@ -1828,7 +1828,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, + EmptyBody, customerAddressesJsonV310, List( UserNotLoggedIn, @@ -1867,8 +1867,8 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, UserHasMissingRoles, @@ -1911,7 +1911,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, + EmptyBody, obpApiLoopbackJson, List( UnknownError @@ -1951,7 +1951,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, + EmptyBody, refresUserJson, List( UserHasMissingRoles, @@ -2079,7 +2079,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, + EmptyBody, productAttributeResponseJson, List( UserHasMissingRoles, @@ -2180,8 +2180,8 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserHasMissingRoles, BankNotFound, @@ -2277,7 +2277,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, + EmptyBody, accountApplicationsJsonV310, List( UserNotLoggedIn, @@ -2320,7 +2320,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, + EmptyBody, accountApplicationResponseJson, List( UserNotLoggedIn, @@ -2533,7 +2533,7 @@ trait APIMethods310 { |* License the data under this endpoint is released under | |${authenticationRequiredMessage(!getProductsIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, productJsonV310, List( UserNotLoggedIn, @@ -2589,7 +2589,7 @@ trait APIMethods310 { | | |${authenticationRequiredMessage(!getProductsIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, childProductTreeJsonV310, List( UserNotLoggedIn, @@ -2650,7 +2650,7 @@ trait APIMethods310 { |URL params example: /banks/some-bank-id/products?manager=John&count=8 | |${authenticationRequiredMessage(!getProductsIsPublic)}""".stripMargin, - emptyObjectJson, + EmptyBody, productsJsonV310, List( UserNotLoggedIn, @@ -2944,7 +2944,7 @@ trait APIMethods310 { s"""Returns information about the financial Product Collection specified by BANK_ID and COLLECTION_CODE: | """, - emptyObjectJson, + EmptyBody, productCollectionJsonTreeV310, List( UserNotLoggedIn, @@ -2985,8 +2985,8 @@ trait APIMethods310 { |${authenticationRequiredMessage(true) } | |""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, BankNotFound, @@ -3111,7 +3111,7 @@ trait APIMethods310 { | |This call is **experimental** and will require further authorisation in the future. """.stripMargin, - emptyObjectJson, + EmptyBody, meetingsJsonV310, List( UserNotLoggedIn, @@ -3149,7 +3149,7 @@ trait APIMethods310 { | |This call is **experimental** and will require further authorisation in the future. """.stripMargin, - emptyObjectJson, + EmptyBody, meetingJsonV310, List( UserNotLoggedIn, @@ -3184,7 +3184,7 @@ trait APIMethods310 { | It is required by client applications to validate ID tokens, self-contained access tokens and other issued objects. | """.stripMargin, - emptyObjectJson, + EmptyBody, severJWK, List( UnknownError @@ -3221,7 +3221,7 @@ trait APIMethods310 { |OBP API (Core OBP API code) -> OBP REST Connector (OBP REST Connector code) -> OBP REST Adapter (Adapter developer code) -> CBS (Main Frame) | """.stripMargin, - emptyObjectJson, + EmptyBody, messageDocsJson, List(UnknownError), List(apiTagDocumentation, apiTagApi, apiTagNewStyle) @@ -3641,7 +3641,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | """.stripMargin, - emptyObjectJson, + EmptyBody, consentsJsonV310, List( UserNotLoggedIn, @@ -3677,7 +3677,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | """.stripMargin, - emptyObjectJson, + EmptyBody, revokedConsentJsonV310, List( UserNotLoggedIn, @@ -3833,7 +3833,7 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | """.stripMargin, - emptyObjectJson, + EmptyBody, viewJSONV220, List( UserNotLoggedIn, @@ -3921,8 +3921,8 @@ trait APIMethods310 { "/system-views/VIEW_ID", "Delete System View", "Deletes the system view specified by VIEW_ID", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, BankAccountNotFound, @@ -4008,7 +4008,7 @@ trait APIMethods310 { | It is required by client applications to validate ID tokens, self-contained access tokens and other issued objects. | """.stripMargin, - emptyObjectJson, + EmptyBody, oAuth2ServerJwksUrisJson, List( UnknownError @@ -4045,7 +4045,7 @@ trait APIMethods310 { |${getObpApiRoot}/v3.1.0/management/method_routings?method_name=getBank | |""", - emptyObjectJson, + EmptyBody, ListResult( "method_routings", (List(MethodRoutingCommons("getBanks", "rest_vMar2019", false, Some("some_bank_.*"), List(MethodRoutingParam("url", "http://mydomain.com/xxx")), Some("method-routing-id")))) @@ -4332,8 +4332,8 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, UserHasMissingRoles, @@ -4920,7 +4920,7 @@ trait APIMethods310 { | | |${authenticationRequiredMessage(true)}""".stripMargin, - emptyObjectJson, + EmptyBody, physicalCardsJsonV310, List(UserNotLoggedIn,BankNotFound, UnknownError), List(apiTagCard, apiTagNewStyle)) @@ -4954,7 +4954,7 @@ trait APIMethods310 { |Also shows the card attributes of the card. | """.stripMargin, - emptyObjectJson, + EmptyBody, physicalCardWithAttributesJsonV310, List(UserNotLoggedIn,BankNotFound, UnknownError), List(apiTagCard, apiTagNewStyle), @@ -4988,8 +4988,8 @@ trait APIMethods310 { | |${authenticationRequiredMessage(true)} |""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, UserHasMissingRoles, @@ -5420,7 +5420,7 @@ trait APIMethods310 { | |Authentication is required if the 'is_public' field in view (VIEW_ID) is not set to `true`. |""".stripMargin, - emptyObjectJson, + EmptyBody, moderatedAccountJSON310, List(BankNotFound,AccountNotFound,ViewNotFound, UserNoPermissionAccessView, UnknownError), apiTagAccount :: apiTagNewStyle :: Nil) @@ -5661,7 +5661,7 @@ trait APIMethods310 { |${getObpApiRoot}/v3.1.0/management/webui_props?active=true | |""", - emptyObjectJson, + EmptyBody, ListResult( "webui_props", (List(WebUiPropsCommons("webui_api_explorer_url", "https://apiexplorer.openbankproject.com", Some("web-ui-props-id")))) @@ -5802,8 +5802,8 @@ trait APIMethods310 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, UserHasMissingRoles, @@ -5835,7 +5835,7 @@ trait APIMethods310 { "/banks/BANK_ID/balances", "Get Accounts Balances", """Get the Balances for the Accounts of the current User at one bank.""", - emptyObjectJson, + EmptyBody, accountBalancesV310Json, List(UnknownError), apiTagAccount :: apiTagPSD2AIS :: apiTagPsd2 :: apiTagNewStyle :: Nil diff --git a/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala b/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala index 8d3ac5a7b..97d3ddc66 100644 --- a/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala +++ b/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala @@ -3648,7 +3648,7 @@ trait APIMethods400 { |CanGetAnyUser entitlement is required, | """.stripMargin, - emptyObjectJson, + EmptyBody, userJsonV400, List($UserNotLoggedIn, UserHasMissingRoles, UserNotFoundByUsername, UnknownError), List(apiTagUser, apiTagNewStyle), @@ -3684,7 +3684,7 @@ trait APIMethods400 { |CanGetAnyUser entitlement is required, | """.stripMargin, - emptyObjectJson, + EmptyBody, usersJsonV400, List($UserNotLoggedIn, UserHasMissingRoles, UserNotFoundByEmail, UnknownError), List(apiTagUser, apiTagNewStyle), @@ -3719,7 +3719,7 @@ trait APIMethods400 { |* locked_status (if null ignore) | """.stripMargin, - emptyObjectJson, + EmptyBody, usersJsonV400, List( $UserNotLoggedIn, @@ -5246,7 +5246,7 @@ trait APIMethods400 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, + EmptyBody, customersJsonV300, List( UserNotLoggedIn, @@ -5282,7 +5282,7 @@ trait APIMethods400 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, + EmptyBody, customersMinimalJsonV300, List( UserNotLoggedIn, @@ -5319,7 +5319,7 @@ trait APIMethods400 { | | """.stripMargin, - emptyObjectJson, + EmptyBody, scopeJsons, List(UserNotLoggedIn, EntitlementNotFound, ConsumerNotFoundByConsumerId, UnknownError), List(apiTagScope, apiTagConsumer, apiTagNewStyle)) @@ -12305,7 +12305,7 @@ trait APIMethods400 { s"""Get messages for the customer specified by CUSTOMER_ID ${authenticationRequiredMessage(true)} """, - emptyObjectJson, + EmptyBody, customerMessagesJsonV400, List( UserNotLoggedIn, diff --git a/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala b/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala index 7d897d93e..5e567bf6b 100644 --- a/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala +++ b/obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala @@ -1137,7 +1137,7 @@ trait APIMethods500 { """Gets all Customers that are linked to me. | |Authentication via OAuth is required.""", - emptyObjectJson, + EmptyBody, customerJsonV210, List( $UserNotLoggedIn, @@ -1172,7 +1172,7 @@ trait APIMethods500 { | | |${authenticationRequiredMessage(true)}""".stripMargin, - emptyObjectJson, + EmptyBody, customerJSONs, List( $UserNotLoggedIn, @@ -1216,7 +1216,7 @@ trait APIMethods500 { |${authenticationRequiredMessage(true)} | |""", - emptyObjectJson, + EmptyBody, customersJsonV300, List( UserNotLoggedIn, @@ -1252,7 +1252,7 @@ trait APIMethods500 { | | |""", - emptyObjectJson, + EmptyBody, customersMinimalJsonV300, List( UserCustomerLinksNotFoundForUser, @@ -1484,7 +1484,7 @@ trait APIMethods500 { |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, viewsJsonV500, List( $UserNotLoggedIn, @@ -1521,8 +1521,8 @@ trait APIMethods500 { "/system-views/VIEW_ID", "Delete System View", "Deletes the system view specified by VIEW_ID", - emptyObjectJson, - emptyObjectJson, + EmptyBody, + EmptyBody, List( UserNotLoggedIn, BankAccountNotFound, @@ -1609,7 +1609,7 @@ trait APIMethods500 { |16 duration (if null ignore) non digit chars will be silently omitted | """.stripMargin, - emptyObjectJson, + EmptyBody, metricsJson, List( $UserNotLoggedIn, @@ -1645,7 +1645,7 @@ trait APIMethods500 { |${authenticationRequiredMessage(true)} | """.stripMargin, - emptyObjectJson, + EmptyBody, viewJsonV500, List( $UserNotLoggedIn, @@ -1679,7 +1679,7 @@ trait APIMethods500 { |${authenticationRequiredMessage(true)} | """.stripMargin, - emptyObjectJson, + EmptyBody, viewIdsJsonV500, List( $UserNotLoggedIn, @@ -2048,7 +2048,7 @@ trait APIMethods500 { |${authenticationRequiredMessage(false)} | """.stripMargin, - emptyObjectJson, + EmptyBody, adapterInfoJsonV500, List($UserNotLoggedIn, UserHasMissingRoles, UnknownError), List(apiTagApi, apiTagNewStyle), From 2d7e92d2826b58491b3be6bfd3ead943ab6428ba Mon Sep 17 00:00:00 2001 From: hongwei Date: Wed, 2 Nov 2022 09:59:31 +0100 Subject: [PATCH 3/4] test/fixed the failed tests --- obp-api/src/main/scala/code/api/v3_0_0/APIMethods300.scala | 4 ++-- .../src/test/scala/code/api/v1_4_0/JSONFactory1_4_0Test.scala | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 6a6232d67..c32750667 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 @@ -766,7 +766,7 @@ trait APIMethods300 { | """, elasticSearchJsonV300, - EmptyBody, //TODO what is output here? + emptyObjectJson, //TODO what is output here? List(UserNotLoggedIn, UserHasMissingRoles, UnknownError), List(apiTagSearchWarehouse, apiTagNewStyle), Some(List(canSearchWarehouse))) @@ -845,7 +845,7 @@ trait APIMethods300 { | """, elasticSearchJsonV300, - EmptyBody, //TODO what is output here? + emptyObjectJson, //TODO what is output here? List(UserNotLoggedIn, UserHasMissingRoles, UnknownError), List(apiTagSearchWarehouse, apiTagNewStyle), Some(List(canSearchWarehouseStatistics)) diff --git a/obp-api/src/test/scala/code/api/v1_4_0/JSONFactory1_4_0Test.scala b/obp-api/src/test/scala/code/api/v1_4_0/JSONFactory1_4_0Test.scala index 5d54a1382..1256d0810 100644 --- a/obp-api/src/test/scala/code/api/v1_4_0/JSONFactory1_4_0Test.scala +++ b/obp-api/src/test/scala/code/api/v1_4_0/JSONFactory1_4_0Test.scala @@ -100,7 +100,7 @@ class JSONFactory1_4_0Test extends V140ServerSetup with DefaultUsers { val resourceDocs = JSONFactory1_4_0.createResourceDocsJson(resourceDocsRaw.toList,false, None) for{ - resouceDoc <- resourceDocs.resource_docs + resouceDoc <- resourceDocs.resource_docs if (resouceDoc.request_verb != "DELETE") json <- List(compactRender(decompose(resouceDoc.success_response_body))) jsonSchema <- List(compactRender(resouceDoc.typed_success_response_body)) } yield { From f8cd12ebaedb64b63c065f4512334c7c1048bc78 Mon Sep 17 00:00:00 2001 From: hongwei Date: Wed, 2 Nov 2022 10:00:39 +0100 Subject: [PATCH 4/4] refactor/rename resouce -> resource --- .../test/scala/code/api/v1_4_0/JSONFactory1_4_0Test.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/obp-api/src/test/scala/code/api/v1_4_0/JSONFactory1_4_0Test.scala b/obp-api/src/test/scala/code/api/v1_4_0/JSONFactory1_4_0Test.scala index 1256d0810..f2308bf01 100644 --- a/obp-api/src/test/scala/code/api/v1_4_0/JSONFactory1_4_0Test.scala +++ b/obp-api/src/test/scala/code/api/v1_4_0/JSONFactory1_4_0Test.scala @@ -95,14 +95,14 @@ class JSONFactory1_4_0Test extends V140ServerSetup with DefaultUsers { // logger.debug(prettyRender(result)) } - scenario("validate all the resouceDocs json schema, no exception is good enough") { + scenario("validate all the resourceDocs json schema, no exception is good enough") { val resourceDocsRaw= OBPAPI3_0_0.allResourceDocs val resourceDocs = JSONFactory1_4_0.createResourceDocsJson(resourceDocsRaw.toList,false, None) for{ - resouceDoc <- resourceDocs.resource_docs if (resouceDoc.request_verb != "DELETE") - json <- List(compactRender(decompose(resouceDoc.success_response_body))) - jsonSchema <- List(compactRender(resouceDoc.typed_success_response_body)) + resourceDoc <- resourceDocs.resource_docs if (resourceDoc.request_verb != "DELETE") + json <- List(compactRender(decompose(resourceDoc.success_response_body))) + jsonSchema <- List(compactRender(resourceDoc.typed_success_response_body)) } yield { val rawSchema = new JSONObject(jsonSchema) val schema = SchemaLoader.load(rawSchema)