Skip to content

[BUG] [Java client] oneOf is not handling inheritance properly #2058

@zslajosfalvi

Description

@zslajosfalvi

If I'm using this component defintions:

    AccountReference:
      type: object
      properties:
        currency:
          type: string

    AccountReferenceIban:
      description: IBAN of an account
      allOf:
        - $ref: '#/components/schemas/AccountReference'
        - type: object
          properties:
            iban:
              type: string
          required:
            - iban

    AccountReferenceBban:
      description: Basic Bank Account Number (BBAN) Identifier
      allOf:
        - $ref: '#/components/schemas/AccountReference'
        - type: object
          properties:
            bban:
              type: string
          required:
            - bban

    SinglePayment:
      type: object
      properties:
        endToEndIdentification:
          type: string
        debtorAccount:
          oneOf:
            - $ref: "#/components/schemas/AccountReferenceIban"
            - $ref: "#/components/schemas/AccountReferenceBban"

I have multiple problems with the generated code:

AccountReferenceIban and AccountReferenceBban doesn't extend AccountReference.

public class AccountReferenceBban  {
  
  @ApiModelProperty(value = "")
  private String currency;
...

SinglePayment has a

private OneOfAccountReferenceIbanAccountReferenceBban debtorAccount = null;

that refers a non existing class.
Insted it should use the common parent AccountReference.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions