-
-
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
Allow tests to reference the key in messages to users #1339
Comments
Hey! |
@P0lip hey there, see the above extract when using {{property}} i get a response back of [1] example Can provide you the API definition and rule if it helps? |
Ah, it was said |
Agreed. That'd indeed provide a much more meaningful feedback. |
Trying to get to the point that @arno-di-loreto has with the path / operation tests surfacing really nice responses ala https://apihandyman.io/toolbox/spectral/ I have the rules for 400, 401 .... 415 when there is a request body.. But would really level up with the path and operation in the message |
If the question is “how do I get the path in message “, I use the following conf using path variable on each rule: message: “{{description}} ({{path}})” |
Way to save the day and give me loads of JEST tests to change ;-) |
@savage-alex I put some draft PR over here #1341, which should address your first concern. I'm not quite sure as to its final shape yet, but either way, please let me know whether it meets your requirements. |
Hey @P0lip, im afraid its a bit beyond me to review. Happy to have a quick MS teams call if your game to take a look at it in the flesh? |
Hey, no worries, you don't need to review it. |
Hey, I have the PR running locally. Given the following OAS parameter against an operation: there is no example. My rule currently sits at: adv-query-parameters-example-exists: To retrieve the property name:includeInactive in the message as that is where the fault is, what would the message need to have? |
@savage-alex rules:
adv-query-parameters-example-exists:
description: All query parameters SHOULD have an example.
severity: error
message: 'Query parameter #{{value.name}} SHOULD have an example.'
given: "$..parameters[?(@.in == 'query')]"
then:
field: example
function: truthy |
@P0lip API definition code: Linting the same file with the baseline finds the value missing and reports the normal error from truthy. |
@savage-alex could you send me the rule definition? |
Sure email or have you got slack or teams so can share there? |
@savage-alex |
As a rule creator (and a consumer of the report)
I want to receive verbose messages informing me of the location of an issue with its name
So that I can quickly see what went wrong with my design.
(This makes allot more sense when designing on an unresolved definition and exporting a resolved one into spectral.)
Given the following rule:
The consumer is told exactly which parameter has the fault (and the line and ruleset)
Perfect right?
Unfortunately with truthy evaluations for a property it doesn't seem possible to get the key out.
I have tried to include the"hint" {parameter} or {value} in the rule:
Rule using property to pull through:
Results in:
Rule changed to return the value, results in:
Is it possible we can get the key returned as an option? I think it would be really helpful to consumers
The text was updated successfully, but these errors were encountered: