Skip to content

Added rule hasKey #232

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

Closed
wants to merge 3 commits into from
Closed

Added rule hasKey #232

wants to merge 3 commits into from

Conversation

bottoy
Copy link

@bottoy bottoy commented Dec 21, 2018

Added the rule hasKey to verify that the Paths object has ONE pathItem which contains one of the values provided in the rule.

Sample Rule:
"name": "health-check",
"object": "paths",
"enabled": true,
"description": "An health endpoint is required",
"hasKey": ["health", "status"]

So a pathItem with "/dssdhealth" will pass ...

Added the rule hasKey to verify that the Paths item has ONE pathItem which contains one of the values provided in the rule.

Sample Rule:
            "name": "health-check",
            "object": "paths",
            "enabled": true,
            "description": "An health endpoint is required",
            "hasKey":  ["health", "status"]

So a pathItem with "/dssdhealth" will pass ...
@philsturgeon
Copy link
Contributor

This is a great rule, but I think it could cause a little confusion in its current state. Existing usage of regex is limited to the pattern or notContain rules, both of which suggest that regex (or at least partial matching) is coming.

My concern is that hasKey sounds like its just literally going to look for foo, but would also actually match against foobar. This might be unexpected behavior for other speccy users.

Can we find a name which makes this functionality more clear? hasKeyPattern or something?

@bottoy
Copy link
Author

bottoy commented Jan 7, 2019 via email

@philsturgeon
Copy link
Contributor

Whilst I can definitely see the use for this rule, I have a new rule, which is: new rules go into oas-kit :D

We're trying to use their linter instead of maintaining our fork, so no more rule actions in Speccy. #248

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