Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valid RAML 1.0 will not import using Postman >11.0.12 #84

Closed
Tracked by #88
mobileskyfi opened this issue May 22, 2024 · 4 comments
Closed
Tracked by #88

Valid RAML 1.0 will not import using Postman >11.0.12 #84

mobileskyfi opened this issue May 22, 2024 · 4 comments
Assignees

Comments

@mobileskyfi
Copy link

I have some RAML 1.0 spec that has imported fine in for a while. In BOTH of the 11.1.x builds, the import started failing importing, with popup saying it failed. Tired cut-and-pasting the RAML and using a file.

There is no logs or some specific indicator what might be wrong. The same RAML validates using raml2html -v and via the webapi-parser code. e.g.

const wap = require('webapi-parser').WebApiParser
const fs = require("fs")
async function main () {
  const raml = fs.readFileSync(`${__dirname}/ros-rest-tool.raml`, "utf-8")  
  const model = await wap.raml10.parse(raml)
  const report = await wap.raml10.validate(model)
  console.log('Validation errors:', report.toString())
}
main()

Validation errors: Model: http://a.ml/amf/default_document
Profile: RAML 1.0
Conforms? true
Number of results: 0

I tried using some JS code with postmanlabs/raml1-to-postman – I don't normally to it this way but it does NOT work either. This generates a seemingly valid JSON file – but the generate Postman JSON is valid AFAIK, but it fails to import in Postman App. e.g.

var fs = require('fs'),
Converter = require('raml1-to-postman'),
ramlSpec = fs.readFileSync('ros-rest-tool.raml', {encoding: 'UTF8'});
Converter.convert({ type: 'string', data: ramlSpec },
  {}, (err, conversionResult) => {
    if (!conversionResult.result) {
      console.log('Could not convert', conversionResult.reason);
      process.exit(1)
    }
    else {
      console.log(JSON.stringify(conversionResult.output[0]));
    }
  }
)

Anyway tried a few things, but something broke in newer Postman versions, specifically 11.1.x. The last version that worked is 11.0.12. Postman has worked with this scheme for a while (9.x, 10.x, and 11.0.12), so it being a postman error was NOT my right thought. ;). So... I think something broken between those builds on your side.

Attached the problematic RAML file. Renamed to .txt to it can be attached

ros-rest-tool.raml.txt

@VShingala
Copy link
Member

@mobileskyfi Thanks for reporting the issue! I was also able to reproduce the same. We're looking into the issue and will let you know once we have fix for this.

@VShingala VShingala self-assigned this May 22, 2024
@mobileskyfi
Copy link
Author

Thanks. I forgot to mention that even the RAML spec's website's "hello world" example does not work:
https://github.com/raml-org/raml-examples/blob/master/helloworld/helloworld.raml

So even this does not work:

#%RAML 1.0
title: Hello world # required title

/helloworld: # optional resource
  get: # HTTP method declaration
    responses: # declare a response
      200: # HTTP status code
        body: # declare content of response
          application/json: # media type
            type: | # structural definition of a response (schema or type)
              {
                "title": "Hello world Response",
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string"
                  }
                }
              }
            example: | # example of how a response looks
              {
                "message": "Hello world"
              }

@VShingala
Copy link
Member

@mobileskyfi Yeah, there's an issue with the detection of data in RAML 1.0 format. For now, you can follow below process to generate a collection as a workaround. I've confirmed that it also generates collection from example definition mentioned by you.

  • Create new API with RAML 1.0 as format (If you can't see API section on your Postman, go to Configure workspace sidebar and enable API.
  • Copy paste your RAML 1.0 definition
  • Go to three dot menu for corresponding API and choose Add collection -> Generate from definition. (This will create API collection)
  • If you wish to move this API collection to under usual collections, you can choose Copy to collections from three dot menu of that API collection from sidebar.

Here's screen share for practical walkthrough.

Screen.Recording.2024-05-22.at.9.03.00.PM.mov

@VShingala
Copy link
Member

@mobileskyfi This issue has been fixed now with latest app v11.2. Give it a try and let us know if you're still having any further problems with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants