mulesoft / api-console

An interactive REST console based on RAML/OAS files
Other
911 stars 237 forks source link

API Console does not change example when mediaType is changed. #329

Closed brettkroeder closed 4 years ago

brettkroeder commented 8 years ago

I changed the mediaType but the example did NOT change.

anypoint_platform_for_apis___api_administration___customer_-_1_2___designer
sichvoge commented 8 years ago

Can you post a small reproducible RAML snippet @brettkroeder, pls. I will test, confirm the issue using that, and let the team know.

brettkroeder commented 8 years ago

Here is the Portal link

sichvoge commented 8 years ago

Thanks. I identified the issue already. Currently the console does not really convert the YAML example into both JSON and XML. That's obviously an issue, but the question is how much you support in here. Examples are easy, speaking about converting schemas is different. For example, what do you expect the console does in the following scenario:

#%RAML 1.0
title: Customer API
version: 1.0

mediaType: [ application/xml, application/json ]

/customers:
  /all:
    get:
      responses:
        200:
          body:
            type: |
              {
                ... // any JSON schema
              }
            example: |
              {
                "name": "Brett"
              }

Do you expect any client, in this case the console, to show you XML and XSD as well when you switch between the media types?

brettkroeder commented 8 years ago

I would not expect it to cover explicit schemas and examples. But I do expect it to switch when defined with RAML DataTypes and NamedExamples.

brettkroeder commented 8 years ago

Just like it does when I Try It

sichvoge commented 8 years ago

Agree. I put that as an enhancement request. Thanks Brett.

Summary:

Inside the API Console, I should be able to switch between XML and JSON, and see the examples that has been defined in YAML in their respective serialization format.

jarrodek commented 4 years ago

API Console version 3 is no longer supported. We are at version 6 right now. Please, upgrade your version of the console to have latest updates.