apisyouwonthate/style-guide

Allow tests to reference the key in messages to users

savage-alex opened this issue · 2 comments

As a rule creator (and a consumer of the report)
Verbose messages really help me understand what went wrong with my design:

Given the following rule:
image
The consumer is told exactly which parameter has the fault (and the line and ruleset)
image
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:
image
Results in:
image

Rule changed to return the value, results in:

image

Is it possible we can get the key returned as an option? I think it would be really helpful to consumers

This is great feedback. Could you post it on https://github.com/stoplightio/spectral/issues/

This repo is used as a collection of useful rules, for now often just as an example of what people could do, and in the future as a simple marketplace of rules.

Done thanks stoplightio/spectral#1339 sorry for posting in the wrong one.