Closed Him188 closed 6 days ago
Hi,
I think https://github.com/SMILEY4/ktor-swagger-ui/issues/155 is describing a similar issue to what you are facing. You might be able to copy most of that for your use case.
I also like the idea of an annotation for this, since this same issue comes up more often - I'll see what i can do there.
Edit:
i added a @Type
and @Format
that can be added on classes and properties and overwrites the type/format, avoiding having to write custom steps as described in the other issue. The annotations will be included in the next version.
Awesome!!
Hi, I have a data class field of type
kotlinx.datetime.Instant
, which is@Serializable(with = InstantIso8601Serializer::class)
. So the serialized value will be a String, instead of an object. Currently ktor-swagger-ui generates Instant as a class, which is incorrect:Is it possible to override this type? I spent 2 hours searching for solutions but I failed. I understand that the feature might be supported in the kenerator project, but I found it difficult to integrate it into swagger-ui. It would be greatful if this use case can be considered and a simple solution is provided!
What I would like to have is:
Or even better, retrieve the serializer of the field, and use its descriptor.