diff --git a/rest-endpoint/src/main/kotlin/tech/b180/cordaptor/rest/CordaTypesSerializers.kt b/rest-endpoint/src/main/kotlin/tech/b180/cordaptor/rest/CordaTypesSerializers.kt index 90de9cd..1a4caf0 100644 --- a/rest-endpoint/src/main/kotlin/tech/b180/cordaptor/rest/CordaTypesSerializers.kt +++ b/rest-endpoint/src/main/kotlin/tech/b180/cordaptor/rest/CordaTypesSerializers.kt @@ -210,7 +210,7 @@ class JavaInstantSerializer : CustomSerializer, } /** - * Serializer for an [Duration] representing it as a JSON string value formatted as an ISO-8601 timestamp. + * Serializer for an [Duration] representing it as a JSON string value formatted as an ISO-8601 duration format. * * @see DateTimeFormatter.ISO_INSTANT */ @@ -224,7 +224,7 @@ class JavaDurationSerializer : CustomSerializer, override fun generateSchema(generator: JsonSchemaGenerator): JsonObject { return mapOf( "type" to "string", - "format" to "date-time" + "format" to "iso-8601-duration" ).asJsonObject() } } diff --git a/rest-endpoint/src/test/kotlin/tech/b180/cordaptor/rest/CordaTypesTest.kt b/rest-endpoint/src/test/kotlin/tech/b180/cordaptor/rest/CordaTypesTest.kt index 1084c4c..15d697a 100644 --- a/rest-endpoint/src/test/kotlin/tech/b180/cordaptor/rest/CordaTypesTest.kt +++ b/rest-endpoint/src/test/kotlin/tech/b180/cordaptor/rest/CordaTypesTest.kt @@ -281,7 +281,7 @@ class CordaTypesTest : KoinTest { fun `test java duration serialization`() { val serializer = getKoin().getSerializer(Duration::class) - assertEquals("""{"type":"string","format":"date-time"}""".asJsonObject(), + assertEquals("""{"type":"string","format":"iso-8601-duration"}""".asJsonObject(), serializer.generateRecursiveSchema(getKoin().get())) // "PT4H" is string for duration of 4 hours