Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2019 01:55 AM
- I have added some custom attributes in Nuxeo with Length constraint.
- Given the below the sample schema file
<xs:element name="latitude">
<xs:simpleType>
<xs:restriction base="xs:double">
<xs:minInclusive value="-90.0"/>
<xs:maxInclusive value="90.0"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
- While creating a document with custom property If the constraint is violated then Nuxeo returns the
500
error code. - Is there any way to change error code from
500
to400
. - I tried to change the
messages.properties
file but the only Error message was updated.
1 ACCEPTED ANSWER
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 10:31 AM
Accept
header is required in the request. If theAccept
is missing Nuxeo validator throws 500 error.
{
"entity-type": "exception",
"status": 500,
"message": "2 constraint violation(s) thrown. First one is: 'Value is required.', call DocumentValidationException.getViolations() to get the others"
}
- If
Accept
header is present then validator returns following response
{
"entity-type": "validation_report",
"has_error": true,
"number": 2,
"violations": [
{
"message": "Value is required.",
"invalid_value": null,
"constraint": {
"entity-type": "validation_constraint",
"name": "NotNullConstraint",
"parameters": {}
},
"path": [
{
"field_name": "sample_key1",
"is_list_item": false
}
]
},
{
"message": "Value is required.",
"invalid_value": null,
"constraint": {
"entity-type": "validation_constraint",
"name": "NotNullConstraint",
"parameters": {}
},
"path": [
{
"field_name": "sample_key2",
"is_list_item": false
}
]
}
]
}
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 10:31 AM
Accept
header is required in the request. If theAccept
is missing Nuxeo validator throws 500 error.
{
"entity-type": "exception",
"status": 500,
"message": "2 constraint violation(s) thrown. First one is: 'Value is required.', call DocumentValidationException.getViolations() to get the others"
}
- If
Accept
header is present then validator returns following response
{
"entity-type": "validation_report",
"has_error": true,
"number": 2,
"violations": [
{
"message": "Value is required.",
"invalid_value": null,
"constraint": {
"entity-type": "validation_constraint",
"name": "NotNullConstraint",
"parameters": {}
},
"path": [
{
"field_name": "sample_key1",
"is_list_item": false
}
]
},
{
"message": "Value is required.",
"invalid_value": null,
"constraint": {
"entity-type": "validation_constraint",
"name": "NotNullConstraint",
"parameters": {}
},
"path": [
{
"field_name": "sample_key2",
"is_list_item": false
}
]
}
]
}
