-
-
Notifications
You must be signed in to change notification settings - Fork 235
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(rulesets): add rules for validation uniqueness of tag names #2104
feat(rulesets): add rules for validation uniqueness of tag names #2104
Conversation
}, [] as string[]); | ||
} | ||
|
||
export default createRulesetFunction<Array<{ name: string }>, null>( |
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.
Interesting - so as far as I can tell, this function is equally applicable / useful in the openapi context (and this same rule, with different given
, would be valuable in the openapi context). @magicmatatjahu @P0lip what do you think re sharing common functions across default rulesets? I know that we have @stoplight/spectral-functions
, but the functions in there are very generic, while tags uniqueness is a bit more specific but generic across openapi and asyncapi 🤔.
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.
I agree, it's something that could be potentially shared.
We could create a directory under rulesets package for shared utils.
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.
I created shared
folder in the rulesets
packages with uniquenessTags
rule. I also create openapi-tags-uniqueness
rule with this same behaviour as for AsyncAPI. If you would like to introduce that rule in separate PR, please let me know, I will remove that.
packages/rulesets/src/asyncapi/functions/asyncApi2UniquenessTags.ts
Outdated
Show resolved
Hide resolved
packages/rulesets/src/asyncapi/functions/asyncApi2UniquenessTags.ts
Outdated
Show resolved
Hide resolved
packages/rulesets/src/asyncapi/functions/asyncApi2UniquenessTags.ts
Outdated
Show resolved
Hide resolved
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.
Looking good overall.
42598f5
to
f070f4e
Compare
@P0lip Sorry for such a delay! All suggestions have been applied. Let me know if everything is ok and if it is ok, you can merge when you want :) Unfortunately I had to do a mixed reset + force push (it was the easiest way for me) because the commit linting was showing me errors when I merged from the Github UI |
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.
Looking good 🚀
# [@stoplight/spectral-rulesets-v1.9.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-rulesets-v1.8.0...@stoplight/spectral-rulesets-v1.9.0) (2022-05-31) ### Features * **rulesets:** add rules for validation of server variables and channel parameters ([#2101](#2101)) ([9acc633](9acc633)) * **rulesets:** add rules for validation uniqueness of tag names ([#2104](#2104)) ([4447d81](4447d81)) * **rulesets:** check uniqueness of AsyncAPI operations ([#2121](#2121)) ([8b3cce4](8b3cce4))
🎉 This PR is included in version @stoplight/spectral-rulesets-v1.9.0 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
Fixes #2103
Checklist
Does this PR introduce a breaking change?
Additional context
Part of #2100
Add rule for validation uniqueness of tag names:
Bad Example
Good Example