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

In RAML1 to OAS3 conversion, header examples should be preserved #49

Open jsamr opened 6 years ago

jsamr commented 6 years ago

Currently, header examples are lost while they are supported in OAS3. They are not designated as a lost semantic, so they should be included in header schema.

RAML 1 source

#%RAML 1.0
title: headers example
version: 1
/last-article:
 get:
   description: Get latest article
   responses:
     200:
       headers:
         Last-Modified-By:
           description: Author of latest modification.
           example: UTF-8'fr'Jean-Pierre%20Dupont

Expected output (yaml+json)

{
  "openapi": "3.0.0",
  "info": {
    "title": "headers example",
    "version": "1"
  },
  "servers": [],
  "paths": {
    "/last-article": {
      "get": {
        "responses": {
          "200": {
            "description": "",
            "headers": {
              "Last-Modified-By": {
                "description": "Author of latest modification.",
                "schema": {
                  "type": "string",
                  "example": "UTF-8'fr'Jean-Pierre%20Dupont"
                }
              }
            }
          }
        },
        "description": "Get latest article",
        "operationId": "GET_last-article"
      }
    }
  },
  "components": {
    "schemas": {},
    "responses": {},
    "parameters": {},
    "examples": {},
    "requestBodies": {},
    "headers": {},
    "securitySchemes": {},
    "links": {},
    "callbacks": {}
  }
}

Observed output (yaml+json)

{
  "openapi": "3.0.0",
  "info": {
    "title": "headers example",
    "version": "1"
  },
  "servers": [],
  "paths": {
    "/last-article": {
      "get": {
        "responses": {
          "200": {
            "description": "",
            "headers": {
              "Last-Modified-By": {
                "description": "Author of latest modification.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "description": "Get latest article",
        "operationId": "GET_last-article"
      }
    }
  },
  "components": {
    "schemas": {},
    "responses": {},
    "parameters": {},
    "examples": {},
    "requestBodies": {},
    "headers": {},
    "securitySchemes": {},
    "links": {},
    "callbacks": {}
  }
}