property name seems to have to match ref name
alexec opened this issue · 5 comments
alexec commented
This does not work:
countryCode:
"$ref": "#/definitions/countryCodes"
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "countryCode" (class des.yaml.AddressType), not marked as ignorable (6 known properties: "countryCodes", "postalCode", "addressLine1", "addressLine2", "addressLine3", "addressLine4"])
at [Source: [B@2717a928; line: 16, column: 10] (through reference chain: des.yaml.CreateCustomerSubscription["customerCreateOrExtend"]->des.yaml.CreateCustomerSubscriptionCustomerCreateOrExtend["businessAddressDetails"]->des.yaml.AddressType["countryCode"])
But removing the plural "s" does?
countryCode:
"$ref": "#/definitions/countryCode"
slavaschmidt commented
Seems like a bug
alexec commented
Workaround
Cannot have the field name different to the type. E.g. countryCode
must have a definition named countryCode
, not countryCodes
.
Good:
"countryCode": "#/definitions/countryCode"
Bad:
"countryCode": "#/definitions/countries"
LappleApple commented
Hi @alexec, would you like to make a PR to address this bug?
slavaschmidt commented
Hi @alexec, would it be possible for you to provide a full failing specification? I've glossed over simple.pestore.api.yaml and found for example following snippet:
parameters:
- name: pet
in: body
description: Pet to add to the store
required: true
schema:
$ref: '#/definitions/newPet'
which confirms that name of the parameter does not need to be related to the name of the type.
alexec commented
Sorry - due to change in work, I'm afraid I won't have a chance to look at this. Feel free to close.