@distilled.cloud/core 1.0.0-rc.11 → 1.0.0-rc.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/lib/api.d.ts +4 -4
  2. package/lib/api.d.ts.map +1 -1
  3. package/lib/api.js +1 -1
  4. package/lib/api.js.map +1 -1
  5. package/lib/category.js +1 -1
  6. package/lib/category.js.map +1 -1
  7. package/lib/codegen/boolean-string-enums.d.ts +8 -8
  8. package/lib/codegen/boolean-string-enums.d.ts.map +1 -1
  9. package/lib/codegen/boolean-string-enums.js +84 -27
  10. package/lib/codegen/boolean-string-enums.js.map +1 -1
  11. package/lib/codegen/boolean-string-enums.test.js +130 -0
  12. package/lib/codegen/boolean-string-enums.test.js.map +1 -1
  13. package/lib/codegen/cli.js +2 -2
  14. package/lib/codegen/cli.js.map +1 -1
  15. package/lib/codegen/generator.d.ts +20 -3
  16. package/lib/codegen/generator.d.ts.map +1 -1
  17. package/lib/codegen/generator.js +36 -9
  18. package/lib/codegen/generator.js.map +1 -1
  19. package/lib/codegen/generator.test.d.ts +2 -0
  20. package/lib/codegen/generator.test.d.ts.map +1 -0
  21. package/lib/codegen/generator.test.js +126 -0
  22. package/lib/codegen/generator.test.js.map +1 -0
  23. package/lib/codegen/graphql-client.d.ts +7 -1
  24. package/lib/codegen/graphql-client.d.ts.map +1 -1
  25. package/lib/codegen/graphql-client.js +262 -125
  26. package/lib/codegen/graphql-client.js.map +1 -1
  27. package/lib/codegen/graphql-client.test.js +104 -236
  28. package/lib/codegen/graphql-client.test.js.map +1 -1
  29. package/lib/codegen/openapi-binary.test.d.ts +2 -0
  30. package/lib/codegen/openapi-binary.test.d.ts.map +1 -0
  31. package/lib/codegen/openapi-binary.test.js +67 -0
  32. package/lib/codegen/openapi-binary.test.js.map +1 -0
  33. package/lib/codegen/openapi.d.ts +7 -1
  34. package/lib/codegen/openapi.d.ts.map +1 -1
  35. package/lib/codegen/openapi.js +15 -4
  36. package/lib/codegen/openapi.js.map +1 -1
  37. package/lib/codegen/patches.d.ts +16 -1
  38. package/lib/codegen/patches.d.ts.map +1 -1
  39. package/lib/codegen/patches.js +70 -4
  40. package/lib/codegen/patches.js.map +1 -1
  41. package/lib/codegen/patches.test.js +48 -2
  42. package/lib/codegen/patches.test.js.map +1 -1
  43. package/lib/codegen/untagged-unions.test.d.ts +2 -0
  44. package/lib/codegen/untagged-unions.test.d.ts.map +1 -0
  45. package/lib/codegen/untagged-unions.test.js +80 -0
  46. package/lib/codegen/untagged-unions.test.js.map +1 -0
  47. package/lib/errors.d.ts +2 -1
  48. package/lib/errors.d.ts.map +1 -1
  49. package/lib/errors.js +5 -2
  50. package/lib/errors.js.map +1 -1
  51. package/lib/fixtures/xml/upstream-validator.json +397 -0
  52. package/lib/graphql.d.ts +296 -205
  53. package/lib/graphql.d.ts.map +1 -1
  54. package/lib/graphql.js +968 -631
  55. package/lib/graphql.js.map +1 -1
  56. package/lib/graphql.test.js +134 -763
  57. package/lib/graphql.test.js.map +1 -1
  58. package/lib/graphql.types.d.ts +10 -0
  59. package/lib/graphql.types.d.ts.map +1 -1
  60. package/lib/graphql.types.js +4 -44
  61. package/lib/graphql.types.js.map +1 -1
  62. package/lib/index.d.ts +27 -0
  63. package/lib/index.d.ts.map +1 -0
  64. package/lib/index.js +27 -0
  65. package/lib/index.js.map +1 -0
  66. package/lib/pagination.d.ts +2 -1
  67. package/lib/pagination.d.ts.map +1 -1
  68. package/lib/pagination.js +24 -16
  69. package/lib/pagination.js.map +1 -1
  70. package/lib/pagination.test.d.ts +2 -0
  71. package/lib/pagination.test.d.ts.map +1 -0
  72. package/lib/pagination.test.js +134 -0
  73. package/lib/pagination.test.js.map +1 -0
  74. package/lib/protocol-http.d.ts +12 -17
  75. package/lib/protocol-http.d.ts.map +1 -1
  76. package/lib/protocol-http.js +100 -45
  77. package/lib/protocol-http.js.map +1 -1
  78. package/lib/protocol-http.test.js +130 -0
  79. package/lib/protocol-http.test.js.map +1 -1
  80. package/lib/protocol-rest.d.ts +18 -1
  81. package/lib/protocol-rest.d.ts.map +1 -1
  82. package/lib/protocol-rest.js +24 -4
  83. package/lib/protocol-rest.js.map +1 -1
  84. package/lib/query.d.ts +29 -0
  85. package/lib/query.d.ts.map +1 -0
  86. package/lib/query.js +27 -0
  87. package/lib/query.js.map +1 -0
  88. package/lib/response-validation.d.ts +67 -0
  89. package/lib/response-validation.d.ts.map +1 -0
  90. package/lib/response-validation.js +76 -0
  91. package/lib/response-validation.js.map +1 -0
  92. package/lib/response-validation.test.d.ts +2 -0
  93. package/lib/response-validation.test.d.ts.map +1 -0
  94. package/lib/response-validation.test.js +67 -0
  95. package/lib/response-validation.test.js.map +1 -0
  96. package/lib/testing.d.ts +39 -0
  97. package/lib/testing.d.ts.map +1 -0
  98. package/lib/testing.js +41 -0
  99. package/lib/testing.js.map +1 -0
  100. package/lib/trait.d.ts +29 -9
  101. package/lib/trait.d.ts.map +1 -1
  102. package/lib/trait.js +8 -0
  103. package/lib/trait.js.map +1 -1
  104. package/lib/xml.d.ts +44 -0
  105. package/lib/xml.d.ts.map +1 -0
  106. package/lib/xml.js +315 -0
  107. package/lib/xml.js.map +1 -0
  108. package/lib/xml.test.d.ts +2 -0
  109. package/lib/xml.test.d.ts.map +1 -0
  110. package/lib/xml.test.js +211 -0
  111. package/lib/xml.test.js.map +1 -0
  112. package/package.json +4 -4
  113. package/src/api.ts +4 -4
  114. package/src/category.ts +1 -1
  115. package/src/codegen/boolean-string-enums.test.ts +147 -0
  116. package/src/codegen/boolean-string-enums.ts +84 -27
  117. package/src/codegen/cli.ts +2 -2
  118. package/src/codegen/generator.test.ts +151 -0
  119. package/src/codegen/generator.ts +70 -12
  120. package/src/codegen/graphql-client.test.ts +116 -283
  121. package/src/codegen/graphql-client.ts +326 -169
  122. package/src/codegen/openapi-binary.test.ts +98 -0
  123. package/src/codegen/openapi.ts +26 -4
  124. package/src/codegen/patches.test.ts +66 -1
  125. package/src/codegen/patches.ts +84 -4
  126. package/src/codegen/untagged-unions.test.ts +89 -0
  127. package/src/errors.ts +5 -2
  128. package/src/fixtures/xml/upstream-validator.json +397 -0
  129. package/src/graphql.test.ts +174 -948
  130. package/src/graphql.ts +1592 -1167
  131. package/src/graphql.types.ts +92 -163
  132. package/src/index.ts +26 -0
  133. package/src/pagination.test.ts +191 -0
  134. package/src/pagination.ts +35 -25
  135. package/src/protocol-http.test.ts +163 -0
  136. package/src/protocol-http.ts +122 -46
  137. package/src/protocol-rest.ts +62 -13
  138. package/src/query.ts +39 -0
  139. package/src/response-validation.test.ts +95 -0
  140. package/src/response-validation.ts +116 -0
  141. package/src/testing.ts +78 -0
  142. package/src/trait.ts +39 -8
  143. package/src/xml.test.ts +269 -0
  144. package/src/xml.ts +339 -0
  145. package/lib/graphql.fixture.d.ts +0 -249
  146. package/lib/graphql.fixture.d.ts.map +0 -1
  147. package/lib/graphql.fixture.js +0 -240
  148. package/lib/graphql.fixture.js.map +0 -1
  149. package/src/graphql.fixture.ts +0 -371
