atlassian / atlassian/better-ajv-errors

Show actual incorrect constant rather than "const must be equal to constant"

Open
#162 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
245
Forks
50
PR merge metrics
No merged PRs in 30d

Description

I know we are using the raw message and just passing it along:

```
engines: {
type: 'object',
properties: {
node: {
const: '>=18.12.0',
},
},
required: ['node'],
},
```

```
33 | "engines": {
> 34 | "node": ">=18.12.1"
| ^^^^^^^^^^^ 👈🏽 const must be equal to constant
35 | },
```

but I wonder if we could do better. We already know the constant value from the schema, could we not include that in the error message? Or is that outside the scope of this project?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how the raw AJV const-validation message is passed through the formatter for the schema and output shown here. Done means the rendered error identifies the expected constant instead of only saying “const must be equal to constant”; locate the relevant existing coverage and update it for this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.