diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/events/AuditEventHandler.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/events/AuditEventHandler.java index cda87829588..3615c3eb9dc 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/events/AuditEventHandler.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/events/AuditEventHandler.java @@ -27,22 +27,14 @@ import org.slf4j.LoggerFactory; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerResponseContext; -import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.Date; -import java.util.TimeZone; public class AuditEventHandler implements EventHandler { private static final Logger LOG = LoggerFactory.getLogger(AuditEventHandler.class); private AuditLogRepository auditLogRepository; - private final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); // Quoted "Z" to indicate UTC, - // no timezone offset - public void init(CatalogApplicationConfig config, DBI jdbi) { this.auditLogRepository = jdbi.onDemand(AuditLogRepository.class); - TimeZone tz = TimeZone.getTimeZone("UTC"); - this.df.setTimeZone(tz); } public Void process(ContainerRequestContext requestContext, @@ -52,7 +44,7 @@ public class AuditEventHandler implements EventHandler { if (responseContext.getEntity() != null) { String path = requestContext.getUriInfo().getPath(); String username = requestContext.getSecurityContext().getUserPrincipal().getName(); - String nowAsISO = df.format(new Date()); + Date nowAsISO = new Date(); try { EntityReference entityReference = EntityUtil.getEntityReference(responseContext.getEntity(), @@ -79,5 +71,4 @@ public class AuditEventHandler implements EventHandler { } public void close() {} - } diff --git a/catalog-rest-service/src/main/resources/json/schema/api/data/createTopic.json b/catalog-rest-service/src/main/resources/json/schema/api/data/createTopic.json index 8a1864c8585..42499b98b57 100644 --- a/catalog-rest-service/src/main/resources/json/schema/api/data/createTopic.json +++ b/catalog-rest-service/src/main/resources/json/schema/api/data/createTopic.json @@ -46,7 +46,8 @@ "type" : "integer" }, "minimumInSyncReplicas" : { - "description": "Minimum number replicas in sync to control durability. For Kafka - `min.insync.replicas` configuration." + "description": "Minimum number replicas in sync to control durability. For Kafka - `min.insync.replicas` configuration.", + "type" : "integer" }, "retentionSize": { "description": "Maximum size of a partition in bytes before old data is discarded. For Kafka - `retention.bytes` configuration.", diff --git a/catalog-rest-service/src/main/resources/json/schema/entity/data/table.json b/catalog-rest-service/src/main/resources/json/schema/entity/data/table.json index b4e9aefccd1..c4b5f961d02 100644 --- a/catalog-rest-service/src/main/resources/json/schema/entity/data/table.json +++ b/catalog-rest-service/src/main/resources/json/schema/entity/data/table.json @@ -234,8 +234,16 @@ "description": "Data for multiple rows of the table.", "type": "array", "items": { - "description": "Data for a single row of the table within the same order as columns fields.", - "type": "array" + "description": "Data for a single row of the table in the same order as `columns` fields.", + "type": "array", + "items": [ + { + "type": "string" + }, + { + "type": "number" + } + ] } } }, diff --git a/catalog-rest-service/src/main/resources/json/schema/entity/data/topic.json b/catalog-rest-service/src/main/resources/json/schema/entity/data/topic.json index 6e133ee2c8e..f6ca879c479 100644 --- a/catalog-rest-service/src/main/resources/json/schema/entity/data/topic.json +++ b/catalog-rest-service/src/main/resources/json/schema/entity/data/topic.json @@ -96,7 +96,8 @@ "type" : "integer" }, "minimumInSyncReplicas" : { - "description": "Minimum number replicas in sync to control durability. For Kafka - `min.insync.replicas` configuration." + "description": "Minimum number replicas in sync to control durability. For Kafka - `min.insync.replicas` configuration.", + "type" : "integer" }, "retentionSize": { "description": "Maximum size of a partition in bytes before old data is discarded. For Kafka - `retention.bytes` configuration.", diff --git a/catalog-rest-service/src/main/resources/json/schema/entity/feed/thread.json b/catalog-rest-service/src/main/resources/json/schema/entity/feed/thread.json index 4a7d905d22f..53c7109928d 100644 --- a/catalog-rest-service/src/main/resources/json/schema/entity/feed/thread.json +++ b/catalog-rest-service/src/main/resources/json/schema/entity/feed/thread.json @@ -39,7 +39,7 @@ }, "threadTs": { "description": "Timestamp of the when the first post created the thread.", - "format": "date-time" + "$ref": "../../type/basic.json#/definitions/dateTime" }, "about": { "description": "Data asset about which this thread is created for with format <#E/{enties}/{entityName}/{field}/{fieldValue}.", diff --git a/catalog-rest-service/src/main/resources/json/schema/type/basic.json b/catalog-rest-service/src/main/resources/json/schema/type/basic.json index 5b3fe2735b2..0daeaf6db8e 100644 --- a/catalog-rest-service/src/main/resources/json/schema/type/basic.json +++ b/catalog-rest-service/src/main/resources/json/schema/type/basic.json @@ -58,7 +58,7 @@ "dateTime": { "description": "Date and time in ISO 8601 format. Example - '2018-11-13T20:20:39+00:00'.", "type": "string", - "format": "date-Time" + "format": "date-time" }, "sqlQuery": { "description": "SQL query statement. Example - 'select * from orders'.", diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/services/DatabaseServiceResourceTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/services/DatabaseServiceResourceTest.java index d2ec1604b1e..2531af6d16f 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/services/DatabaseServiceResourceTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/services/DatabaseServiceResourceTest.java @@ -139,7 +139,7 @@ public class DatabaseServiceResourceTest extends CatalogApplicationTest { @Test public void post_validIngestionSchedules_as_admin_200(TestInfo test) throws HttpResponseException { - Schedule schedule = new Schedule().withStartDate(RestUtil.DATE_TIME_FORMAT.format(new Date())); + Schedule schedule = new Schedule().withStartDate(new Date()); schedule.withRepeatFrequency("PT60M"); // Repeat every 60M should be valid createAndCheckService(create(test, 1).withIngestionSchedule(schedule), adminAuthHeaders()); @@ -182,13 +182,12 @@ public class DatabaseServiceResourceTest extends CatalogApplicationTest { DatabaseService dbService = createAndCheckService(create(test).withDescription(null).withIngestionSchedule(null), adminAuthHeaders()); String id = dbService.getId().toString(); - String startDate = RestUtil.DATE_TIME_FORMAT.format(new Date()); // Update database description and ingestion service that are null UpdateDatabaseService update = new UpdateDatabaseService().withDescription("description1"); updateAndCheckService(id, update, OK, adminAuthHeaders()); // Update ingestion schedule - Schedule schedule = new Schedule().withStartDate(startDate).withRepeatFrequency("P1D"); + Schedule schedule = new Schedule().withStartDate(new Date()).withRepeatFrequency("P1D"); update.withIngestionSchedule(schedule); updateAndCheckService(id, update, OK, adminAuthHeaders()); @@ -336,10 +335,9 @@ public class DatabaseServiceResourceTest extends CatalogApplicationTest { } public static CreateDatabaseService create(TestInfo test) { - String startDate = RestUtil.DATE_TIME_FORMAT.format(new Date()); return new CreateDatabaseService().withName(getName(test)).withServiceType(DatabaseServiceType.Snowflake) .withJdbc(TestUtils.JDBC_INFO) - .withIngestionSchedule(new Schedule().withStartDate(startDate).withRepeatFrequency("P1D")); + .withIngestionSchedule(new Schedule().withStartDate(new Date()).withRepeatFrequency("P1D")); } private static CreateDatabaseService create(TestInfo test, int index) { diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/services/MessagingServiceResourceTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/services/MessagingServiceResourceTest.java index e19ab1cd471..0f2bbbbc3d4 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/services/MessagingServiceResourceTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/services/MessagingServiceResourceTest.java @@ -144,7 +144,7 @@ public class MessagingServiceResourceTest extends CatalogApplicationTest { @Test public void post_validIngestionSchedules_as_admin_200(TestInfo test) throws HttpResponseException { - Schedule schedule = new Schedule().withStartDate(RestUtil.DATE_TIME_FORMAT.format(new Date())); + Schedule schedule = new Schedule().withStartDate(new Date()); schedule.withRepeatFrequency("PT60M"); // Repeat every 60M should be valid createAndCheckService(create(test, 1).withIngestionSchedule(schedule), adminAuthHeaders()); @@ -187,13 +187,12 @@ public class MessagingServiceResourceTest extends CatalogApplicationTest { MessagingService dbService = createAndCheckService(create(test).withDescription(null).withIngestionSchedule(null), adminAuthHeaders()); String id = dbService.getId().toString(); - String startDate = RestUtil.DATE_TIME_FORMAT.format(new Date()); // Update messaging description and ingestion service that are null UpdateMessagingService update = new UpdateMessagingService().withDescription("description1"); updateAndCheckService(id, update, OK, adminAuthHeaders()); // Update ingestion schedule - Schedule schedule = new Schedule().withStartDate(startDate).withRepeatFrequency("P1D"); + Schedule schedule = new Schedule().withStartDate(new Date()).withRepeatFrequency("P1D"); update.withIngestionSchedule(schedule); updateAndCheckService(id, update, OK, adminAuthHeaders()); @@ -336,17 +335,15 @@ public class MessagingServiceResourceTest extends CatalogApplicationTest { } public static CreateMessagingService create(TestInfo test) { - String startDate = RestUtil.DATE_TIME_FORMAT.format(new Date()); return new CreateMessagingService().withName(getName(test)).withServiceType(MessagingServiceType.Kafka) .withBrokers(List.of("192.1.1.1:0")) - .withIngestionSchedule(new Schedule().withStartDate(startDate).withRepeatFrequency("P1D")); + .withIngestionSchedule(new Schedule().withStartDate(new Date()).withRepeatFrequency("P1D")); } private static CreateMessagingService create(TestInfo test, int index) { - String startDate = RestUtil.DATE_TIME_FORMAT.format(new Date()); return new CreateMessagingService().withName(getName(test, index)).withServiceType(MessagingServiceType.Pulsar) .withBrokers(List.of("192.1.1.1:0")) - .withIngestionSchedule(new Schedule().withStartDate(startDate).withRepeatFrequency("P1D")); + .withIngestionSchedule(new Schedule().withStartDate(new Date()).withRepeatFrequency("P1D")); } public static void updateAndCheckService(String id, UpdateMessagingService update, Status status,