Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Bug: Parser incorrectly translates protocols to invalid OAS property Schemas #80

Open
xximjasonxx opened this issue Jun 16, 2020 · 1 comment
Labels
amf Related to AMF issue, bug or specific behavior bug Something isn't working

Comments

@xximjasonxx
Copy link

Library version used
E.g. "^0.4.0"

Language library used with
JavaScript

Describe the bug
When parsing RAML file specifying protocols property the corresponding OAS JSON file contains schemes which is not a valid property for the Specification.

Code that causes a bug

exports.convertRamlToJson = async function(ramlFilePath) {
    const inPath = path.join(__dirname, ramlFilePath);
    const model = await wap.raml10.parse(`file://${inPath}`);
    const resolved = await wap.raml10.resolve(model);

    return await wap.oas30.generateString(resolved);
}

Input
RAML Input

#%RAML 1.0
title: File Message PAPI
baseUri: https://someuri
description: This is a prototype File Message Process API
mediaType:
  - application/json
version: 1.0.0
protocols:
  - HTTP

types:
  DocumentContainer: !include datatypes/DocumentContainer.raml

traits:
  errorResponses: !include traits/ErrorResponse.raml
  
/DocumentDataEvent:
  post:
    displayName: Document Data Event
    responses:
      "200":
        body:
          type: string
          example: "success"
      "400":
        body:
          type: object
    body:
      type: DocumentContainer

Actual behaviour/output/error
JSON Output from above example

{
  "openapi": "3.0.0",
  "info": {
    "title": "File Message PAPI",
    "description": "This is a prototype File Message Process API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://anypoint.mulesoft.com/mocking/api/v1/links/96097438-ef76-4a55-a9c3-5236724c2fe4/"
    }
  ],
  "schemes": [
    "HTTP"
  ],
  "paths": {
   }
}

Expected behaviour/output
Expectation is the parser will not create properties in JSON that are not valid pieces of the OpenAPI Spec

@postatum postatum added amf Related to AMF issue, bug or specific behavior bug Something isn't working labels Jun 17, 2020
@postatum
Copy link
Contributor

Hi @xximjasonxx.

Thank a lot for reporting this issue!

It looks like a bug of our dependency library. I've reported the bug in the dependency lib repo: aml-org/amf#597

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
amf Related to AMF issue, bug or specific behavior bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants