-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
feat: Add JSON path to stylish formatter #1382
Conversation
Just realized I didn't update all the scenario tests. There's a lot, so I'll hold off on that until there's some indication that this PR may be merged. |
@philsturgeon what do you think about this one? |
Do we want |
Yeah, it looks like it's an array getting turned into a string. I'm using Looks like there's a helper function that I can use: |
@philsturgeon @P0lip updated to use |
@@ -69,6 +70,7 @@ export const stylish: Formatter = results => { | |||
getMessageType(result.severity), | |||
result.code ?? '', | |||
result.message, | |||
printPath(result.path, PrintStyle.Dot), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This style is fine, I think. 👍
@philsturgeon @P0lip what's the release process for spectral? i'm realizing now that this got merged into the develop branch, so it didn't get into the most recent release. when does develop get promoted to master and shipped? i'd love to start using this feature. |
@aburgel The change you implemented will be included in the 5.8.0 version. I'm planning to get it out before the end of 2020. |
* feat: Add JSON path to stylish formatter * Format with printPath * Update test harness scenarios Co-authored-by: Jakub Rożek <jakub@stoplight.io>
@aburgel it's in! Enjoy. |
When running the linter against a generated OpenAPI document, line numbers aren't all that helpful in seeing where the source of an issue is coming from. In my case, we generate the doc in a CI build, so don't easily have access to the generated file. We do have access to the CI output, and having a JSON path means we can see what path is producing the error.
So this PR adds the JSON path to the stylish formatter makes it easier to see the cause.
Checklist
Does this PR introduce a breaking change?
Screenshots