Inline type inheritance


#1

I can define type inline:

#%RAML 1.0
title: My API With Types
/users/{id}:
  get 
           responses:
      200:
        body:
          application/json:
            type: object
            properties:
              firstname:
                type: string
              lastname:
                type: string
              age:
                type: number

But what if i return the same data with one additional property? Can i use inline type inheritance? Like this:

#%RAML 1.0
title: API with Types
types:
  User:
    type: object
    properties:
      firstname: string
      lastname:  string
      age:       number
/users/{id}:
  get:
    responses:
      200:
        body:
          application/json:
            type: User
            properties:  //don't work
              token: string

#2

That works perfectly for me (removing //don't work since it’s invalid). What editor do you use?


#3

Api Console (https://github.com/mulesoft/api-console) don’t show additional property and i find nothing about this in the documentation. Therefore I decided that it is not supported.

If it’s ok, i will create issue for api console


#4

You sure it doesn’t. It does for me


#5

I have downloaded zip from github (master branch), unpack, open dist/index.html and past this code to form. Then press Load RAML. And i don’t see token.


#6

@n0tel is this still an issue?


#7

No. I build last version (4.0) and it works. Thanks


#8

Same problem, v3.0.10 is ok, but after that release, token is not shown.

v3.0.10
2017-08-28_214533

v3.0.11
2017-08-28_214618

v3.0.20
2017-08-28_214655


#9

Hi @zyguan, did you file that on MuleSoft’s Github repository?


#10

Not yet, @christian_vogel, I will do it later :slight_smile: