Skip to content

Commit

Permalink
feat(dto): API text descriptions - Pool DTOs
Browse files Browse the repository at this point in the history
  • Loading branch information
martinfkaeser committed Aug 17, 2023
1 parent 94cceca commit 62d44fb
Show file tree
Hide file tree
Showing 70 changed files with 851 additions and 275 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.AddressIdentifierDescription

@Schema(name = "AddressIdentifier", description = "Identifier record for a logistic address")
@Schema(description = AddressIdentifierDescription.header)
data class AddressIdentifierDto(
@get:Schema(description = "Value of the identifier")

@get:Schema(description = AddressIdentifierDescription.value)
val value: String,

@get:Schema(description = "Technical key of the type to which this identifier belongs to")
@get:Schema(description = AddressIdentifierDescription.type)
val type: String,
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@
package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.AddressStateDescription
import org.eclipse.tractusx.bpdm.common.model.BusinessStateType
import java.time.LocalDateTime

@Schema(name = "AddressState", description = "Status record for a address")
@Schema(description = AddressStateDescription.header)
data class AddressStateDto(
@get:Schema(description = "Description of the status")

@get:Schema(description = AddressStateDescription.description)
val description: String?,

@get:Schema(description = "Since when the status is/was valid")
@get:Schema(description = AddressStateDescription.validFrom)
val validFrom: LocalDateTime?,

@get:Schema(description = "Until the status was valid, if applicable")
@get:Schema(description = AddressStateDescription.validTo)
val validTo: LocalDateTime?,

@get:Schema(description = "The type of this specified status")
@get:Schema(description = AddressStateDescription.type)
val type: BusinessStateType
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ package org.eclipse.tractusx.bpdm.common.dto
import com.fasterxml.jackson.annotation.JsonUnwrapped
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.PostalAddressDescription
import org.eclipse.tractusx.bpdm.common.model.DeliveryServiceType
import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializer

@JsonDeserialize(using = DataClassUnwrappedJsonDeserializer::class)
@Schema(name = "AlternativePostalAddress", description = "Alternative Postal Address Part")
@Schema(description = PostalAddressDescription.headerAlternative)
data class AlternativePostalAddressDto(

@field:JsonUnwrapped
Expand All @@ -35,12 +36,12 @@ data class AlternativePostalAddressDto(
@field:JsonUnwrapped
val areaPart: AreaDistrictAlternativDto,

@get:Schema(description = "Describes the PO Box or private Bag number the delivery should be placed at.")
@get:Schema(description = PostalAddressDescription.deliveryServiceNumber)
val deliveryServiceNumber: String = "",

@get:Schema(description = "The type of this specified delivery")
@get:Schema(description = PostalAddressDescription.deliveryServiceType)
val deliveryServiceType: DeliveryServiceType = DeliveryServiceType.PO_BOX,

@get:Schema(description = "Delivery Service Qualifier")
@get:Schema(description = PostalAddressDescription.deliveryServiceQualifier)
val deliveryServiceQualifier: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.PostalAddressDescription

@Schema(name = "AreaDistrictDto", description = "Record for administrativeAreaLevel and district part of an alternativ address")
data class AreaDistrictAlternativDto(

@get:Schema(description = "Identifying code of the Region within the country (e.g. Bayern)")
@get:Schema(description = PostalAddressDescription.administrativeAreaLevel1)
val administrativeAreaLevel1: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.PostalAddressDescription

@Schema(name = "AreaDistrictDto", description = "Record for administrativeAreaLevel and district part of an address")
data class AreaDistrictDto(

@get:Schema(description = "Identifying code of the Region within the country (e.g. Bayern)")
@get:Schema(description = PostalAddressDescription.administrativeAreaLevel1)
val administrativeAreaLevel1: String? = null,

@get:Schema(description = "Further possibility to describe the region/address(e.g. County/Landkreis)")
@get:Schema(description = PostalAddressDescription.administrativeAreaLevel2)
val administrativeAreaLevel2: String? = null,

@get:Schema(description = "Further possibility to describe the region/address(e.g. Township/Gemeinde)")
@get:Schema(description = PostalAddressDescription.administrativeAreaLevel3)
val administrativeAreaLevel3: String? = null,

@get:Schema(description = "Divides the city in several smaller areas")
@get:Schema(description = PostalAddressDescription.district)
val district: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@
package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.PostalAddressDescription

@Schema(name = "BasePhysicalAddressDto", description = "Address record for the basical physical address fields")
data class BasePhysicalAddressDto(

@get:Schema(description = "A separate postal code for a company, also known as postcode, PIN or ZIP Code")
@get:Schema(description = PostalAddressDescription.companyPostalCode)
val companyPostalCode: String? = null,

@get:Schema(description = "The practice of designating an area for industrial development")
@get:Schema(description = PostalAddressDescription.industrialZone)
val industrialZone: String? = null,

@get:Schema(description = "Describes a specific building within the address")
@get:Schema(description = PostalAddressDescription.building)
val building: String? = null,

@get:Schema(description = "Describes the floor/level the delivery shall take place")
@get:Schema(description = PostalAddressDescription.floor)
val floor: String? = null,

@get:Schema(description = "Describes the door/room/suite on the respective floor the delivery shall take place")
@get:Schema(description = PostalAddressDescription.door)
val door: String? = null,
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ package org.eclipse.tractusx.bpdm.common.dto

import com.neovisionaries.i18n.CountryCode
import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.PostalAddressDescription

@Schema(name = "PostalAdress", description = "Address record for a business partner")
data class BasePostalAddressDto(

@get:Schema(description = "Geographic coordinates to find this location")
// TODO OpenAPI description for complex field does not work!!
@get:Schema(description = PostalAddressDescription.headerGeoCoordinates)
val geographicCoordinates: GeoCoordinateDto? = null,

@get:Schema(description = "Describes the country")
@get:Schema(description = PostalAddressDescription.country)
val country: CountryCode,

@get:Schema(description = "A postal code, also known as postcode, PIN or ZIP Code")
@get:Schema(description = PostalAddressDescription.postalCode)
val postalCode: String? = null,

@get:Schema(description = "The city of the address (Synonym: Town, village, municipality)")
@get:Schema(description = PostalAddressDescription.city)
val city: String,

)
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@
package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.ClassificationDescription
import org.eclipse.tractusx.bpdm.common.model.ClassificationType

@Schema(name = "Classification", description = "Classification record for a business partner")
@Schema(description = ClassificationDescription.header)
data class ClassificationDto(
@get:Schema(description = "Name of the classification")

@get:Schema(description = ClassificationDescription.value)
val value: String?,

@get:Schema(description = "Identifying code of the classification, if applicable")
@get:Schema(description = ClassificationDescription.code)
val code: String?,

@get:Schema(description = "Type of specified classification")
@get:Schema(description = ClassificationDescription.type)
val type: ClassificationType
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.PostalAddressDescription

@Schema(name = "GeoCoordinates", description = "Geo coordinates record for an address")
@Schema(description = PostalAddressDescription.headerGeoCoordinates)
data class GeoCoordinateDto(

@get:Schema(description = "Longitude coordinate")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,22 @@ package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.ArraySchema
import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.LegalEntityDescription

@Schema(name = "LegalEntity")
@Schema(description = LegalEntityDescription.header)
data class LegalEntityDto(
@ArraySchema(arraySchema = Schema(description = "Additional identifiers (except BPN)", required = false))
@get:ArraySchema(arraySchema = Schema(description = LegalEntityDescription.identifiers, required = false))
val identifiers: Collection<LegalEntityIdentifierDto> = emptyList(),
@get:Schema(description = "Abbreviated name or shorthand")

@get:Schema(description = LegalEntityDescription.legalShortName)
val legalShortName: String?,

@get:Schema(description = "Technical key of the legal form")
@get:Schema(description = LegalEntityDescription.legalForm)
val legalForm: String? = null,

@ArraySchema(arraySchema = Schema(description = "Business status"))
@get:ArraySchema(arraySchema = Schema(description = LegalEntityDescription.states))
val states: Collection<LegalEntityStateDto> = emptyList(),

@ArraySchema(arraySchema = Schema(description = "Classifications", required = false))
@get:ArraySchema(arraySchema = Schema(description = LegalEntityDescription.classifications, required = false))
val classifications: Collection<ClassificationDto> = emptyList(),


)
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@
package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.LegalEntityIdentifierDescription

@Schema(name = "LegalEntityIdentifier", description = "Identifier record for a legal entity")
@Schema(description = LegalEntityIdentifierDescription.header)
data class LegalEntityIdentifierDto(
@get:Schema(description = "Value of the identifier")

@get:Schema(description = LegalEntityIdentifierDescription.value)
val value: String,

@get:Schema(description = "Technical key of the type to which this identifier belongs to")
@get:Schema(description = LegalEntityIdentifierDescription.type)
val type: String,

@get:Schema(description = "Body which issued the identifier")
@get:Schema(description = LegalEntityIdentifierDescription.issuingBody)
val issuingBody: String?
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@
package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.LegalEntityStateDescription
import org.eclipse.tractusx.bpdm.common.model.BusinessStateType
import java.time.LocalDateTime

@Schema(name = "LegalEntityState", description = "Status record of a legal entity")
@Schema(description = LegalEntityStateDescription.header)
data class LegalEntityStateDto(
@get:Schema(description = "Exact, official denotation of the status")

@get:Schema(description = LegalEntityStateDescription.description)
val description: String?,

@get:Schema(description = "Since when the status is/was valid")
@get:Schema(description = LegalEntityStateDescription.validFrom)
val validFrom: LocalDateTime?,

@get:Schema(description = "Until the status was valid, if applicable")
@get:Schema(description = LegalEntityStateDescription.validTo)
val validTo: LocalDateTime?,

@get:Schema(description = "The type of this specified status")
@get:Schema(description = LegalEntityStateDescription.type)
val type: BusinessStateType
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.ArraySchema
import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.LogisticAddressDescription


@Schema(name = "LogisticAddressDto", description = "Address record for a business partner")
@Schema(description = "Address record for a business partner")
data class LogisticAddressDto(
@get:Schema(
description = "Name of the logistic address of the business partner. This is not according to official\n" +
"registers but according to the name the uploading sharing member chooses."
)
@get:Schema(description = LogisticAddressDescription.name)
val name: String? = null,

@ArraySchema(arraySchema = Schema(description = "Indicates if the LogisticAddress is \"Active\" or \"Inactive\"."))
@get:ArraySchema(arraySchema = Schema(description = LogisticAddressDescription.states))
val states: Collection<AddressStateDto> = emptyList(),

@ArraySchema(arraySchema = Schema(description = "List of identifiers"))
@get:ArraySchema(arraySchema = Schema(description = LogisticAddressDescription.identifiers))
val identifiers: Collection<AddressIdentifierDto> = emptyList(),

@get:Schema(description = "Physical postal address")
// TODO OpenAPI description for complex field does not work!!
@get:Schema(description = LogisticAddressDescription.physicalPostalAddress)
val physicalPostalAddress: PhysicalPostalAddressDto,

@get:Schema(description = "Alternative postal address")
// TODO OpenAPI description for complex field does not work!!
@get:Schema(description = LogisticAddressDescription.alternativePostalAddress)
val alternativePostalAddress: AlternativePostalAddressDto? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@ package org.eclipse.tractusx.bpdm.common.dto
import com.fasterxml.jackson.annotation.JsonUnwrapped
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.PostalAddressDescription
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.StreetDescription
import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializer

@JsonDeserialize(using = DataClassUnwrappedJsonDeserializer::class)
@Schema(name = "PhysicalPostalAddress", description = "Physical Postal Address Part")
@Schema(description = PostalAddressDescription.headerPhysical)
data class PhysicalPostalAddressDto(

@field:JsonUnwrapped
val baseAddress: BasePostalAddressDto,

@get:Schema(description = "Address Street")
// TODO OpenAPI description for complex field does not work!!
@get:Schema(description = StreetDescription.header)
val street: StreetDto? = null,

@field:JsonUnwrapped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@ package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.ArraySchema
import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.SiteDescription

@Schema(name = "Site", description = "Site record")
@Schema(description = SiteDescription.header)
data class SiteDto(
@get:Schema(description = "Site name")

@get:Schema(description = SiteDescription.name)
val name: String,

@ArraySchema(arraySchema = Schema(description = "Business status"))
@ArraySchema(arraySchema = Schema(description = SiteDescription.states))
val states: Collection<SiteStateDto> = emptyList(),

@get:Schema(description = "Main address where this site resides")
// TODO OpenAPI description for complex field does not work!!
@get:Schema(description = SiteDescription.mainAddress)
val mainAddress: LogisticAddressDto
)
Loading

0 comments on commit 62d44fb

Please sign in to comment.