Optional types with multiple inheritance


Hi there!

I am trying to create a response type combining a base type with core information and other optional types using inheritance. I need that my responses contains always the person related information, and the rest of the info if it exists.

Imagine I have declared some datatypes in datatypes files: Person, Address, PersonalId and Job. I include it in my API using !include and then I try to create my new type, but using ? in the types is not valid.

  type: [ Person, Address?, Id?, Job? ]

I also try to include the types using required false:

  Person: !include person.raml
    type: !include person.raml
    required: false
    type: !include person.raml
    required: false
    type: !include person.raml
    required: false

I only make it working using union with inheritance and making all possible combinations…


What about:

  type: Person
    address?: Address 
    id?: Id
    job?: Job


I want to inherit the properties of the datatypes directly in my type, but I am also considering add new properties.

I’m going to change my types, thanks!