Skip to content

Conversation

yelizhenden-mdb
Copy link
Collaborator

@yelizhenden-mdb yelizhenden-mdb commented Dec 20, 2024

Proposed changes

Jira ticket: CLOUDP-287249

Validates enums if they are UPPER_SNAKE_CASE. (macro in Spectral)

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

Assumptions:

  • Developers define exceptions on the schema level
  • Enums live under
  1. Component Schema Paths:
  • Represented as: components.schemas.schemaName.*.enum
  • This path indicates that the enum is defined within a schema under components.schemas.
  • The function returns the first three elements (["components", "schemas", "schemaName"]).
  1. Parameter Schema Paths:
  • Represented as: paths.*.method.parameters[*].schema.enum
  • This path indicates that the enum is part of a parameter's schema in an operation.
  • The function identifies the location of schema in the path and returns everything up to (and including) it.

@yelizhenden-mdb yelizhenden-mdb marked this pull request as ready for review December 20, 2024 13:16
@yelizhenden-mdb yelizhenden-mdb requested a review from a team as a code owner December 20, 2024 13:16
Copy link
Collaborator

@lovisaberggren lovisaberggren left a comment

Choose a reason for hiding this comment

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

LGTM!

@yelizhenden-mdb yelizhenden-mdb merged commit a8ccb4b into main Dec 20, 2024
13 checks passed
@yelizhenden-mdb yelizhenden-mdb deleted the CLOUDP-287249 branch December 20, 2024 14:17
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