Inheritance in Data Types


#1

I’m attempting to get inheritance working in a DataType RAML1.0 file.

Essentially I want to have all the common properties in an “abstract” data type so the concrete instances all inherit the properties and can add in their own.

animal.raml:

#RAML 1.0 DataType
type: object
properties:
    name: string
    owner: string

dog.raml:

#RAML 1.0 DataType
type: !include animal.raml
properties:
    breed: string

The above complains about type not being a scalar.
I also tried some other keywords, but there doesn’t seem to be any extends or implements.

I know this is achievable in Libraries, but then you could never have another Data Type with a property that is a subtype (it would also have to be a Library). e.g.

animalsLibrary.raml

#RAML 1.0 Library
types:
    Animal: !include animal.raml
    Dog:
        type: Animal
        properties:
            breed: string

But now I would never be able to make the following since “uses” isn’t allowed.

owner.raml:

#RAML1.0 DataType
type: object
properties:
    name: string
    pet: animalsLibrary.Dog

It seems like it should be possible given libraries do achieve it, just not in as direct a fashion.
I appreciate any guidance.