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
Convenience methods for deep iterations over OpenAPI #725
Comments
I like your proposal @roxspring. Let's do this! |
btw, @roxspring, how specific are your in-house rules? Does it make sense to include them into the open source version of Zally (as a separated Rule Set)? I think every additional rule/check is beneficial for potential Zally users. |
…lities AvoidTrailingSlashesRule & test use Context and new convenience utility methods
Current progress in checklist form:
TBH I'm tempted to close the issue now - the 3 implemented methods clearly establish the suggested pattern and there are plenty other variations that could be written after the 4th so other than the opening example there's no particular reason for 4 to be deemed critical. |
Lots of our in-house rules involve deeply iterating over the model and filtering down to the elements we need to raise violations for. Prior to the OpenAPI 3 change we used some extension methods to make life easier but I got pushback when I suggested porting them here. Now that we've migrated to the Context based checks I thought I'd offer up the latest evolution of our extension methods and see whether they might be deemed useful here.
For example here's the guts of a rule which ensures that collections return a JSON array:
Which can be rewritten to be much more focused and concisely, without the error prone nesting, as:
Assuming the following methods are added to Context:
Would such an addition be welcome here upstream in Zally or should I keep them downstream in house? Alternate acceptable suggestions also welcome. @maxim-tschumak @netme @fmueller @mkulak
The text was updated successfully, but these errors were encountered: