arc-archive / api-console-app

An API Console as a standalone application
Apache License 2.0
0 stars 0 forks source link

Console does not list response examples when response type has examples but there are also examples defined at response level #1

Closed carobazan closed 7 years ago

carobazan commented 7 years ago

Description

When a resource has a response defined of a type containing examples and the response also has examples defined, Api console is listing examples defined in type instead of showing the examples defined for response

Expected outcome

When API Console describes the resource, it should show the response examples as defined in response

Actual outcome

When API Console describes the resource, it shows the examples defined in response type

Live Demo

Steps to reproduce

  1. Having the api in the attached testExamples.zip deployed as public (I used API Manager and Portal)
  2. Open new Api Console and load the api url
  3. Click on resource with name starting as CASE3_
  4. Click on Examples tab

response is defined as

  responses: 
      200: 
        body: 
          application/json: 
            type: myTypes.LibObjectWithExamples
            examples:
              example1: 
                ok: true
                channel: 
                  id: "ex1"
                  owner: "A"
              example2: 
                ok: false
                channel: 
                  id: "ex2"
                  owner: "B"

Nevertheless console shows the examples defined in the response type: myTypes.LibObjectWithExamples

Browsers Affected

jarrodek commented 7 years ago

The problem was with raml2object community library. It was overwritten response's examples array with type's. This was corrected and now the raml-json-enhancer will use new version of the library with corrected algorithm.

To test it again, please, use bower update command to update elements.