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

Commit 4bae086

Browse files
Marco Frisokylef
authored andcommitted
fix(remote): respect generateSourceMap parser option
1 parent d53ffa0 commit 4bae086

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

packages/fury-adapter-remote/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Fury Remote Adapter Changelog
22

3+
## master
4+
5+
### Bug Fixes
6+
7+
- `generateSourceMap` value respected by the parse function.
8+
39
## 0.4.0 (2019-12-06)
410

511
### Enhancements

packages/fury-adapter-remote/lib/adapter.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,19 @@ class FuryRemoteAdapter {
7272
return false;
7373
}
7474

75-
parse({ source, namespace, mediaType }) {
75+
parse({
76+
source, generateSourceMap, namespace, mediaType,
77+
}) {
7678
const inputMediaType = mediaType || detectMediaType(source, defaultInputMediaType);
7779

7880
return axios({
7981
method: 'post',
8082
url: this.options.parseEndpoint,
8183
baseURL: this.options.url,
8284
data: source,
85+
params: {
86+
generateSourceMap,
87+
},
8388
headers: {
8489
'Content-Type': inputMediaType,
8590
Accept: outputMediaType,

packages/fury-adapter-remote/test/fury-test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,30 @@ describe('Adapter works with Fury interface (with default config)', function rem
3232
});
3333
});
3434

35+
it('blueprint with generateSourceMap set to true', (done) => {
36+
fury.parse({ source: blueprintSource, generateSourceMap: true }, (err, result) => {
37+
expect(result).to.be.instanceof(fury.minim.elements.ParseResult);
38+
expect(result.api.title.sourceMapValue).to.not.be.undefined;
39+
done();
40+
});
41+
});
42+
43+
it('blueprint with generateSourceMap set to false', (done) => {
44+
fury.parse({ source: blueprintSource, generateSourceMap: false }, (err, result) => {
45+
expect(result).to.be.instanceof(fury.minim.elements.ParseResult);
46+
expect(result.api.title.sourceMapValue).to.be.undefined;
47+
done();
48+
});
49+
});
50+
51+
it('blueprint without generateSourceMap', (done) => {
52+
fury.parse({ source: blueprintSource }, (err, result) => {
53+
expect(result).to.be.instanceof(fury.minim.elements.ParseResult);
54+
expect(result.api.title.sourceMapValue).to.be.undefined;
55+
done();
56+
});
57+
});
58+
3559
it('valid swagger with mediaType', (done) => {
3660
fury.parse({ source: swaggerSource, mediaType: 'application/swagger+json' }, (err, result) => {
3761
expect(result).to.be.instanceof(fury.minim.elements.ParseResult);

0 commit comments

Comments
 (0)