Enable strict duplicate checks for all XContent types
With this commit we enable the Jackson feature 'STRICT_DUPLICATE_DETECTION' by default for all XContent types (not only JSON). We have also changed the name of the system property to disable this feature from `es.json.strict_duplicate_detection` to the now more appropriate name `es.xcontent.strict_duplicate_detection`. Relates elastic/elasticsearchelastic/elasticsearch#19614 Relates elastic/elasticsearchelastic/elasticsearch#22073 Original commit: elastic/x-pack-elasticsearch@c92e2a6c55
This commit is contained in:
parent
0d9cb5f7bd
commit
d3c1fbe002
|
@ -8,6 +8,7 @@ package org.elasticsearch.xpack.notification.email.attachment;
|
|||
import org.elasticsearch.ElasticsearchParseException;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||
|
@ -115,8 +116,8 @@ public class EmailAttachmentParsersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testThatTwoAttachmentsWithTheSameIdThrowError() throws Exception {
|
||||
assumeFalse("Test only makes sense if JSON parser doesn't have strict duplicate checks enabled",
|
||||
JsonXContent.isStrictDuplicateDetectionEnabled());
|
||||
assumeFalse("Test only makes sense if XContent parser doesn't have strict duplicate checks enabled",
|
||||
XContent.isStrictDuplicateDetectionEnabled());
|
||||
Map<String, EmailAttachmentParser> parsers = new HashMap<>();
|
||||
parsers.put("test", new TestEmailAttachmentParser());
|
||||
EmailAttachmentsParser parser = new EmailAttachmentsParser(parsers);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
package org.elasticsearch.xpack.watcher.condition;
|
||||
|
||||
import org.elasticsearch.ElasticsearchParseException;
|
||||
import org.elasticsearch.common.xcontent.XContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||
|
@ -194,8 +195,8 @@ public class ArrayCompareConditionTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testParseContainsDuplicateOperator() throws IOException {
|
||||
assumeFalse("Test only makes sense if JSON parser doesn't have strict duplicate checks enabled",
|
||||
JsonXContent.isStrictDuplicateDetectionEnabled());
|
||||
assumeFalse("Test only makes sense if XContent parser doesn't have strict duplicate checks enabled",
|
||||
XContent.isStrictDuplicateDetectionEnabled());
|
||||
ArrayCompareCondition.Op op = randomFrom(ArrayCompareCondition.Op.values());
|
||||
ArrayCompareCondition.Quantifier quantifier = randomFrom(ArrayCompareCondition.Quantifier.values());
|
||||
Object value = randomFrom("value", 1, null);
|
||||
|
@ -247,8 +248,8 @@ public class ArrayCompareConditionTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testParseContainsDuplicateValue() throws IOException {
|
||||
assumeFalse("Test only makes sense if JSON parser doesn't have strict duplicate checks enabled",
|
||||
JsonXContent.isStrictDuplicateDetectionEnabled());
|
||||
assumeFalse("Test only makes sense if XContent parser doesn't have strict duplicate checks enabled",
|
||||
XContent.isStrictDuplicateDetectionEnabled());
|
||||
ArrayCompareCondition.Op op = randomFrom(ArrayCompareCondition.Op.values());
|
||||
ArrayCompareCondition.Quantifier quantifier = randomFrom(ArrayCompareCondition.Quantifier.values());
|
||||
Object value = randomFrom("value", 1, null);
|
||||
|
@ -274,8 +275,8 @@ public class ArrayCompareConditionTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testParseContainsDuplicateQuantifier() throws IOException {
|
||||
assumeFalse("Test only makes sense if JSON parser doesn't have strict duplicate checks enabled",
|
||||
JsonXContent.isStrictDuplicateDetectionEnabled());
|
||||
assumeFalse("Test only makes sense if XContent parser doesn't have strict duplicate checks enabled",
|
||||
XContent.isStrictDuplicateDetectionEnabled());
|
||||
ArrayCompareCondition.Op op = randomFrom(ArrayCompareCondition.Op.values());
|
||||
ArrayCompareCondition.Quantifier quantifier = randomFrom(ArrayCompareCondition.Quantifier.values());
|
||||
Object value = randomFrom("value", 1, null);
|
||||
|
|
Loading…
Reference in New Issue