Comments (18)
@aviflax It looks like your spec is missing baseUri
. Can you confirm that?
If so, it very simple fix and I will make it today.
One thing to note is that we added support for RAML only couple week ago.
So you can experience other issues and I would be really grateful if you also report them as separate issues.
Also, when I specify --to=swagger_1 I get no output at all.
Currently we support only swagger_2
as output format.
from api-spec-converter.
It looks like your spec is missing
baseUri
. Can you confirm that?
Yup, that’s correct.
I’ve added it to my file and that seems to have corrected this problem — thank you!
Unfortunately I now have a new error:
AssertionError: Error during convertion: false == true
at /usr/local/lib/node_modules/api-spec-converter/node_modules/raml-to-swagger/src/index.js:137:5
That line of code:
assert(!('description' in ramlResource && ramlResource.description !== ''));
So it looks like this code is requiring that all resources have a description
property. This conflicts with the RAML 0.8 spec, which says:
Each resource, whether top-level or nested, MAY contain a description property that briefly describes the resource.
So I suggest you remove this assertion. If you do decide to retain it for some reason, perhaps you could change it so that it prints a useful error message?
If so, it very simple fix and I will make it today.
Great.
One thing to note is that we added support for RAML only couple week ago.
So you can experience other issues and I would be really grateful if you also report them as separate issues.
OK, that makes, sense, it would be my pleasure.
Currently we support only swagger_2 as output format.
Oh, right. Thanks. This is a little confusing when the readme lists swagger_1
as an option. You might want to add a note or something or maybe just remove swagger_1
from the readme.
Thanks for the super-fast response! I really appreciate it!
from api-spec-converter.
Hmm actually I might be misunderstanding something here, or there might be a different bug somewhere, because in fact all my resources do have the description
property with non-blank values.
from api-spec-converter.
Ah I think maybe I misread that line of code… I missed a sneaky little !
right in there… so it looks like maybe this line is asserting that RAML resources may not have non-blank description
properties… I don’t understand this but… I’ll try it out.
from api-spec-converter.
Hmm, removing the description
properties didn’t help… I don’t know, I’m at a loss. Gonna call it a day for now.
from api-spec-converter.
@aviflax It assert was added to mark not implemented feature.
I will think about some alternative strategy, like report warning or something similar.
Core problem is that Swagger only support per-operation descriptions, so there is no good solution what to do with rest of them.
You can safely remove this assert.
I will also temporarily remove it untill I implement warning feature.
from api-spec-converter.
@aviflax I updated repo with fixes for both issues.
It not in NPM package yet, but you can use npm install lucybot/api-spec-converter
from api-spec-converter.
@aviflax Did you had a chance to try updated lib?
from api-spec-converter.
@aviflax We made 1.5.0
release with fix included.
Can you please confirm that it's working?
from api-spec-converter.
Just upgraded with npm upgrade -g
then tried again:
$ api-spec-converter warper.raml -from=raml -to=swagger_2
/usr/local/lib/node_modules/api-spec-converter/node_modules/drafter.js/emcc/drafter.nomem.js:1
(function (exports, require, module, __filename, __dirname) { var Module={"ready":false,"log":(function(text){console.log("drafter.js: "+text)}),"logErr":(function(text){console.error("drafter.js: "+text)}),"onRuntimeInitialized":(function(){this.ready=true})};var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB;var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process
TypeError: Types[type] is not a function
at Object.Converter.getSpec (/usr/local/lib/node_modules/api-spec-converter/index.js:12:14)
at Object.Converter.convert (/usr/local/lib/node_modules/api-spec-converter/index.js:32:13)
at Command.main (/usr/local/lib/node_modules/api-spec-converter/bin/api-spec-converter:24:13)
at Command.listener (/usr/local/lib/node_modules/api-spec-converter/node_modules/commander/index.js:301:8)
at emitOne (events.js:77:13)
at Command.emit (events.js:169:7)
at Command.parseArgs (/usr/local/lib/node_modules/api-spec-converter/node_modules/commander/index.js:617:12)
at Command.parse (/usr/local/lib/node_modules/api-spec-converter/node_modules/commander/index.js:458:21)
at Object.<anonymous> (/usr/local/lib/node_modules/api-spec-converter/bin/api-spec-converter:15:4)
at Module._compile (module.js:425:26)
FYI this is not urgent on my side, I think I’ve figured out how to make my project work with RAML for now, so I might no longer have the need to convert to Swagger.
from api-spec-converter.
I think the issue is that you need two dashes for the args, i.e. --from,
not -from
Bobby Brennan
[email protected]
On Mon, Dec 7, 2015 at 12:40 PM, Avi Flax [email protected] wrote:
Just upgraded with npm upgrade -g then tried again:
$ api-spec-converter warper.raml -from=raml -to=swagger_2
/usr/local/lib/node_modules/api-spec-converter/node_modules/drafter.js/emcc/drafter.nomem.js:1
(function (exports, require, module, __filename, __dirname) { var Module={"ready":false,"log":(function(text){console.log("drafter.js: "+text)}),"logErr":(function(text){console.error("drafter.js: "+text)}),"onRuntimeInitialized":(function(){this.ready=true})};var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB;var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){processTypeError: Types[type] is not a function
at Object.Converter.getSpec (/usr/local/lib/node_modules/api-spec-converter/index.js:12:14)
at Object.Converter.convert (/usr/local/lib/node_modules/api-spec-converter/index.js:32:13)
at Command.main (/usr/local/lib/node_modules/api-spec-converter/bin/api-spec-converter:24:13)
at Command.listener (/usr/local/lib/node_modules/api-spec-converter/node_modules/commander/index.js:301:8)
at emitOne (events.js:77:13)
at Command.emit (events.js:169:7)
at Command.parseArgs (/usr/local/lib/node_modules/api-spec-converter/node_modules/commander/index.js:617:12)
at Command.parse (/usr/local/lib/node_modules/api-spec-converter/node_modules/commander/index.js:458:21)
at Object. (/usr/local/lib/node_modules/api-spec-converter/bin/api-spec-converter:15:4)
at Module._compile (module.js:425:26)FYI this is not urgent on my side, I think I’ve figured out how to make my
project work with RAML for now, so I might no longer have the need to
convert to Swagger.—
Reply to this email directly or view it on GitHub
#68 (comment)
.
from api-spec-converter.
Ah, yeah, thanks @bobby-brennan.
So:
$ api-spec-converter warper.raml --from=raml --to=swagger_2
AssertionError: Error during convertion: false == true
at parseJsonPayload (/usr/local/lib/node_modules/api-spec-converter/node_modules/raml-to-swagger/src/index.js:320:3)
at /usr/local/lib/node_modules/api-spec-converter/node_modules/raml-to-swagger/src/index.js:247:27
at /usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/index.js:3073:15
at baseForOwn (/usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/index.js:2046:14)
at /usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/index.js:3043:18
at Function.<anonymous> (/usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/index.js:3346:13)
at parseResponses (/usr/local/lib/node_modules/api-spec-converter/node_modules/raml-to-swagger/src/index.js:228:5)
at parseMethod (/usr/local/lib/node_modules/api-spec-converter/node_modules/raml-to-swagger/src/index.js:214:3)
at /usr/local/lib/node_modules/api-spec-converter/node_modules/raml-to-swagger/src/index.js:188:20
at arrayEach (/usr/local/lib/node_modules/api-spec-converter/node_modules/lodash/index.js:1289:13)
the top statement is: assert(_.has(data, 'schema'));
— so apparently the tool is requiring schemas to be defined… I believe this is inconsistent with the RAML spec, which AFAIK makes schemas optional.
from api-spec-converter.
@aviflax Fixed. Can you update tool using npm install -g lucybot/api-spec-converter
.
from api-spec-converter.
$ api-spec-converter warper.raml --from=raml --to=swagger_2
AssertionError: Error during convertion: false == true
at /usr/local/lib/node_modules/api-spec-converter/node_modules/raml-to-swagger/src/index.js:259:6
from api-spec-converter.
@aviflax Fixed. Can you please try update version?
npm install -g lucybot/api-spec-converter
from api-spec-converter.
$ api-spec-converter warper.raml --from=raml --to=swagger_2
TypeError: Error during convertion: Cannot read property 'schema' of null
at /usr/local/lib/node_modules/api-spec-converter/node_modules/raml-to-swagger/src/index.js:250:51
from api-spec-converter.
@aviflax Fixed. Can you please try updated version?
P.S. Thank you for patience. It really important for us to work with real life RAML files.
Maybe you also have some public RAML specs?
from api-spec-converter.
Progress! It’s now outputting Swagger. Nice work!
That said, I don’t see any of my response headers… could that be maybe because I have some headers defined for a 200 response in a trait, and each method also has a local definition of a 200 response? AFAIK they’re supposed to be merged… anyway I think we can close this, and I’ll see if I can sanitize my RAML and then share it for your test suite.
from api-spec-converter.
Related Issues (20)
- High vulnerability?
- the example value not convert
- how to convert open api 3.1 to swagger 2.0 HOT 1
- Online version returns TypeError: NetworkError when attempting to fetch resource.
- Sequence of schema fields are always ordered alphabetical
- Add original sort order as top fields ordering HOT 1
- not able to load the openapi 3 json definition
- https://github.com/LucyBot-Inc/api-spec-converter/pull/131#issue-259070526
- teste
- g
- Fails to generate valid OpenAPI from API Blueprint
- try to run project local
- Error in /var/www/node/node_modules/drafter.js/lib/drafter.nomem.js:1 HOT 2
- swagger_2 -> openapi_3: Crash when body parameter is missing schema
- convert open API3 to API 2
- Conversion to yml HOT 1
- Firestore discovery specification
- Application as a new Maintainer HOT 1
- TypeError: NetworkError when attempting to fetch resource.
- Test
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from api-spec-converter.