@@ -19,8 +19,9 @@ func TestNewValidationOptions_Defaults(t *testing.T) {
1919 assert .False (t , opts .FormatAssertions )
2020 assert .False (t , opts .ContentAssertions )
2121 assert .True (t , opts .SecurityValidation )
22- assert .True (t , opts .OpenAPIMode ) // Default is true
23- assert .False (t , opts .AllowScalarCoercion ) // Default is false
22+ assert .True (t , opts .OpenAPIMode ) // Default is true
23+ assert .False (t , opts .AllowScalarCoercion ) // Default is false
24+ assert .False (t , opts .AllowXMLBodyValidation ) // Default is false
2425 assert .Nil (t , opts .RegexEngine )
2526 assert .Nil (t , opts .RegexCache )
2627}
@@ -32,8 +33,9 @@ func TestNewValidationOptions_WithNilOption(t *testing.T) {
3233 assert .False (t , opts .FormatAssertions )
3334 assert .False (t , opts .ContentAssertions )
3435 assert .True (t , opts .SecurityValidation )
35- assert .True (t , opts .OpenAPIMode ) // Default is true
36- assert .False (t , opts .AllowScalarCoercion ) // Default is false
36+ assert .True (t , opts .OpenAPIMode ) // Default is true
37+ assert .False (t , opts .AllowScalarCoercion ) // Default is false
38+ assert .False (t , opts .AllowXMLBodyValidation ) // Default is false
3739 assert .Nil (t , opts .RegexEngine )
3840 assert .Nil (t , opts .RegexCache )
3941}
@@ -44,8 +46,9 @@ func TestWithFormatAssertions(t *testing.T) {
4446 assert .True (t , opts .FormatAssertions )
4547 assert .False (t , opts .ContentAssertions )
4648 assert .True (t , opts .SecurityValidation )
47- assert .True (t , opts .OpenAPIMode ) // Default is true
48- assert .False (t , opts .AllowScalarCoercion ) // Default is false
49+ assert .True (t , opts .OpenAPIMode ) // Default is true
50+ assert .False (t , opts .AllowScalarCoercion ) // Default is false
51+ assert .False (t , opts .AllowXMLBodyValidation ) // Default is false
4952 assert .Nil (t , opts .RegexEngine )
5053 assert .Nil (t , opts .RegexCache )
5154}
@@ -56,8 +59,9 @@ func TestWithContentAssertions(t *testing.T) {
5659 assert .False (t , opts .FormatAssertions )
5760 assert .True (t , opts .ContentAssertions )
5861 assert .True (t , opts .SecurityValidation )
59- assert .True (t , opts .OpenAPIMode ) // Default is true
60- assert .False (t , opts .AllowScalarCoercion ) // Default is false
62+ assert .True (t , opts .OpenAPIMode ) // Default is true
63+ assert .False (t , opts .AllowScalarCoercion ) // Default is false
64+ assert .False (t , opts .AllowXMLBodyValidation ) // Default is false
6165 assert .Nil (t , opts .RegexEngine )
6266 assert .Nil (t , opts .RegexCache )
6367}
@@ -93,18 +97,20 @@ func TestWithExistingOpts(t *testing.T) {
9397 // Create original options with all settings enabled
9498 var testEngine jsonschema.RegexpEngine = nil
9599 original := & ValidationOptions {
96- RegexEngine : testEngine ,
97- RegexCache : & sync.Map {},
98- FormatAssertions : true ,
99- ContentAssertions : true ,
100- SecurityValidation : false ,
100+ RegexEngine : testEngine ,
101+ RegexCache : & sync.Map {},
102+ FormatAssertions : true ,
103+ AllowXMLBodyValidation : true ,
104+ ContentAssertions : true ,
105+ SecurityValidation : false ,
101106 }
102107
103108 // Create new options using existing options
104109 opts := NewValidationOptions (WithExistingOpts (original ))
105110
106111 assert .Nil (t , opts .RegexEngine ) // Both should be nil
107112 assert .NotNil (t , opts .RegexCache )
113+ assert .Equal (t , original .AllowXMLBodyValidation , opts .AllowXMLBodyValidation )
108114 assert .Equal (t , original .FormatAssertions , opts .FormatAssertions )
109115 assert .Equal (t , original .ContentAssertions , opts .ContentAssertions )
110116 assert .Equal (t , original .SecurityValidation , opts .SecurityValidation )
@@ -119,8 +125,9 @@ func TestWithExistingOpts_NilSource(t *testing.T) {
119125 assert .False (t , opts .FormatAssertions )
120126 assert .False (t , opts .ContentAssertions )
121127 assert .True (t , opts .SecurityValidation )
122- assert .True (t , opts .OpenAPIMode ) // Default is true
123- assert .False (t , opts .AllowScalarCoercion ) // Default is false
128+ assert .True (t , opts .OpenAPIMode ) // Default is true
129+ assert .False (t , opts .AllowScalarCoercion ) // Default is false
130+ assert .False (t , opts .AllowXMLBodyValidation ) // Default is false
124131 assert .Nil (t , opts .RegexEngine )
125132 assert .Nil (t , opts .RegexCache )
126133}
@@ -129,11 +136,13 @@ func TestMultipleOptions(t *testing.T) {
129136 opts := NewValidationOptions (
130137 WithFormatAssertions (),
131138 WithContentAssertions (),
139+ WithXmlBodyValidation (),
132140 )
133141
134142 assert .True (t , opts .FormatAssertions )
135143 assert .True (t , opts .ContentAssertions )
136144 assert .True (t , opts .SecurityValidation )
145+ assert .True (t , opts .AllowXMLBodyValidation )
137146 assert .True (t , opts .OpenAPIMode ) // Default is true
138147 assert .False (t , opts .AllowScalarCoercion ) // Default is false
139148 assert .Nil (t , opts .RegexEngine )
0 commit comments