Skip to content

Feature: Option to include data path in CLI output #46

Open
@Lakitna

Description

@Lakitna

Data paths are great when working with big, repeating or complex responses, but at the moment these paths are not included in the CLI output. It would also be very useful if you don't have the indent option set.

I'd like to have an option to enable data path output in the CLI mode. It might look something like.

const output = betterAjvErrors(schema, response.body, ajv.errors, {
    indent: 2,
    dataPath: true,
});
console.log(output);
     Error: FORMAT should match format "date-time"

   5 |         "foo": "624050509",
   6 |         "bar": "04",
>  7 |         "baz": "not-a-date-time",
     |                ^^^^^^^^^^^^^^^^^ 👈🏽  format should match format "date-time"
   8 |         "lorum": "@",
   9 |         "ipsum": "some string",
  10 |         "razz": 100797.51,

     @ /a/long/path/9/with/2/big/21/arrays/baz

And sure, the example above is a really extreme example, and if your API looks like this you have bigger problems. But these things exist in the wild, so I'd like to at least be able to test them with some ease. This feature would contribute to this.

I'm willing to implement this myself if someone can tell me where to start :)

Metadata

Metadata

Assignees

Type

No type

Projects

  • Status

    To do

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions