Open timothymcmackin opened 5 years ago
I've been over this a few times and it does not seem to have anything to do with unix vs dos line breaks in the files.
Possible workaround:
const myParser = {
order: 1,
parse(file) {
return file.data.toString();
}
};
const bundleOptions = {
parse: {
text: myParser,
},
};
return new Promise((resolve) => {
SwaggerParser.bundle(passedSourceFile, bundleOptions, (err, api) => {
resolve(api);
});
});
I'm using swagger-parser.bundle to pull in external examples in my Swagger file via $ref. I'm noticing that in certain cases, the line breaks in the external files are lost.
For example, check out this gist, which I adapted from petstore v2: https://gist.github.com/timothymcmackin/0f9a7edd694252f38f8df1426a01c395
In my swagger, I have this $ref:
example.sh
is a two-line file:When I transform (see
resolve.js
in the gist), the output document loses the line breaks:However, if I change
example.sh
to this:the output retains the line breaks:
There's something about having that
:
in the external file that makes the line breaks stay in. Is there some bug here that's making the line breaks drop out?Edit: I'm using swagger-parser v6.0.5.