BlueBrain / BlueBrain/nexus

DecodingFailure rejections difficult to understand

Open
#2,458 0 comments 0 reactions 0 assignees View on GitHub
delta
Dominant language
Scala
Stars
301
Forks
76
PR merge metrics
No merged PRs in 30d

Description

As an example, when attempting to create a view with the following payload:
```json
{
"@context": {},
"@id": "myview",
"@type": "ElasticSearchView",
"resourceSchemas": [],
"resourceTypes": [],
"resourceTag": "",
"includeMetadata": true,
"includeDeprecated": false,
"mapping": {}
}
```

Delta returns:
```json
{
"@context": "https://bluebrain.github.io/nexus/contexts/error.json",
"@type": "DecodingFailed",
"rejections": [
{
"@type": "DecodingFailed",
"reason": "'' did not match the expected tag label format [\\p{ASCII}]{1,64}.",
"status": 400
},
{
"@type": "DecodingFailed",
"reason": "Unable to find type discriminator for 'BlazegraphViewValue'",
"status": 400
},
{
"@type": "DecodingFailed",
"reason": "Could not extract a 'Sequence' from the path 'DownArray,DownField(https://bluebrain.github.io/nexus/vocabulary/sources)'",
"status": 400
}
]
}
```

It would be useful to at least mention in which field the error is. In this case the error is in `resourceTag`, which cannot be empty. For someone not familiar with the internals, is pretty hard to understand.

Contributor guide

Open the contributing guide

Research direction

Start from the example view-creation payload and its DecodingFailed response, then locate the decoding and rejection-handling entry points in the Scala project. Determine how validation failures can identify the relevant field and verify that the response explains the invalid resourceTag instead of presenting only difficult-to-interpret rejection messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.