我正在使用 FasterXML 的json-schema generator从我的 POJO 构建 json-schema 。一切正常,直到我的 POJO 使用自定义 json 序列化。就我而言,我有一个 org.joda.Money 类型的字段,并使用相应的 joda-module 对其进行序列化。bean被序列化得很好
{
"amount": "...",
"currency": "..."
}
但它的架构看起来像这样:
{
"type" : "object",
"id" : "urn:jsonschema:org:joda:money:Money",
"properties" : {
"amount" : {
"type" : "number"
},
"amountMinorLong" : {
"type" : "integer"
},
"scale" : {
"type" : "integer"
},
"minorPart" : {
"type" : "integer"
},
"positive" : {
"type" : "boolean"
},
"amountMajor" : {
"type" : "number"
},
"amountMinor" : {
"type" : "number"
},
"amountMinorInt" : {
"type" : "integer"
},
"positiveOrZero" : {
"type" : "boolean"
},
"zero" : {
"type" : "boolean"
},
"negative" : {
"type" : "boolean"
},
"amountMajorLong" : {
"type" : "integer"
},
"amountMajorInt" : {
"type" : "integer"
},
"negativeOrZero" : {
"type" : "boolean"
},
"currencyUnit" : {
"type" : "object",
"id" : "urn:jsonschema:org:joda:money:CurrencyUnit",
"properties" : {
"symbol" : {
"type" : "string"
},
"numeric3Code" : {
"type" : "string"
},
"countryCodes" : {
"type" : "array",
"items" : {
"type" : "string"
}
},
"code" : {
"type" : "string"
},
"decimalPlaces" : {
"type" : "integer"
},
"defaultFractionDigits" : {
"type" : "integer"
},
"currencyCode" : {
"type" : "string"
},
"pseudoCurrency" : {
"type" : "boolean"
},
"numericCode" : {
"type" : "integer"
}
}
}
}
}
有没有办法自定义生成的模式?