Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/fury-adapter-oas3-parser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Fury OAS3 Parser Changelog

## Master

### Bug Fixes

- Prevents an exception being raised when using `freeze()` on the parse result
returned by the parser when you reference a parameter component multiple
times in an OpenAPI Document.

## 0.7.4 (2019-04-12)

### Enhancements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function parseOperationObject(context, path, member) {
R.reject(member => !headers.include(member.key.toValue()).isEmpty, headerParameters.content)
);

request.headers = headers;
request.headers = headers.clone();
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ function parseParameterObjects(context, name, array) {

// Convert an array of parameters into the correct types
const convertParameters = R.cond([
[isPathOrQuery, member => new namespace.elements.HrefVariables(member.value.content)],
[isPathOrQuery, member => new namespace.elements.HrefVariables(member.value.clone().content)],
// FIXME when headers and cookies are supported these should be converted
[R.T, member => member],
[R.T, member => member.clone()],
]);

const parseParameters = pipeParseResult(namespace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,72 @@ const testParseFixture = require('./testParseFixture');
const fixtures = path.join(__dirname, 'fixtures', 'components');

describe('components', () => {
it("'Path Item Object' parameter references", () => {
const file = path.join(fixtures, 'path-item-object-parameters');
return testParseFixture(file);
});
describe('Path Item Object', () => {
it('handles parameter references', () => {
const file = path.join(fixtures, 'path-item-object-parameters');
return testParseFixture(file);
});

it("'Path Item Object' parameter referencing unsupported parameter", () => {
const file = path.join(fixtures, 'path-item-object-parameters-unsupported-parameter');
return testParseFixture(file);
});
it('handles multiple references to same parameter', () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using an integration test because this particular bug is with interplay of using parameters referenced from multiple different components with element freeze(). There's a lot of setup state for this and it's simpler to test referencing in this way.

const file = path.join(fixtures, 'path-item-object-parameters-multiple');
return testParseFixture(file);
});

it("'Media Type Object' schema references", () => {
const file = path.join(fixtures, 'media-type-object-schema');
return testParseFixture(file);
it('handles parameter referencing unsupported parameter', () => {
const file = path.join(fixtures, 'path-item-object-parameters-unsupported-parameter');
return testParseFixture(file);
});
});

it("'Media Type Object' examples references", () => {
const file = path.join(fixtures, 'media-type-object-examples');
return testParseFixture(file);
});
describe('Media Type Object', () => {
it('handles schema references', () => {
const file = path.join(fixtures, 'media-type-object-schema');
return testParseFixture(file);
});

it("'Responses Object' response references", () => {
const file = path.join(fixtures, 'responses-object-response');
return testParseFixture(file);
});
it('handles multiple references to same schema', () => {
const file = path.join(fixtures, 'media-type-object-schema-multiple');
return testParseFixture(file);
});

it("'Responses Object' response references with schema", () => {
const file = path.join(fixtures, 'responses-object-response-with-schema');
return testParseFixture(file);
it('handles examples references', () => {
const file = path.join(fixtures, 'media-type-object-examples');
return testParseFixture(file);
});
});

it("'Responses Object' respomnse references with headers", () => {
const file = path.join(fixtures, 'responses-object-response-with-headers');
return testParseFixture(file);
describe('Responses Object', () => {
it('handles response references', () => {
const file = path.join(fixtures, 'responses-object-response');
return testParseFixture(file);
});

it('handles multiple references to same response', () => {
const file = path.join(fixtures, 'responses-object-response-multiple');
return testParseFixture(file);
});

it('handles response references with schema', () => {
const file = path.join(fixtures, 'responses-object-response-with-schema');
return testParseFixture(file);
});

it('handles responses references with headers', () => {
const file = path.join(fixtures, 'responses-object-response-with-headers');
return testParseFixture(file);
});
});

it("'Response Object' headers references", () => {
const file = path.join(fixtures, 'response-object-headers');
return testParseFixture(file);
describe('Response Object', () => {
it('handles headers references', () => {
const file = path.join(fixtures, 'response-object-headers');
return testParseFixture(file);
});

it('handles multiple references to same header', () => {
const file = path.join(fixtures, 'response-object-headers-multiple');
return testParseFixture(file);
});
});

it("'Schema Object' circular references", () => {
Expand Down
Loading