From cba95580d31f60564fd7ce31c3432b456836cac1 Mon Sep 17 00:00:00 2001 From: ndr_brt Date: Fri, 20 Oct 2023 12:56:13 +0200 Subject: [PATCH] docs: add free form properties schema type (#3555) * docs: add missing additional properties true on free-form properties attributes * docs: add a free form properties schema type --- .../management/configuration/ManagementApiSchema.java | 3 +++ .../connector/api/management/asset/v3/AssetApi.java | 10 ++++------ .../transferprocess/TransferProcessApi.java | 11 ++++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/extensions/common/api/management-api-configuration/src/main/java/org/eclipse/edc/connector/api/management/configuration/ManagementApiSchema.java b/extensions/common/api/management-api-configuration/src/main/java/org/eclipse/edc/connector/api/management/configuration/ManagementApiSchema.java index c32bfa17e35..f72ee111154 100644 --- a/extensions/common/api/management-api-configuration/src/main/java/org/eclipse/edc/connector/api/management/configuration/ManagementApiSchema.java +++ b/extensions/common/api/management-api-configuration/src/main/java/org/eclipse/edc/connector/api/management/configuration/ManagementApiSchema.java @@ -96,6 +96,9 @@ record DataAddressSchema( """; } + @Schema(name = "Properties", additionalProperties = Schema.AdditionalPropertiesValue.TRUE) + record FreeFormPropertiesSchema() {} + @Schema(name = "Policy", description = "ODRL policy", example = PolicySchema.POLICY_EXAMPLE) record PolicySchema() { public static final String POLICY_EXAMPLE = """ diff --git a/extensions/control-plane/api/management-api/asset-api/src/main/java/org/eclipse/edc/connector/api/management/asset/v3/AssetApi.java b/extensions/control-plane/api/management-api/asset-api/src/main/java/org/eclipse/edc/connector/api/management/asset/v3/AssetApi.java index d972d127947..73385b7d00a 100644 --- a/extensions/control-plane/api/management-api/asset-api/src/main/java/org/eclipse/edc/connector/api/management/asset/v3/AssetApi.java +++ b/extensions/control-plane/api/management-api/asset-api/src/main/java/org/eclipse/edc/connector/api/management/asset/v3/AssetApi.java @@ -28,8 +28,6 @@ import org.eclipse.edc.api.model.ApiCoreSchema; import org.eclipse.edc.connector.api.management.configuration.ManagementApiSchema; -import java.util.Map; - import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.CONTEXT; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; @@ -112,8 +110,8 @@ record AssetInputSchema( @Schema(name = TYPE, example = EDC_ASSET_TYPE) String type, @Schema(requiredMode = REQUIRED) - Map properties, - Map privateProperties, + ManagementApiSchema.FreeFormPropertiesSchema properties, + ManagementApiSchema.FreeFormPropertiesSchema privateProperties, @Schema(requiredMode = REQUIRED) ManagementApiSchema.DataAddressSchema dataAddress ) { @@ -142,8 +140,8 @@ record AssetOutputSchema( String id, @Schema(name = TYPE, example = EDC_ASSET_TYPE) String type, - Map properties, - Map privateProperties, + ManagementApiSchema.FreeFormPropertiesSchema properties, + ManagementApiSchema.FreeFormPropertiesSchema privateProperties, ManagementApiSchema.DataAddressSchema dataAddress, long createdAt ) { diff --git a/extensions/control-plane/api/management-api/transfer-process-api/src/main/java/org/eclipse/edc/connector/api/management/transferprocess/TransferProcessApi.java b/extensions/control-plane/api/management-api/transfer-process-api/src/main/java/org/eclipse/edc/connector/api/management/transferprocess/TransferProcessApi.java index 3d0b675630b..52674d7b0d6 100644 --- a/extensions/control-plane/api/management-api/transfer-process-api/src/main/java/org/eclipse/edc/connector/api/management/transferprocess/TransferProcessApi.java +++ b/extensions/control-plane/api/management-api/transfer-process-api/src/main/java/org/eclipse/edc/connector/api/management/transferprocess/TransferProcessApi.java @@ -32,7 +32,6 @@ import org.eclipse.edc.connector.transfer.spi.types.TransferProcess; import java.util.List; -import java.util.Map; import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import static org.eclipse.edc.connector.transfer.spi.types.TransferProcess.TRANSFER_PROCESS_TYPE; @@ -140,8 +139,9 @@ record TransferRequestSchema( @Schema(requiredMode = REQUIRED) ManagementApiSchema.DataAddressSchema dataDestination, @Schema(deprecated = true, description = "Deprecated as this field is not used anymore, please use privateProperties instead") - Map properties, - Map privateProperties, + ManagementApiSchema.FreeFormPropertiesSchema properties, + @Schema(additionalProperties = Schema.AdditionalPropertiesValue.TRUE) + ManagementApiSchema.FreeFormPropertiesSchema privateProperties, List callbackAddresses) { public static final String TRANSFER_REQUEST_EXAMPLE = """ @@ -185,8 +185,9 @@ record TransferProcessSchema( String errorDetail, @Deprecated(since = "0.2.0") @Schema(deprecated = true) - Map properties, - Map privateProperties, + ManagementApiSchema.FreeFormPropertiesSchema properties, + ManagementApiSchema.DataAddressSchema dataDestination, + ManagementApiSchema.FreeFormPropertiesSchema privateProperties, List callbackAddresses ) { public static final String TRANSFER_PROCESS_EXAMPLE = """