diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsController.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsController.java index e15b906d..8a3f1523 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsController.java @@ -26,17 +26,14 @@ public class HsHostingAssetPropsController implements HsHostingAssetPropsApi { final HsHostingAssetTypeResource assetType) { final var propValidators = HsHostingAssetValidator.forType(HsHostingAssetType.of(assetType)); -// final List> resource = propValidators.properties() -// .stream() -// .map(HsHostingAssetPropsController::simplifyTypeProperty) -// .toList(); final List> resource = propValidators.properties(); - return ResponseEntity.ok((List)resource); + return ResponseEntity.ok(toListOfObjects(resource)); } -// private static Map simplifyTypeProperty(Map source) { -// final var target = new LinkedHashMap<>(source); -// target.put("type", source,) -// return target; -// } + private List toListOfObjects(final List> resource) { + // OpenApi ony generates List not List> for the Java interface. + // But Spring properly converts the List of Maps, thus we can simply cast the type: + //noinspection rawtypes,unchecked + return (List) resource; + } } diff --git a/src/main/resources/api-definition/hs-hosting/hs-hosting.yaml b/src/main/resources/api-definition/hs-hosting/hs-hosting.yaml index e83b8436..b0df69dc 100644 --- a/src/main/resources/api-definition/hs-hosting/hs-hosting.yaml +++ b/src/main/resources/api-definition/hs-hosting/hs-hosting.yaml @@ -16,6 +16,8 @@ paths: /api/hs/hosting/assets/{assetUuid}: $ref: "hs-hosting-assets-with-uuid.yaml" + # Asset-Types + /api/hs/hosting/asset-types: $ref: "hs-hosting-asset-types.yaml"