Skip to content

Conversation

@yelizhenden-mdb
Copy link
Collaborator

@yelizhenden-mdb yelizhenden-mdb commented Mar 31, 2025

Proposed changes

Jira ticket: CLOUDP-304960

Fixes:

  • Exceptions will only be collected at the response level.
  • There might be multiple errors for one response, assuming there might be several versions of responses (CLOUDP-276969)
  • Add error if referenced schema is not valid
    (openapi-api-registry.json refers to schemas in openapi-mms.json, which cannot be resolved in custom Spectral rule functions, therefore they will appear as errors)
  • For investigating external schema reference resolution further, CLOUDP-309694 is created

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

Further comments

@yelizhenden-mdb yelizhenden-mdb marked this pull request as ready for review March 31, 2025 12:25
@yelizhenden-mdb yelizhenden-mdb requested a review from a team as a code owner March 31, 2025 12:25
This rule checks that all 4xx and 5xx error responses reference the ApiError schema.
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-114-error-responses-refer-to-api-error'
severity: warn
resolved: false
Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI this is probably why the external spec references don't work, since we're passing the unresolved spec

One option to consider could be to run the validation on the resolved spec, but when evaluating the object, use the passed unresolvedDocument to see the schema ref name

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Discussed offline. For now, we will proceed with the current approach, and for the API Registry violations, I will note down the limitation in the exception reason, and refer to the investigation ticket

@yelizhenden-mdb yelizhenden-mdb marked this pull request as draft March 31, 2025 14:10
@yelizhenden-mdb yelizhenden-mdb marked this pull request as ready for review March 31, 2025 16:38
@yelizhenden-mdb yelizhenden-mdb merged commit d82a6fa into main Mar 31, 2025
8 checks passed
@yelizhenden-mdb yelizhenden-mdb deleted the IPA-114-fix branch March 31, 2025 16:56
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