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

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

Description

@xximjasonxx

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

Activity

  1. added
    amfRelated to AMF issue, bug or specific behavior
    bugSomething isn't working
    on Jun 17, 2020
  2. postatum commented on Jun 17, 2020

    @postatum
    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    amfRelated to AMF issue, bug or specific behaviorbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions