我已经用多态语法编写了YAML文件,但是每当maven插件解析具有多态架构的定义时,我都会得到一个nullpointer错误。
“ openapi-generator-maven-plugin”是否支持多态YAML文件来生成Java存根?
一个多态定义的例子:
IRFloatSwapLegDO:
title: IRFloatSwapLegDO
allOf:
- $ref: '#/definitions/IRSwapLegDO'
- type: object
properties:
amortizationSchedule:
$ref: '#/definitions/AmortizationScheduleDO'
compoundingSchedule:
$ref: '#/definitions/CompoundingScheduleDO'
couponSchedule:
$ref: '#/definitions/CouponScheduleDO'
currency:
$ref: '#/definitions/CurrencyDO'
dayCountConvention:
type: string
fixInArrears:
type: boolean
fixingMultiplier:
type: number
format: double
fixingSchedule:
$ref: '#/definitions/CompoundingScheduleDO'
irSwapLegType:
type: string
enum:
- IRFixedSwapLeg
- IRFloatSwapLeg
irUnderlying:
$ref: '#/definitions/IRUnderlyingDO'
legID:
type: string
notional:
type: number
format: double
notionalExchange:
$ref: '#/definitions/NotionalExchangeDO'
overriddenFixings:
$ref: '#/definitions/CouponScheduleDO'
payAtStart:
type: boolean
schedule:
$ref: '#/definitions/ScheduleDO'
title: IRFloatSwapLegDO
以下是我得到的例外情况:
java.lang.NullPointerException
at io.swagger.v3.parser.util.OpenAPIDeserializer.getObject(OpenAPIDeserializer.java:730)
at io.swagger.v3.parser.util.OpenAPIDeserializer.getSchema(OpenAPIDeserializer.java:1957)
at io.swagger.v3.parser.ResolverCache.loadRef(ResolverCache.java:147)
at io.swagger.v3.parser.processors.ExternalRefProcessor.processRefToExternalSchema(ExternalRefProcessor.java:48)
at io.swagger.v3.parser.processors.ExternalRefProcessor.processRefSchema(ExternalRefProcessor.java:644)
at io.swagger.v3.parser.processors.ExternalRefProcessor.processRefToExternalSchema(ExternalRefProcessor.java:115)