mulesoft / oas-raml-converter

(DEPRECATED) Converts between OAS and RAML API specifications
https://mulesoft.github.io/oas-raml-converter/
MIT License
73 stars 48 forks source link

RAML 1.0 to OAS 3.0 doesn't convert baseUriParameters default value #56

Open gtrevg opened 5 years ago

gtrevg commented 5 years ago

The variable default value in OAS is being set to the variable name, not the variable's default value.

Given

#%RAML 1.0
title: MyServer
protocols: [ HTTP, HTTPS ]
baseUri: http://{myServerURI}/{version}
baseUriParameters:
  myServerURI:
    description: The server URL
    default: localhost
version: v1
oas-raml-converter -f RAML -t OAS30 myserver.raml

Expected

{
  "openapi": "3.0.0",
  "info": {
    "title": "MyServer",
    "version": "v1"
  },
  "servers": [
    {
      "url": "http://{myServerURI}/{version}",
      "variables": {
        "myServerURI": {
          "default": "localhost"
        },
        "version": {
          "default": "v1"
        }
      }
    },
    {
      "url": "https://{myServerURI}/{version}",
      "variables": {

        "myServerURI": {
          "default": "localhost"
        },
        "version": {
          "default": "v1"
        }
      }
    }
  ],
  "paths": {},
  "components": {
    "schemas": {},
    "responses": {},
    "parameters": {},
    "examples": {},
    "requestBodies": {},
    "headers": {},
    "securitySchemes": {},
    "links": {},
    "callbacks": {}
  }
}

Actual

{
  "openapi": "3.0.0",
  "info": {
    "title": "MyServer",
    "version": "v1"
  },
  "servers": [
    {
      "url": "http://{myServerURI}/{version}",
      "variables": {
        "myServerURI": {
          "default": "myServerURI"
        },
        "version": {
          "default": "version"
        }
      }
    },
    {
      "url": "https://{myServerURI}/{version}",
      "variables": {

        "myServerURI": {
          "default": "myServerURI"
        },
        "version": {
          "default": "version"
        }
      }
    }
  ],
  "paths": {},
  "components": {
    "schemas": {},
    "responses": {},
    "parameters": {},
    "examples": {},
    "requestBodies": {},
    "headers": {},
    "securitySchemes": {},
    "links": {},
    "callbacks": {}
  }
}

Thanks