hosting-asset-validation-for-cloud-server-to-webspace #54

Merged
hsh-michaelhoennig merged 7 commits from hosting-asset-validation-for-cloud-server-to-webspace into master 2024-05-06 10:51:00 +02:00
2 changed files with 9 additions and 10 deletions
Showing only changes of commit f4a7c80e7a - Show all commits

View File

@ -26,17 +26,14 @@ public class HsHostingAssetPropsController implements HsHostingAssetPropsApi {
final HsHostingAssetTypeResource assetType) {
final var propValidators = HsHostingAssetValidator.forType(HsHostingAssetType.of(assetType));
// final List<Map<String, Object>> resource = propValidators.properties()
// .stream()
// .map(HsHostingAssetPropsController::simplifyTypeProperty)
// .toList();
final List<Map<String, Object>> resource = propValidators.properties();
return ResponseEntity.ok((List)resource);
return ResponseEntity.ok(toListOfObjects(resource));
}
// private static Map<String, Object> simplifyTypeProperty(Map<String, Object> source) {
// final var target = new LinkedHashMap<>(source);
// target.put("type", source,)
// return target;
// }
private List<Object> toListOfObjects(final List<Map<String, Object>> resource) {
// OpenApi ony generates List<Object> not List<Map<String, Object>> 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;
}
}

View File

@ -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"