-
Couldn't load subscription status.
- Fork 14
CLOUDP-304053: IPA-106:Create - The resource must be the request body (implement deepObjectComparison without third party dependencies) #522
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
Conversation
… (implement deepObjectComparison without third party dependencies)
… (implement deepObjectComparison without third party dependencies)
| "apache-arrow": "^19.0.1", | ||
| "dotenv": "^16.4.7", | ||
| "eslint-plugin-jest": "^28.10.0", | ||
| "lodash": "^4.17.21", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
| function: 'createMethodShouldNotHaveQueryParameters' | ||
| xgen-IPA-106-create-method-request-body-is-get-method-response: | ||
| description: 'The Create method request should be a Get method response. http://go/ipa/106' | ||
| description: | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
| !isEqual( | ||
| omitDeep(postMethodRequestContentPerMediaType.schema, 'readOnly', 'writeOnly'), | ||
| omitDeep(getMethodResponseContentPerMediaType.schema, 'readOnly', 'writeOnly') | ||
| omitDeep(postMethodRequestContentPerMediaType.schema, ...ignoredValues), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
|
LGTM! Will review fully once put out of draft mode |
| * @param {*} value2 Second value to compare | ||
| * @returns {boolean} Whether the values are deeply equal | ||
| */ | ||
| export function isDeepEqual(value1, value2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it could be useful to add some unit tests for this function specifically? So it's covered by a unit test as well as spectral test in action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E.g. /__tests__/utils
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea @lovisaberggren Can we create separate jira to have utils (our framework for exceptions and metics) covered by tests. Problem is not specific to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, let me create one @wtrocki
Included some test cases for the functions defined in compareUtils.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the ticket: https://jira.mongodb.org/browse/CLOUDP-305898
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, yeah at least for the more complicated helper functions we should have tests
tools/spectral/ipa/__tests__/createMethodRequestBodyIsGetResponse.test.js
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Proposed changes
Jira ticket: CLOUDP-304053
This PR implements deep object comparison without third party dependencies, and replace the existing third party solutions
Checklist
Changes to Spectral
Further comments