Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add OpenAPI descriptions for Pool #397

Merged
merged 2 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,12 +21,14 @@ 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.IdentifierTypeDescription

@Schema(name = "IdentifierTypeDetailDto", description = "Identifier type validity details")
@Schema(description = IdentifierTypeDescription.headerDetail)
data class IdentifierTypeDetailDto(
@get:Schema(description = "Country in which this identifier is valid, null for universal identifiers")

@get:Schema(description = IdentifierTypeDescription.detailCountry)
val country: CountryCode?,

@get:Schema(description = "True if identifier is mandatory in this country")
@get:Schema(description = IdentifierTypeDescription.detailMandatory)
val mandatory: Boolean
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,20 @@
package org.eclipse.tractusx.bpdm.common.dto

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

@Schema(name = "IdentifierTypeDto", description = "Identifier type definition for legal entity or address")
@Schema(description = IdentifierTypeDescription.header)
data class IdentifierTypeDto(

@get:Schema(description = "Unique key (in combination with businessPartnerType) to be used as reference")
@get:Schema(description = IdentifierTypeDescription.technicalKey)
val technicalKey: String,

@get:Schema(description = "Specifies if this identifier type is valid for legal entities (L) or addresses (A)")
@get:Schema(description = IdentifierTypeDescription.businessPartnerType)
val businessPartnerType: IdentifierBusinessPartnerType,

@get:Schema(description = "Full name")
@get:Schema(description = IdentifierTypeDescription.name)
val name: String,

@get:Schema(description = "Validity details")
@get:Schema(description = IdentifierTypeDescription.details)
val details: Collection<IdentifierTypeDetailDto> = listOf()
)
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 = LogisticAddressDescription.header)
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
)
Loading