This commit is contained in:
2026-08-25 12:27:47 +08:00
parent 0e0b6f8264
commit 4b5e5a1e4e
13 changed files with 183 additions and 33 deletions
@@ -69,6 +69,33 @@ class NotificationOpenApiContractTest {
assertThat(map(map(taskDetail.get("properties")).get("attemptCount")))
.containsEntry("minimum", 0).containsEntry("maximum", 3);
assertThat(document).contains("scheduler delivery starts after the retry delay");
Map<String, Object> createNotification = map(schemas.get("CreateNotificationRequest"));
Map<String, Object> selectorProperties = map(createNotification.get("properties"));
assertThat(map(selectorProperties.get("recipientIds"))).containsEntry("minItems", 1);
assertThat(map(selectorProperties.get("roleCode"))).containsEntry("minLength", 1);
List<Object> selectorBranches = list(createNotification.get("oneOf"));
assertThat(selectorBranches).hasSize(3);
Map<String, Object> directRecipients = map(selectorBranches.get(0));
assertThat(list(directRecipients.get("required"))).containsExactly("recipientIds");
assertThat(list(map(directRecipients.get("not")).get("required"))).containsExactly("roleCode");
assertThat(list(map(map(directRecipients.get("properties")).get("recipientType")).get("enum")))
.containsExactly("USER", "MEMBERSHIP");
Map<String, Object> roleRecipients = map(selectorBranches.get(1));
assertThat(list(roleRecipients.get("required"))).containsExactly("roleCode");
assertThat(list(map(roleRecipients.get("not")).get("required"))).containsExactly("recipientIds");
assertThat(list(map(map(roleRecipients.get("properties")).get("recipientType")).get("enum")))
.containsExactly("TENANT_ROLE", "PLATFORM_ROLE");
Map<String, Object> allRecipients = map(selectorBranches.get(2));
assertThat(list(map(map(allRecipients.get("properties")).get("recipientType")).get("enum")))
.containsExactly("TENANT_ALL");
assertThat(list(map(allRecipients.get("not")).get("anyOf")))
.extracting(value -> list(map(value).get("required")))
.containsExactly(List.of("recipientIds"), List.of("roleCode"));
assertThat(document).doesNotContain("if:").doesNotContain("then:");
}
private void assertRequestBody(Map<String, Object> paths, String path, String method) {