I am using Springfox-swagger to generate a Swagger page for my Spring Boot REST service. As a part of one of my POJOs that I serialise to JSON I use:
javax.money.MonetaryAmount
java.time.LocalDate
The issue I'm seeing is that in Swagger, the Model and Model Shema tabs for the response show the implementation details of these fields, namely
LocalDate {
chronology (IsoChronology, optional),
dayOfMonth (integer, optional),
dayOfWeek (string, optional) = ['MONDAY' or 'TUESDAY' or 'WEDNESDAY' or 'THURSDAY' or 'FRIDAY' or 'SATURDAY' or 'SUNDAY'],
dayOfYear (integer, optional),
era (Era, optional),
leapYear (boolean, optional),
month (string, optional) = ['JANUARY' or 'FEBRUARY' or 'MARCH' or 'APRIL' or 'MAY' or 'JUNE' or 'JULY' or 'AUGUST' or 'SEPTEMBER' or 'OCTOBER' or 'NOVEMBER' or 'DECEMBER'],
monthValue (integer, optional),
year (integer, optional)
}
IsoChronology {
calendarType (string, optional),
id (string, optional)
}
Era {
value (integer, optional)
}
and
MonetaryAmount {
context (MonetaryContext, optional),
currency (CurrencyUnit, optional),
factory (MonetaryAmountFactory«MonetaryAmount», optional),
negative (boolean, optional),
negativeOrZero (boolean, optional),
number (NumberValue, optional),
positive (boolean, optional),
positiveOrZero (boolean, optional),
zero (boolean, optional)
}
MonetaryContext {
(...)
}
CurrencyUnit {
(...)
}
CurrencyContext {
(...)
}
MonetaryAmountFactory«MonetaryAmount» {
(...)
}
NumberValue {
(...)
}
I am using the Moneta 1.1 implementation of javax.money.MonetaryAmount
(JSR 354) if that matters.
Now, this is far to verbose for what I want, so I implemented a Serialiser, and my response (and requests) work as expected. However, the schemas are not reflecting this. Is there a way of configuring the format of the schemas after serialising the requests?
As I realise there are quite a few moving parts to this problem, I've created a proof of concept project to show the problem in its full glory.