Skip to content

Conversation

@yelizhenden-mdb
Copy link
Collaborator

@yelizhenden-mdb yelizhenden-mdb commented Feb 26, 2025

Proposed changes

Jira ticket: CLOUDP-271991

Implements a Spectral rule to validate if Get method (single resource) has 200 OK status code and no other 2xx responses
If it is a custom method or collection resource, the rule will be bypassed.

Checklist

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works

Changes to Spectral

  • I have read the README file for Spectral Updates

@yelizhenden-mdb yelizhenden-mdb marked this pull request as ready for review February 27, 2025 16:34
@yelizhenden-mdb yelizhenden-mdb requested a review from a team as a code owner February 27, 2025 16:34
return;
}

if (input['responses']) {
Copy link
Collaborator

@lovisaberggren lovisaberggren Feb 27, 2025

Choose a reason for hiding this comment

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

Something to consider here is that this test will cover IPA 105 List as well, since it's also a HTTP GET method, which may skew the metrics, and will cause duplicate validation if we are planning to implement the same check for IPA 105.

Also, this covers custom methods too, though IIRC we don't define that custom method GET should return 200. Maybe we should introduce a guideline for this on custom methods, or not do the validation if we think there is a reason for custom gets to return a 202 for example (though IMO it should be a custom post in that case)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I modified the code as "If it is a custom method or collection resource (not a child with current glossary), the rule will be bypassed". Let me know what you think

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks!

return;
}

if (input['responses']) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks!

@yelizhenden-mdb yelizhenden-mdb merged commit e64b541 into main Mar 3, 2025
13 checks passed
@yelizhenden-mdb yelizhenden-mdb deleted the CLOUDP-271991 branch March 3, 2025 16:23
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.

2 participants