<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to make Document validator to return 400 error code instead of 500 error code in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-make-document-validator-to-return-400-error-code-instead/m-p/327554#M14555</link>
    <description>&lt;UL&gt;
&lt;LI&gt;&lt;CODE&gt;Accept&lt;/CODE&gt; header is required in the request. If the &lt;CODE&gt;Accept&lt;/CODE&gt; is missing Nuxeo validator throws 500 error.&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class="language-JSON"&gt;{
    "entity-type": "exception",
    "status": 500,
    "message": "2 constraint violation(s) thrown. First one is: 'Value is required.', call DocumentValidationException.getViolations() to get the others"
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;UL&gt;
&lt;LI&gt;If &lt;CODE&gt;Accept&lt;/CODE&gt; header is present then validator returns following response&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class="language-JSON"&gt;{
    "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
                }
            ]
        }
    ]
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 01 Aug 2019 14:31:33 GMT</pubDate>
    <dc:creator>Ravindra_Nalavd</dc:creator>
    <dc:date>2019-08-01T14:31:33Z</dc:date>
    <item>
      <title>How to make Document validator to return 400 error code instead of 500 error code</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-make-document-validator-to-return-400-error-code-instead/m-p/327553#M14554</link>
      <description>&lt;UL&gt;
&lt;LI&gt;I have added some custom attributes in Nuxeo with Length constraint.&lt;/LI&gt;
&lt;LI&gt;Given the below the sample schema file&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class="language-xml"&gt;&amp;lt;xs:element name="latitude"&amp;gt;
	&amp;lt;xs:simpleType&amp;gt;
		&amp;lt;xs:restriction base="xs:double"&amp;gt;
			&amp;lt;xs:minInclusive value="-90.0"/&amp;gt;
			&amp;lt;xs:maxInclusive value="90.0"/&amp;gt;
		&amp;lt;/xs:restriction&amp;gt;
	&amp;lt;/xs:simpleType&amp;gt;
&amp;lt;/xs:element&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;UL&gt;
&lt;LI&gt;While creating a document with custom property If the constraint is violated then Nuxeo returns the &lt;CODE&gt;500&lt;/CODE&gt; error code.&lt;/LI&gt;
&lt;LI&gt;Is there any way to change error code from &lt;CODE&gt;500&lt;/CODE&gt; to &lt;CODE&gt;400&lt;/CODE&gt;.&lt;/LI&gt;
&lt;LI&gt;I tried to change the &lt;CODE&gt;messages.properties&lt;/CODE&gt; file but the only Error message was updated.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Fri, 26 Jul 2019 05:55:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-make-document-validator-to-return-400-error-code-instead/m-p/327553#M14554</guid>
      <dc:creator>Ravindra_Nalavd</dc:creator>
      <dc:date>2019-07-26T05:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to make Document validator to return 400 error code instead of 500 error code</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-make-document-validator-to-return-400-error-code-instead/m-p/327554#M14555</link>
      <description>&lt;UL&gt;
&lt;LI&gt;&lt;CODE&gt;Accept&lt;/CODE&gt; header is required in the request. If the &lt;CODE&gt;Accept&lt;/CODE&gt; is missing Nuxeo validator throws 500 error.&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class="language-JSON"&gt;{
    "entity-type": "exception",
    "status": 500,
    "message": "2 constraint violation(s) thrown. First one is: 'Value is required.', call DocumentValidationException.getViolations() to get the others"
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;UL&gt;
&lt;LI&gt;If &lt;CODE&gt;Accept&lt;/CODE&gt; header is present then validator returns following response&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class="language-JSON"&gt;{
    "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
                }
            ]
        }
    ]
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Aug 2019 14:31:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-make-document-validator-to-return-400-error-code-instead/m-p/327554#M14555</guid>
      <dc:creator>Ravindra_Nalavd</dc:creator>
      <dc:date>2019-08-01T14:31:33Z</dc:date>
    </item>
  </channel>
</rss>

