Skip to content

Conversation

@lovisaberggren
Copy link
Collaborator

@lovisaberggren lovisaberggren commented Mar 3, 2025

Proposed changes

After discussions we have decided to slightly modify the check for if a resource is a "standard" resource or a singleton resource. For most resources, they will still be treated the same, but some resources will not be considered singleton anymore.

  • The concept of a "standard" resource is gone, since the IPAs don't really reflect this
  • A resource is either singleton or not, and if it's not, we would expect it to have the standard methods (and optionally custom methods)
  • Modified the singleton resource check to also look at if there is a post in some cases, the logic is explained in this diagram
  • Added checks for if a path refers to "collection of resources" or "a single resource" instead of "child" for example, since it actually means a nested resource. Helps us correctly evaluate paths/resources, and allows us to disregard some weird paths that probably should be custom methods if implemented today (for example /resource/{id}/something/verb)

Tests

  • Updated tests for resourceEvaluation for checking for singleton resource, collection path or single path
  • Updated tests

Follow up

  • Add/remove exceptions that are not needed anymore or that are required now

Jira ticket: CLOUDP-303615

@lovisaberggren lovisaberggren marked this pull request as ready for review March 3, 2025 12:42
@lovisaberggren lovisaberggren requested a review from a team as a code owner March 3, 2025 12:42
@lovisaberggren lovisaberggren marked this pull request as draft March 4, 2025 16:26
@lovisaberggren
Copy link
Collaborator Author

Converting to draft for now, will do some testing on exceptions

@lovisaberggren lovisaberggren changed the title CLOUDP-303615: IPA - Update check if resource is singleton/standard CLOUDP-303615: IPA - Update check if resource is singleton Mar 5, 2025
@lovisaberggren lovisaberggren marked this pull request as ready for review March 5, 2025 16:29
const RULE_NAME = 'xgen-IPA-104-get-method-returns-single-resource';
const ERROR_MESSAGE_STANDARD_RESOURCE =
'Get methods should return data for a single resource. This method returns an array or a paginated response.';
const ERROR_MESSAGE_SINGLETON_RESOURCE =
Copy link
Collaborator

Choose a reason for hiding this comment

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

❤️

Copy link
Collaborator

@yelizhenden-mdb yelizhenden-mdb left a comment

Choose a reason for hiding this comment

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

LGTM. High-value foundational work!

@lovisaberggren lovisaberggren merged commit 509707a into main Mar 5, 2025
13 checks passed
@lovisaberggren lovisaberggren deleted the CLOUDP-303615 branch March 5, 2025 17:34
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