Skip to content

Conversation

@lovisaberggren
Copy link
Collaborator

Proposed changes

Adds rules xgen-IPA-107-put-method-response-code-is-200 and xgen-IPA-107-patch-method-response-code-is-200.

Added tests

Also did some refactoring to use a common validation method since we have a lot of similar rules checking for the response code.

Jira ticket: CLOUDP-304946

@lovisaberggren lovisaberggren marked this pull request as ready for review March 14, 2025 16:49
@lovisaberggren lovisaberggren requested a review from a team as a code owner March 14, 2025 16:49
* @param errorMessage the error message
* @returns {*[]|[{path, message}]} the errors found, or an empty array in case of no errors
*/
export function checkResponseCodeAndReturnErrors(operationObject, expectedStatusCode, path, ruleName, errorMessage) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

❤️


if (
!isSingleResourceIdentifier(resourcePath) &&
!(isResourceCollectionIdentifier(resourcePath) && isSingletonResource(resourcePaths))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Q: For Update methods, should we consider singleton URIs? I would say we can look only for single resource URIs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since singletons should and can have Update methods, we should cover them here as well, similarly to the get methods

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, it is a similar case to Get methods. Cool, thanks!

@lovisaberggren lovisaberggren merged commit cd4e085 into main Mar 14, 2025
13 checks passed
@wtrocki
Copy link
Member

wtrocki commented Mar 14, 2025

Thank you for the fix

@lovisaberggren lovisaberggren deleted the CLOUDP-304946 branch March 14, 2025 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants