From d87576afe8e6aefa4ef82c45b577fc96eb8dca58 Mon Sep 17 00:00:00 2001 From: Martin Kaeser Date: Thu, 4 May 2023 11:05:24 +0200 Subject: [PATCH 1/2] fix(pool-api): Add @RequestParam annotations --- .../bpdm/pool/api/PoolBusinessPartnerApi.kt | 7 +++--- .../bpdm/pool/api/PoolSuggestionApi.kt | 25 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolBusinessPartnerApi.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolBusinessPartnerApi.kt index 437652f04..24df41800 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolBusinessPartnerApi.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolBusinessPartnerApi.kt @@ -26,12 +26,13 @@ import io.swagger.v3.oas.annotations.Parameter import io.swagger.v3.oas.annotations.media.Content import io.swagger.v3.oas.annotations.responses.ApiResponse import io.swagger.v3.oas.annotations.responses.ApiResponses -import org.eclipse.tractusx.bpdm.common.dto.response.PageResponse import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest +import org.eclipse.tractusx.bpdm.common.dto.response.PageResponse import org.eclipse.tractusx.bpdm.pool.api.model.response.ChangelogEntryResponse import org.springdoc.core.annotations.ParameterObject import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.service.annotation.GetExchange import org.springframework.web.service.annotation.HttpExchange import java.time.Instant @@ -54,8 +55,8 @@ interface PoolBusinessPartnerApi { @GetMapping("/changelog") @GetExchange("/changelog") fun getChangelogEntries( - @Parameter(description = "BPN values") bpn: Array?, - @Parameter(description = "Modified after") modifiedAfter: Instant?, + @Parameter(description = "BPN values") @RequestParam(required = false) bpn: Array?, + @Parameter(description = "Modified after") @RequestParam(required = false) modifiedAfter: Instant?, @ParameterObject paginationRequest: PaginationRequest ): PageResponse } \ No newline at end of file diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolSuggestionApi.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolSuggestionApi.kt index 979ee11f9..b8f448836 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolSuggestionApi.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolSuggestionApi.kt @@ -22,15 +22,16 @@ package org.eclipse.tractusx.bpdm.pool.api import io.swagger.v3.oas.annotations.Operation import io.swagger.v3.oas.annotations.Parameter import io.swagger.v3.oas.annotations.responses.ApiResponse +import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.response.PageResponse import org.eclipse.tractusx.bpdm.pool.api.model.request.AddressPropertiesSearchRequest import org.eclipse.tractusx.bpdm.pool.api.model.request.LegalEntityPropertiesSearchRequest -import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.pool.api.model.request.SitePropertiesSearchRequest import org.eclipse.tractusx.bpdm.pool.api.model.response.SuggestionResponse import org.springdoc.core.annotations.ParameterObject import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.service.annotation.GetExchange import org.springframework.web.service.annotation.HttpExchange @@ -48,7 +49,7 @@ interface PoolSuggestionApi { @GetMapping("legal-entities/names") @GetExchange("legal-entities/names") fun getNameSuggestion( - @Parameter(description = "Show names best matching this text") text: String?, + @Parameter(description = "Show names best matching this text") @RequestParam(required = false) text: String?, @ParameterObject bpSearchRequest: LegalEntityPropertiesSearchRequest, @ParameterObject addressSearchRequest: AddressPropertiesSearchRequest, @ParameterObject siteSearchRequest: SitePropertiesSearchRequest, @@ -65,7 +66,7 @@ interface PoolSuggestionApi { @GetMapping("legal-entities/legal-forms") @GetExchange("legal-entities/legal-forms") fun getLegalFormSuggestion( - @Parameter(description = "Show legal form names best matching this text") text: String?, + @Parameter(description = "Show legal form names best matching this text") @RequestParam(required = false) text: String?, @ParameterObject bpSearchRequest: LegalEntityPropertiesSearchRequest, @ParameterObject addressSearchRequest: AddressPropertiesSearchRequest, @ParameterObject siteSearchRequest: SitePropertiesSearchRequest, @@ -82,7 +83,7 @@ interface PoolSuggestionApi { @GetMapping("sites/names") @GetExchange("sites/names") fun getSiteSuggestion( - @Parameter(description = "Show site names best matching this text") text: String?, + @Parameter(description = "Show site names best matching this text") @RequestParam(required = false) text: String?, @ParameterObject bpSearchRequest: LegalEntityPropertiesSearchRequest, @ParameterObject addressSearchRequest: AddressPropertiesSearchRequest, @ParameterObject siteSearchRequest: SitePropertiesSearchRequest, @@ -99,7 +100,7 @@ interface PoolSuggestionApi { @GetMapping("legal-entities/statuses") @GetExchange("legal-entities/statuses") fun getStatusSuggestion( - @Parameter(description = "Show business status denotations best matching this text") text: String?, + @Parameter(description = "Show business status denotations best matching this text") @RequestParam(required = false) text: String?, @ParameterObject bpSearchRequest: LegalEntityPropertiesSearchRequest, @ParameterObject addressSearchRequest: AddressPropertiesSearchRequest, @ParameterObject siteSearchRequest: SitePropertiesSearchRequest, @@ -116,7 +117,7 @@ interface PoolSuggestionApi { @GetMapping("legal-entities/classifications") @GetExchange("legal-entities/classifications") fun getClassificationSuggestion( - @Parameter(description = "Show business partner classifications best matching this text") text: String?, + @Parameter(description = "Show business partner classifications best matching this text") @RequestParam(required = false) text: String?, @ParameterObject bpSearchRequest: LegalEntityPropertiesSearchRequest, @ParameterObject addressSearchRequest: AddressPropertiesSearchRequest, @ParameterObject siteSearchRequest: SitePropertiesSearchRequest, @@ -132,7 +133,7 @@ interface PoolSuggestionApi { @GetMapping("/addresses/administrative-areas") @GetExchange("/addresses/administrative-areas") fun getAdminAreaSuggestion( - @Parameter(description = "Show administrative area names best matching this text") text: String?, + @Parameter(description = "Show administrative area names best matching this text") @RequestParam(required = false) text: String?, @ParameterObject bpSearchRequest: LegalEntityPropertiesSearchRequest, @ParameterObject addressSearchRequest: AddressPropertiesSearchRequest, @ParameterObject siteSearchRequest: SitePropertiesSearchRequest, @@ -149,7 +150,7 @@ interface PoolSuggestionApi { @GetMapping("/addresses/postcodes") @GetExchange("/addresses/postcodes") fun getPostcodeSuggestion( - @Parameter(description = "Show postcodes best matching this text") text: String?, + @Parameter(description = "Show postcodes best matching this text") @RequestParam(required = false) text: String?, @ParameterObject bpSearchRequest: LegalEntityPropertiesSearchRequest, @ParameterObject addressSearchRequest: AddressPropertiesSearchRequest, @ParameterObject siteSearchRequest: SitePropertiesSearchRequest, @@ -166,7 +167,7 @@ interface PoolSuggestionApi { @GetMapping("/addresses/localities") @GetExchange("/addresses/localities") fun getLocalitySuggestion( - @Parameter(description = "Show locality names this text") text: String?, + @Parameter(description = "Show locality names this text") @RequestParam(required = false) text: String?, @ParameterObject bpSearchRequest: LegalEntityPropertiesSearchRequest, @ParameterObject addressSearchRequest: AddressPropertiesSearchRequest, @ParameterObject siteSearchRequest: SitePropertiesSearchRequest, @@ -183,7 +184,7 @@ interface PoolSuggestionApi { @GetMapping("/addresses/thoroughfares") @GetExchange("/addresses/thoroughfares") fun getThoroughfareSuggestion( - @Parameter(description = "Show thoroughfare names best matching this text") text: String?, + @Parameter(description = "Show thoroughfare names best matching this text") @RequestParam(required = false) text: String?, @ParameterObject bpSearchRequest: LegalEntityPropertiesSearchRequest, @ParameterObject addressSearchRequest: AddressPropertiesSearchRequest, @ParameterObject siteSearchRequest: SitePropertiesSearchRequest, @@ -200,7 +201,7 @@ interface PoolSuggestionApi { @GetMapping("/addresses/premises") @GetExchange("/addresses/premises") fun getPremiseSuggestion( - @Parameter(description = "Show premise names best matching this text") text: String?, + @Parameter(description = "Show premise names best matching this text") @RequestParam(required = false) text: String?, @ParameterObject bpSearchRequest: LegalEntityPropertiesSearchRequest, @ParameterObject addressSearchRequest: AddressPropertiesSearchRequest, @ParameterObject siteSearchRequest: SitePropertiesSearchRequest, @@ -217,7 +218,7 @@ interface PoolSuggestionApi { @GetMapping("/addresses/postal-delivery-points") @GetExchange("/addresses/postal-delivery-points") fun getPostalDeliverPointSuggestion( - @Parameter(description = "Show postal delivery point names best matching this text") text: String?, + @Parameter(description = "Show postal delivery point names best matching this text") @RequestParam(required = false) text: String?, @ParameterObject bpSearchRequest: LegalEntityPropertiesSearchRequest, @ParameterObject addressSearchRequest: AddressPropertiesSearchRequest, @ParameterObject siteSearchRequest: SitePropertiesSearchRequest, From eb0175df51a177a78c134a5861aa6734ca759b0c Mon Sep 17 00:00:00 2001 From: Martin Kaeser Date: Thu, 4 May 2023 11:06:37 +0200 Subject: [PATCH 2/2] fix(pool-api): Fix typo --- .../eclipse/tractusx/bpdm/pool/api/client/PoolClientImpl.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/client/PoolClientImpl.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/client/PoolClientImpl.kt index e0ba1839c..2f2e389a0 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/client/PoolClientImpl.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/client/PoolClientImpl.kt @@ -35,13 +35,12 @@ class PoolClientImpl( .builder(WebClientAdapter.forClient(webClientProvider())) .customArgumentResolver(ParameterObjectArgumentResolver()) .build() - } private val poolClientAddress by lazy { httpServiceProxyFactory.createClient(PoolAddressApi::class.java) } private val poolClientBpn by lazy { httpServiceProxyFactory.createClient(PoolBpnApi::class.java) } - private val oolClientBusinessPartner by lazy { httpServiceProxyFactory.createClient(PoolBusinessPartnerApi::class.java) } + private val poolClientBusinessPartner by lazy { httpServiceProxyFactory.createClient(PoolBusinessPartnerApi::class.java) } private val poolClientLegalEntity by lazy { httpServiceProxyFactory.createClient(PoolLegalEntityApi::class.java) } private val poolClientMetadata by lazy { httpServiceProxyFactory.createClient(PoolMetadataApi::class.java) } private val poolClientSite by lazy { httpServiceProxyFactory.createClient(PoolSiteApi::class.java) } @@ -53,7 +52,7 @@ class PoolClientImpl( override fun bpns() = poolClientBpn - override fun businessPartners() = oolClientBusinessPartner + override fun businessPartners() = poolClientBusinessPartner override fun legalEntities() = poolClientLegalEntity