mulesoft/api-designer

Console does not show me any type information inside the response section

sichvoge opened this issue · 6 comments

Branch: develop
Milestone: v1

I defined a type inside a library and referenced to it inside my response. I would expect the console to show me that information, but only get an empty panel:

image

Weird thing. The information are shown inside the "Types" section inside the console.

image

This is how it looks like in the current master version:

image

Might be related:

Using the following example:

#%RAML 1.0
title: TestRAML
baseUri: http://someapi.com/api
mediaType: application/json

resourceTypes:
  collection:
    usage: Use this resourceType to represent a collection of <<resourcePathName|!singularize>> items
    description: A collection of <<resourcePathName>>
    get:
      description: |
        Get all <<resourcePathName>>,
        optionally filtered
      responses:
        200:
          body:
            type: <<typeName|!singularize>>[]

types:
  Member:
    properties:
      firstName: string
      lastName: string
      age: integer
    examples:
      Bob:
        value:
          firstName: "Bob"
          lastName: "Slidell"
          age: 42
      Bill:
        value:
          firstName: "Bill"
          lastName: "Lumberg"
          age: 41
/members:
  type:
     collection:
       typeName: <<resourcePathName|!uppercamelcase>>
  get:

I don't see anything in the console anymore:

image

That was working before.

OK with the last I do see something now but only the following:

image

UPDATE

Using the current state, the informations are back for the initial problem:

image

Problems remain with the example in #432 (comment)

@sichvoge I tried out the example in the comment, and got this result:
screen shot 2016-09-21 at 2 58 32 pm

This error happens when this syntax is used for the arrays:
type: <<typeName|!singularize>>[]
If instead it is written this way, it works:
type: array
items: <<typeName|!singularize>>

The difference is in the JSON generated by the parser in the api-console. The first one generate this:
screen shot 2016-09-21 at 3 40 23 pm
While the second one has a different structure in "items":
screen shot 2016-09-21 at 3 37 33 pm

We could change the generated JSON in the api-designer. But maybe it is a better idea to fix this directly in the parser. What do you think about this?

That might be fixed with raml-org/raml-js-parser-2#407. Hope that is going to be in the sprint release on Monday.