@@ -0,0 +1,397 @@
1
+ [
2
+ {
3
+ "name": "should validate simple xml string",
4
+ "xml": "<rootNode></rootNode>",
5
+ "valid": true
6
+ },
7
+ {
8
+ "name": "should validate simple xml string",
9
+ "xml": "<rootNode></rootNode >",
10
+ "valid": true
11
+ },
12
+ {
13
+ "name": "should not validate invalid starting tag",
14
+ "xml": "< rootNode></rootNode>",
15
+ "valid": false
16
+ },
17
+ {
18
+ "name": "should not validate incomplete xml string",
19
+ "xml": "<rootNode>",
20
+ "valid": false
21
+ },
22
+ {
23
+ "name": "should not validate invalid starting tag for following characters",
24
+ "xml": "<rootNode#@aa></rootNode#@aa>",
25
+ "valid": false
26
+ },
27
+ {
28
+ "name": "should return false for non xml text",
29
+ "xml": "rootNode",
30
+ "valid": false
31
+ },
32
+ {
33
+ "name": "should validate self closing tags",
34
+ "xml": "<rootNode><validtag1 /><validtag2/><validtag3 with='attrib'/><validtag4 />text<validtag5/>text</rootNode>",
35
+ "valid": true
36
+ },
37
+ {
38
+ "name": "should not consider these as self closing tags",
39
+ "xml": "<rootNode><validtag1/><invalid tag/><validtag3 with='attrib'/></rootNode>",
40
+ "valid": false
41
+ },
42
+ {
43
+ "name": "should not consider these as self closing tags",
44
+ "xml": "<rootNode><notSelfClosing/ ></rootNode>",
45
+ "valid": false
46
+ },
47
+ {
48
+ "name": "should not validate xml string when closing tag is different",
49
+ "xml": "<rootNode></rootnode>",
50
+ "valid": false
51
+ },
52
+ {
53
+ "name": "should not validate xml string when closing tag is invalid",
54
+ "xml": "<rootNode>< /rootnode>",
55
+ "valid": false
56
+ },
57
+ {
58
+ "name": "should not validate xml string when closing tag is invalid",
59
+ "xml": "<rootNode></ rootnode>",
60
+ "valid": false
61
+ },
62
+ {
63
+ "name": "should not validate xml string when closing tag is invalid",
64
+ "xml": "<rootNode></rootnode 123>",
65
+ "valid": false
66
+ },
67
+ {
68
+ "name": "should validate simple xml string with namespace",
69
+ "xml": "<root:Node></root:Node>",
70
+ "valid": true
71
+ },
72
+ {
73
+ "name": "should not validate xml string with namespace when closing tag is diffrent",
74
+ "xml": "<root:Node></root:node>",
75
+ "valid": false
76
+ },
77
+ {
78
+ "name": "should validate simple xml string with value",
79
+ "xml": "<root:Node>some value</root:Node>",
80
+ "valid": true
81
+ },
82
+ {
83
+ "name": "should not validate simple xml string with value but not matching closing tag",
84
+ "xml": "<root:Node>some value</root>",
85
+ "valid": false
86
+ },
87
+ {
88
+ "name": "should not validate simple xml string with value but no closing tag",
89
+ "xml": "<root:Node>some value",
90
+ "valid": false
91
+ },
92
+ {
93
+ "name": "should validate xml with nested tags",
94
+ "xml": "<rootNode><tag></tag><tag>1</tag><tag>val</tag></rootNode>",
95
+ "valid": true
96
+ },
97
+ {
98
+ "name": "should not validate xml with wrongly nested tags",
99
+ "xml": "<rootNode><tag><tag1></tag>1</tag1><tag>val</tag></rootNode>",
100
+ "valid": false
101
+ },
102
+ {
103
+ "name": "should not validate xml with unexpected closing tag",
104
+ "xml": "</rootNode>",
105
+ "valid": false
106
+ },
107
+ {
108
+ "name": "should validate xml with comment",
109
+ "xml": "<rootNode><!-- <tag> - - --><tag>1</tag><tag>val</tag></rootNode>",
110
+ "valid": true
111
+ },
112
+ {
113
+ "name": "should validate xml with comment",
114
+ "xml": "<rootNode><!-- <tag> - - \n--><tag>1</tag><tag>val</tag></rootNode>",
115
+ "valid": true
116
+ },
117
+ {
118
+ "name": "should not validate xml with comment in a open tag",
119
+ "xml": "<rootNode<!-- <tag> -- -->><tag>1</tag><tag>val</tag></rootNode>",
120
+ "valid": false
121
+ },
122
+ {
123
+ "name": "should not validate xml with comment in a open tag",
124
+ "xml": "<rootNode <!-- <tag> -- --> ><tag>1</tag><tag>val</tag></rootNode>",
125
+ "valid": false
126
+ },
127
+ {
128
+ "name": "should correctly identify self closing tags",
129
+ "xml": "<rootNode><in/valid></in/valid></rootNode>",
130
+ "valid": false
131
+ },
132
+ {
133
+ "name": "should correctly identify self closing tags",
134
+ "xml": "<rootNode><in#valid/></rootNode>",
135
+ "valid": false
136
+ },
137
+ {
138
+ "name": "should not validate xml with non closing comment",
139
+ "xml": "<rootNode ><!-- <tag> -- <tag>1</tag><tag>val</tag></rootNode>",
140
+ "valid": false
141
+ },
142
+ {
143
+ "name": "should not validate xml with unclosed tag",
144
+ "xml": "<rootNode abc='123' bc='567'",
145
+ "valid": false
146
+ },
147
+ {
148
+ "name": "should validate xml with CDATA",
149
+ "xml": "<name><![CDATA[Jack]]></name>",
150
+ "valid": true
151
+ },
152
+ {
153
+ "name": "should validate xml with repeated CDATA",
154
+ "xml": "<name><![CDATA[Jack]]><![CDATA[Jack]]></name>",
155
+ "valid": true
156
+ },
157
+ {
158
+ "name": "should validate xml when CDATA consist regx or blank data",
159
+ "xml": "<name><![CDATA[]]><![CDATA[^[ ].*$]]></name>",
160
+ "valid": true
161
+ },
162
+ {
163
+ "name": "should return true for valid tag",
164
+ "xml": "<ns:start_tag-2.0></ns:start_tag-2.0>",
165
+ "valid": true
166
+ },
167
+ {
168
+ "name": "should return false for invalid tag",
169
+ "xml": "<2start_tag abc='123' bc='567'></2start_tag>",
170
+ "valid": false
171
+ },
172
+ {
173
+ "name": "should return false for invalid tag",
174
+ "xml": "<2start_tag />",
175
+ "valid": false
176
+ },
177
+ {
178
+ "name": "should validate xml data",
179
+ "xml": "<?xml version=\"1.0\"?>\n<any_name attr=\"https://example.com/somepath\">\n <person id=\"101\">\n <phone>+122233344550</phone>\n <name>Jack</name>\n <phone>+122233344551</phone>\n <age>33</age>\n <emptyNode></emptyNode>\n <booleanNode>false</booleanNode>\n <booleanNode>true</booleanNode>\n <selfclosing />\n <selfclosing with=\"value\" />\n <married firstTime=\"No\" attr=\"val 2\">Yes</married>\n <birthday>Wed, 28 Mar 1979 12:13:14 +0300</birthday>\n <address>\n <city>New York</city>\n <street>Park Ave</street>\n <buildingNo>1</buildingNo>\n <flatNo>1</flatNo>\n </address>\n <address>\n <city>Boston</city>\n <street>Centre St</street>\n <buildingNo>33</buildingNo>\n <flatNo>24</flatNo>\n </address>\n </person>\n <person id=\"102\">\n <phone>+122233344553</phone>\n <name>Boris</name>\n <phone>+122233344554</phone>\n <age>34</age>\n <married firstTime=\"Yes\">Yes</married>\n <birthday>Mon, 31 Aug 1970 02:03:04 +0300</birthday>\n <address>\n <city>Moscow</city>\n <street>Kahovka</street>\n <buildingNo>1</buildingNo>\n <flatNo>2</flatNo>\n </address>\n <address>\n <city>Tula</city>\n <street>Lenina</street>\n <buildingNo>3</buildingNo>\n <flatNo>78</flatNo>\n </address>\n </person>\n</any_name>",
180
+ "valid": true
181
+ },
182
+ {
183
+ "name": "should validate complex xml data",
184
+ "xml": "<?xml version=\"1.0\"?>\n<any_name attr=\"https://example.com/somepath\">\n <person id=\"101\">\n <phone>+122233344550</phone>\n <name>Jack</name>\n <phone>+122233344551</phone>\n <age>33</age>\n <emptyNode></emptyNode>\n <booleanNode>false</booleanNode>\n <booleanNode>true</booleanNode>\n <selfclosing />\n <selfclosing with=\"value\" />\n <married firstTime=\"No\" attr=\"val 2\">Yes</married>\n <birthday>Wed, 28 Mar 1979 12:13:14 +0300</birthday>\n <address>\n <city>New York</city>\n <street>Park Ave</street>\n <buildingNo>1</buildingNo>\n <flatNo>1</flatNo>\n </address>\n <address>\n <city>Boston</city>\n <street>Centre St</street>\n <buildingNo>33</buildingNo>\n <flatNo>24</flatNo>\n </address>\n </person>\n <person id=\"102\">\n <phone>+122233344553</phone>\n <name>Boris</name>\n <phone>+122233344554</phone>\n <age>34</age>\n <married ns:firstTime=\"Yes\"><![CDATA[<some>Jack</some>]]><![CDATA[Jack]]></married>\n <birthday>Mon, 31 Aug 1970 02:03:04 +0300</birthday>\n <ns:address>\n <city><![CDATA[<some>Jack</some>]]></city>\n <street>Kahovka</street>\n <buildingNo>1</buildingNo>\n <flatNo>2</flatNo>\n </ns:address>\n <address>\n <city>Tula</city>\n <street>Lenina</street>\n <buildingNo>3</buildingNo>\n <flatNo>78</flatNo>\n </address>\n </person>\n</any_name>",
185
+ "valid": true
186
+ },
187
+ {
188
+ "name": "should validate xml data with CRLF",
189
+ "xml": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <!DOCTYPE daily_western_horo_fr>\n <daily_western_horo_fr>\n <date valeur=\"2017-09-25\"><signe valeur=\"balance\">\n <nombre_chance>25\n </nombre_chance>\n </signe></date>\n </daily_western_horo_fr>\n",
190
+ "valid": true,
191
+ "parserValid": false,
192
+ "difference": "DTDs are outside the supported XML subset."
193
+ },
194
+ {
195
+ "name": "should return false for invalid xml",
196
+ "xml": "<?xml version=\"1.0\"?>\n<any_name attr=\"https://example.com/somepath\">\n <person id=\"101\">\n <phone>+122233344550</phone>\n <name>Jack</name>\n <phone>+122233344551</phone>\n <age>33</age>\n <emptyNode></emptyNode>\n <booleanNode>false</booleanNode>\n <booleanNode>true</booleanNode>\n <selfclosing >\n <selfclosing with=\"value\" />\n <married firstTime=\"No\" attr=\"val 2\">Yes</married>\n <birthday>Wed, 28 Mar 1979 12:13:14 +0300</birthday>\n <address>\n <city>New York</city>\n <street>Park Ave</street>\n <buildingNo>1</buildingNo>\n <flatNo>1</flatNo>\n </address>\n <address>\n <city>Boston</city>\n <street>Centre St</street>\n <buildingNo>33</buildingNo>\n <flatNo>24</flatNo>\n </address>\n </person>\n <person id=\"102\">\n <phone>+122233344553</phone>\n <name>Boris</name>\n <phone>+122233344554</phone>\n <age>34</age>\n <married ns:firstTime=\"Yes\"><![CDATA[<some>Jack</some>]]><![CDATA[Jack]]></married>\n <birthday>Mon, 31 Aug 1970 02:03:04 +0300</birthday>\n <ns:address>\n <city><![CDATA[<some>Jack</some>]]></city>\n <street>Kahovka</street>\n <buildingNo>1</buildingNo>\n <flatNo>2</flatNo>\n </ns:address>\n <address>\n <city>Tula</city>\n <street>Lenina</street>\n <buildingNo>3</buildingNo>\n <flatNo>78</flatNo>\n </address>\n </person>\n</any_name>",
197
+ "valid": false
198
+ },
199
+ {
200
+ "name": "should return true for valid svg",
201
+ "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\" \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n<svg version=\"1.0\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"64px\" height=\"64px\" viewBox=\"5.5 -3.5 64 64\" enable-background=\"new 5.5 -3.5 64 64\" xml:space=\"preserve\">\n<g>\n\t<circle fill=\"#FFFFFF\" cx=\"37.637\" cy=\"28.806\" r=\"28.276\"/>\n\t<g>\n\t\t<path d=\"M37.443-3.5c8.988,0,16.57,3.085,22.742,9.257C66.393,11.967,69.5,19.548,69.5,28.5c0,8.991-3.049,16.476-9.145,22.456 C53.879,57.319,46.242,60.5,37.443,60.5c-8.649,0-16.153-3.144-22.514-9.43C8.644,44.784,5.5,37.262,5.5,28.5 c0-8.761,3.144-16.342,9.429-22.742C21.101-0.415,28.604-3.5,37.443-3.5z M37.557,2.272c-7.276,0-13.428,2.553-18.457,7.657 c-5.22,5.334-7.829,11.525-7.829,18.572c0,7.086,2.59,13.22,7.77,18.398c5.181,5.182,11.352,7.771,18.514,7.771 c7.123,0,13.334-2.607,18.629-7.828c5.029-4.838,7.543-10.952,7.543-18.343c0-7.276-2.553-13.465-7.656-18.571 C50.967,4.824,44.795,2.272,37.557,2.272z M46.129,20.557v13.085h-3.656v15.542h-9.944V33.643h-3.656V20.557 c0-0.572,0.2-1.057,0.599-1.457c0.401-0.399,0.887-0.6,1.457-0.6h13.144c0.533,0,1.01,0.2,1.428,0.6 C45.918,19.5,46.129,19.986,46.129,20.557z M33.042,12.329c0-3.008,1.485-4.514,4.458-4.514s4.457,1.504,4.457,4.514 c0,2.971-1.486,4.457-4.457,4.457S33.042,15.3,33.042,12.329z\"/>\n\t</g>\n</g>\n</svg>\n",
202
+ "valid": true,
203
+ "parserValid": false,
204
+ "difference": "DTDs are outside the supported XML subset."
205
+ },
206
+ {
207
+ "name": "should validate XML with DOCTYPE",
208
+ "xml": "<?xml version=\"1.0\" standalone=\"yes\" ?><!--open the DOCTYPE declaration - the open square bracket indicates an internal DTD--><!DOCTYPE foo [<!--define the internal DTD--><!ELEMENT foo (#PCDATA)><!--close the DOCTYPE declaration-->]><foo>Hello World.</foo>",
209
+ "valid": true,
210
+ "parserValid": false,
211
+ "difference": "DTDs are outside the supported XML subset."
212
+ },
213
+ {
214
+ "name": "should fail for XML with ! which is not a comment, DOCTYPE or CDATA",
215
+ "xml": "<test><!bla></!bla></test>",
216
+ "valid": false
217
+ },
218
+ {
219
+ "name": "should not validate XML when prolog doesn't start from 1st char",
220
+ "xml": " <?xml version=\"1.0\" standalone=\"yes\" ?><foo>Hello World.</foo>",
221
+ "valid": false
222
+ },
223
+ {
224
+ "name": "should not validate XML with prolog only",
225
+ "xml": "<?xml version=\"1.0\" standalone=\"yes\" ?><!--some comment - end in this line-->",
226
+ "valid": false
227
+ },
228
+ {
229
+ "name": "should not validate XML with prolog & DOCTYPE but not any other tag",
230
+ "xml": "<?xml version=\"1.0\" standalone=\"yes\" ?><!--open the DOCTYPE declaration - the open square bracket indicates an internal DTD--><!DOCTYPE foo [<!--define the internal DTD--><!ELEMENT foo (#PCDATA)><!--close the DOCTYPE declaration-->]>",
231
+ "valid": false
232
+ },
233
+ {
234
+ "name": "should validate XML PIs",
235
+ "xml": "<?xml version=\"1.0\"?><?mso-contentType?><h1></h1><?mso-contentType something=\"val\"?>",
236
+ "valid": true
237
+ },
238
+ {
239
+ "name": "should validate XML PIs",
240
+ "xml": "<h1><?mso?> abc</h1>",
241
+ "valid": true
242
+ },
243
+ {
244
+ "name": "should validate XML PIs",
245
+ "xml": "<?xml version=\"1.0\"?>\n <content><?tibcochar ?> something</content>",
246
+ "valid": true
247
+ },
248
+ {
249
+ "name": "should not validate XML PIs with invalid values",
250
+ "xml": "<?xml version=\"1.0\"?><?mso-contentType valid=\"value\" invalid=\"?>\" ?><h1></h1><?mso-contentType something=\"val\"?>",
251
+ "valid": false
252
+ },
253
+ {
254
+ "name": "should validate xml with a \"length\" attribute",
255
+ "xml": "<name length=\"1\"></name>",
256
+ "valid": true
257
+ },
258
+ {
259
+ "name": "should not validate xml with repeated attributes",
260
+ "xml": "<name length=\"bar\" length=\"baz\"></name>",
261
+ "valid": false
262
+ },
263
+ {
264
+ "name": "should validate xml with a tag attribute splitted on more lines",
265
+ "xml": "\n<name\nattribute1=\"attribute1\"\nattribute2=\"attribute2\"\n/>\n ",
266
+ "valid": true
267
+ },
268
+ {
269
+ "name": "should validate xml not properly closed",
270
+ "xml": "\n<name\nattribute1=\"attribute1\"\nattribute2=\"attribute2\"\n></name\n ",
271
+ "valid": false
272
+ },
273
+ {
274
+ "name": "should detect error line when having multiple attributes",
275
+ "xml": "<urlset t\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd\"\n xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n </urlset>",
276
+ "valid": false
277
+ },
278
+ {
279
+ "name": "should detect error line when having multiple attributes 2",
280
+ "xml": "<urlset\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd\"\n xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n t>\n </urlset>",
281
+ "valid": false
282
+ },
283
+ {
284
+ "name": "should validate value with ampersand",
285
+ "xml": "<rootNode>jekyll &amp; hyde</rootNode>",
286
+ "valid": true
287
+ },
288
+ {
289
+ "name": "should validate value with ampersand",
290
+ "xml": "<rootNode>jekyll &#123; hyde</rootNode>",
291
+ "valid": true
292
+ },
293
+ {
294
+ "name": "should validate value with ampersand",
295
+ "xml": "<rootNode>jekyll &#x1945abcdef; hyde</rootNode>",
296
+ "valid": true,
297
+ "parserValid": false,
298
+ "difference": "Character references must be valid XML code points (at most U+10FFFF)."
299
+ },
300
+ {
301
+ "name": "should validate value with ampersand",
302
+ "xml": "<rootNode>jekyll &#x1ah; hyde</rootNode>",
303
+ "valid": false
304
+ },
305
+ {
306
+ "name": "should validate value with ampersand",
307
+ "xml": "<rootNode>jekyll &#1a; hyde</rootNode>",
308
+ "valid": false
309
+ },
310
+ {
311
+ "name": "should validate value with ampersand",
312
+ "xml": "<rootNode>jekyll &#123 hyde</rootNode>",
313
+ "valid": false
314
+ },
315
+ {
316
+ "name": "should validate value with ampersand",
317
+ "xml": "<rootNode>jekyll &#1abcd hyde</rootNode>",
318
+ "valid": false
319
+ },
320
+ {
321
+ "name": "should validate value with ampersand",
322
+ "xml": "<rootNode>jekyll & hyde</rootNode>",
323
+ "valid": false
324
+ },
325
+ {
326
+ "name": "should validate value with ampersand",
327
+ "xml": "<rootNode>jekyll &aa</rootNode>",
328
+ "valid": false
329
+ },
330
+ {
331
+ "name": "should validate value with ampersand",
332
+ "xml": "<rootNode>jekyll &abcdefghij1234567890;</rootNode>",
333
+ "valid": true,
334
+ "parserValid": false,
335
+ "difference": "Undeclared entities are rejected."
336
+ },
337
+ {
338
+ "name": "should validate value with ampersand",
339
+ "xml": "<rootNode>jekyll &abcdefghij1234567890a;</rootNode>",
340
+ "valid": false
341
+ },
342
+ {
343
+ "name": "when root nodes are repeated",
344
+ "xml": "<xml></xml><xml></xml>",
345
+ "valid": false
346
+ },
347
+ {
348
+ "name": "when root nodes are different",
349
+ "xml": "<xml></xml><xml2></xml2>",
350
+ "valid": false
351
+ },
352
+ {
353
+ "name": "when root nodes have more nested tags",
354
+ "xml": "<test>\n <nested>\n </nested>\n </test>\n <xml2>\n </xml2>",
355
+ "valid": false
356
+ },
357
+ {
358
+ "name": "- child tag",
359
+ "xml": "<parent>\n <childA/>\n <childB> <!-- error: should be self-closing -->\n <childC/>\n </parent>",
360
+ "valid": false
361
+ },
362
+ {
363
+ "name": "- root tag",
364
+ "xml": " <!-- line 1 -->\n <!-- line 2 -->\n <parent> <!-- line 3 error: not closed -->\n <childA/>\n <childB/>",
365
+ "valid": false
366
+ },
367
+ {
368
+ "name": "- incorrect close tag",
369
+ "xml": "<parent>\n <child>\n <self/>\n </incorrect>\n <empty/>\n <parent>",
370
+ "valid": false
371
+ },
372
+ {
373
+ "name": "- nested incorrect close tag",
374
+ "xml": "<parent>\n <child>\n <self/>\n <self>\n </incorrect>\n <empty/>\n </parent>",
375
+ "valid": false
376
+ },
377
+ {
378
+ "name": "- Extra text",
379
+ "xml": "<parent>\n </parent>extra",
380
+ "valid": false
381
+ },
382
+ {
383
+ "name": "- Extra text",
384
+ "xml": "<parent><child attri= bute=\"true\" /></parent>",
385
+ "valid": false
386
+ },
387
+ {
388
+ "name": "- Unpaired tags",
389
+ "xml": "<parent><extra></parent>",
390
+ "valid": false
391
+ },
392
+ {
393
+ "name": "- allowBooleanAttributes:false",
394
+ "xml": "<parent extra></parent>",
395
+ "valid": false
396
+ }
397
+ ]