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

Show unevaluated property name in error msg #2441

Merged
merged 2 commits into from
Jan 12, 2024
Merged

Conversation

aleung
Copy link
Contributor

@aleung aleung commented Dec 20, 2023

Summary

This PR appends the property name to the message of unevaluatedProperties error.

Before, it's difficult to find out which property is unevaluated if the object schema has a long list of properties.

          {
            "location": [
              "response",
              "body",
              "context"
            ],
            "severity": "Error",
            "code": "unevaluatedProperties",
            "message": "Response body property context must NOT have unevaluated properties"
          },

After, the property name ('operation' in this example) is appended to the message.

          {
            "location": [
              "response",
              "body",
              "context"
            ],
            "severity": "Error",
            "code": "unevaluatedProperties",
            "message": "Response body property context must NOT have unevaluated properties: 'operation'"
          },

Checklist

  • The basics
    • I tested these changes manually in my local or dev environment
  • Tests
    • Added or updated
    • N/A
  • Event Tracking
    • I added event tracking and followed the event tracking guidelines
    • N/A
  • Error Reporting
    • I reported errors and followed the error reporting guidelines
    • N/A

@aleung aleung requested a review from a team as a code owner December 20, 2023 07:29
@aleung aleung requested review from brendarearden and removed request for a team December 20, 2023 07:29
Copy link
Contributor

@chohmann chohmann left a comment

Choose a reason for hiding this comment

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

@aleung This is great! Before we merge and release, could you add a unit test for this functionality?

@aleung
Copy link
Contributor Author

aleung commented Jan 10, 2024

@chohmann Sure. Test case has been added.

@aleung aleung requested a review from chohmann January 10, 2024 07:03
@chohmann chohmann merged commit ab9e804 into stoplightio:master Jan 12, 2024
6 checks passed
@chohmann chohmann mentioned this pull request Jan 12, 2024
@chohmann
Copy link
Contributor

@aleung thank you for your contribution! This has been released in version 5.5.3 of Prism.

ilanashapiro pushed a commit to ilanashapiro/prism that referenced this pull request Aug 22, 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