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 HsHostingAssetTypeResource assetType) {
|
||||||
|
|
||||||
final var propValidators = HsHostingAssetValidator.forType(HsHostingAssetType.of(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();
|
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) {
|
private List<Object> toListOfObjects(final List<Map<String, Object>> resource) {
|
||||||
// final var target = new LinkedHashMap<>(source);
|
// OpenApi ony generates List<Object> not List<Map<String, Object>> for the Java interface.
|
||||||
// target.put("type", source,)
|
// But Spring properly converts the List of Maps, thus we can simply cast the type:
|
||||||
// return target;
|
//noinspection rawtypes,unchecked
|
||||||
// }
|
return (List) resource;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ paths:
|
|||||||
/api/hs/hosting/assets/{assetUuid}:
|
/api/hs/hosting/assets/{assetUuid}:
|
||||||
$ref: "hs-hosting-assets-with-uuid.yaml"
|
$ref: "hs-hosting-assets-with-uuid.yaml"
|
||||||
|
|
||||||
|
# Asset-Types
|
||||||
|
|
||||||
/api/hs/hosting/asset-types:
|
/api/hs/hosting/asset-types:
|
||||||
$ref: "hs-hosting-asset-types.yaml"
|
$ref: "hs-hosting-asset-types.yaml"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user