stellio-hub / stellio-context-broker

Stellio is an NGSI-LD compatible context broker
https://stellio.readthedocs.io
Apache License 2.0
27 stars 10 forks source link

Clearer error for specific cases #1249

Closed gasserluc closed 1 day ago

gasserluc commented 1 month ago

Would it be possible to add clearer error in certain specific cases, for instance : when you try to POST an entitiy without [] to a batch endpoint (such as /entityOperations/create), stellio gives the following error :

{
    "type": "https://uri.etsi.org/ngsi-ld/errors/InvalidRequest",
    "title": "The request associated to the operation is syntactically invalid or includes wrong content",
    "status": 400,
    "detail": "Cannot deserialize value of type `java.util.ArrayList<java.util.Map<java.lang.Object,java.lang.Object>>` from Object value (token `JsonToken.START_OBJECT`)\n at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 1]",
    "instance": "/ngsi-ld/v1/entityOperations/create"
}

Which is not really explicit on this simple mistake

Is it possible tp add specific error details in such specific cases (for example: detail: "Payload sent to a batch endpoint must be an Array" or something like that) ? This is a small mistake and such details would be useful.

bobeal commented 1 month ago

Proposal: