cleanup after self-review
This commit is contained in:
parent
ad60100614
commit
f4a7c80e7a
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user