-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Update Spectral to latest release #3179
Conversation
Let me know if I should un-stage the package-lock files, or what the best way to handle that is. It looks like I may be using a newer version of npm, so I'm happy to adjust as needed. |
Thank you for the submission @rossmcdonald, this is definitely an improvement, the team is currently heads down trying to get out an update for Electron at the moment, once that's done we will circle back with reviews. 🙏 |
Sounds great, @nijikokun! Don't hesitate to reach out should any questions come up. |
Just wanna say I'm really excited about this PR. Spectral (being old) caused LOTS of trouble for another PR I'm working on. Thank you so much. I anticipated getting to this as soon as possible (which, haha, to be clear, will be a few days, and maybe even a week or two) because we need it for other reasons. |
Glad to hear it @dimitropoulos! This will be a win for us on the sales side as well. I'm also the original author of Spectral, so feel free to reach out anytime if you have any questions. |
oh sweet. I have a bat-phone now! mainly the issues were, by the way, with us upgrading to get the typescript types (I'm converting all of insomnia to typescript) and there was some issue with the bundling (jsonc-parser includes a file called I think we're sorta-kinda past it (we ended up just downgrading webpack) but there were other problems that came from All the same, I'll keep at it and let you know. Definitely a big fan of the tool. I made something similar (now privately held by a prior employer) a few years ago for parsing yaml using the haskell reference parser. |
I rebased this. @develohpanda please take a look |
(rebased again). hey @rossmcdonald next time would you mind committing on a different branch than |
@dimitropoulos Yep, sorry about that. Let me know if you need me to re-open this one from a different branch if it's causing issues. |
nah, no biggie - next time. |
rebased again @develohpanda if you get a second, it'd be nice to get this one over-and-out. if not, no biggie, either. |
|
||
const spectral = new Spectral(); | ||
spectral.registerFormat('oas2', isOpenApiv2); | ||
spectral.registerFormat('oas3', isOpenApiv3); | ||
spectral.loadRuleset('spectral:oas'); |
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.
Ooooooo does this mean we can have rulesets with kong directives as well, in the future 👀
const spectral = new Spectral(); | ||
spectral.registerFormat('oas2', isOpenApiv2); | ||
spectral.registerFormat('oas3', isOpenApiv3); | ||
spectral.loadRuleset('spectral:oas'); |
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.
Seeing this repeated a few times so it makes sense to have a common initializeSpectral()
function, and maybe for the lint operation filter as well.
EDIT: fda6408
(#3179)
Thank you @rossmcdonald! |
const results = (await spectral.run(specContent)).filter(result => ( | ||
result.severity === 0 // filter for errors only | ||
)); |
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.
it's too bad we can't use isLintError
here. This helps build the case for a package for top-level (i.e. 0 dependency) utils that any/all packages in the project can use (including typescript types).
This PR:
insomnia-app
package.To demonstrate the change to the designer itself, before this change (running
2021.01.0
):Note the lack of validations. And then after this change:
Validations are now being reported properly based on the contents of the specification. This will help provide immediate feedback to the user as they build out their specifications, and improve the overall value-add of the Insomnia Design view.
Feel free to ping me on company Slack to review.