Skip to content
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

CLOUDP-286341: Validate Spectral Rule Application (PoC) #293

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

yelizhenden-mdb
Copy link
Collaborator

@yelizhenden-mdb yelizhenden-mdb commented Nov 25, 2024

Proposed changes

This PR implements a PoC for a custom Spectral formatter

You can test it out running node run-spectral.js
It will output JUnit formatted file with failures and successes.
Success means that the rule has no failure associated with itself.

Custom JUnit Formatter:

  • Failures and the components associated
  • Returns success for the rules that don’t have any failures associated with

Spectral running on JS file:

  • Load ruleset
  • Read OpenAPI spec file
  • Run Spectral on OAS
  • Write the results to a file

Deciding the successful ones:

  • Collect all the components for a rule target (JSONPath lib)
  • Check which components are marked as a failure
  • Others left will be the successful ones for the rule

Catching the exemptions:

  • Exempted components will not appear as failures
  • We should collect them separately
  • They are printed out, we can collect them with a Collector class

Note: This is not functioning as expected, but it serves as a foundational starting point for implementation

Jira ticket: CLOUDP-286341

Closes #[issue number]

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 changed the title CLOUDP-286341 CLOUDP-286341: Validate Spectral Rule Application Nov 28, 2024
@yelizhenden-mdb yelizhenden-mdb changed the title CLOUDP-286341: Validate Spectral Rule Application CLOUDP-286341: Validate Spectral Rule Application (PoC) Nov 28, 2024
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