disallow_wildcard_filter.json 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. [
  2. {
  3. "desc": "FreeText with wildcard shall be invalid if disallowWildcard is true",
  4. "query": "freeTextWith*",
  5. "additionalConfig": {
  6. "disallowWildcard": true
  7. },
  8. "result": [
  9. {
  10. "type": "spaces",
  11. "value": ""
  12. },
  13. {
  14. "type": "freeText",
  15. "value": "freeTextWith*",
  16. "quoted": false,
  17. "invalid": {
  18. "type": "wildcard-not-allowed",
  19. "reason": "Wildcards not supported in search"
  20. }
  21. },
  22. {
  23. "type": "spaces",
  24. "value": ""
  25. }
  26. ]
  27. },
  28. {
  29. "desc": "List value with wildcard shall be invalid if disallowWildcard is true",
  30. "query": "release:[*]",
  31. "additionalConfig": {
  32. "disallowWildcard": true
  33. },
  34. "result": [
  35. {
  36. "type": "spaces",
  37. "value": ""
  38. },
  39. {
  40. "type": "filter",
  41. "filter": "textIn",
  42. "invalid": {
  43. "type": "wildcard-not-allowed",
  44. "reason": "Wildcards not supported in search"
  45. },
  46. "key": {
  47. "type": "keySimple",
  48. "value": "release",
  49. "quoted": false
  50. },
  51. "operator": "",
  52. "negated": false,
  53. "value": {
  54. "items": [
  55. {
  56. "separator": "",
  57. "value": {
  58. "quoted": false,
  59. "type": "valueText",
  60. "value": "*"
  61. }
  62. }
  63. ],
  64. "type": "valueTextList"
  65. }
  66. },
  67. {
  68. "type": "spaces",
  69. "value": ""
  70. }
  71. ]
  72. },
  73. {
  74. "desc": "Value shall be invalid if disallowWildcard is true",
  75. "query": "release:*",
  76. "additionalConfig": {
  77. "disallowWildcard": true
  78. },
  79. "result": [
  80. {
  81. "type": "spaces",
  82. "value": ""
  83. },
  84. {
  85. "type": "filter",
  86. "filter": "text",
  87. "negated": false,
  88. "key": {
  89. "type": "keySimple",
  90. "value": "release",
  91. "quoted": false
  92. },
  93. "operator": "",
  94. "value": {
  95. "type": "valueText",
  96. "value": "*",
  97. "quoted": false
  98. },
  99. "invalid": {
  100. "type": "wildcard-not-allowed",
  101. "reason": "Wildcards not supported in search"
  102. }
  103. },
  104. {
  105. "type": "spaces",
  106. "value": ""
  107. }
  108. ]
  109. },
  110. {
  111. "desc": "Key shall be invalid if not in supportedTags",
  112. "query": "release*:1",
  113. "additionalConfig": {
  114. "disallowWildcard": true,
  115. "supportedTags": {
  116. "release": {
  117. "key": "release",
  118. "kind": "field"
  119. }
  120. }
  121. },
  122. "result": [
  123. {
  124. "type": "spaces",
  125. "value": ""
  126. },
  127. {
  128. "type": "freeText",
  129. "value": "release*:1",
  130. "quoted": false,
  131. "invalid": {
  132. "type": "wildcard-not-allowed",
  133. "reason": "Wildcards not supported in search"
  134. }
  135. },
  136. {
  137. "type": "spaces",
  138. "value": ""
  139. }
  140. ]
  141. },
  142. {
  143. "desc": "If disallowWildcard is true and a custom reason is provided, it shall be shown",
  144. "query": "rele*ase",
  145. "additionalConfig": {
  146. "disallowWildcard": true,
  147. "invalidMessages": {
  148. "wildcard-not-allowed": "Release queries don't support wildcards"
  149. }
  150. },
  151. "result": [
  152. {
  153. "type": "spaces",
  154. "value": ""
  155. },
  156. {
  157. "type": "freeText",
  158. "value": "rele*ase",
  159. "quoted": false,
  160. "invalid": {
  161. "type": "wildcard-not-allowed",
  162. "reason": "Release queries don't support wildcards"
  163. }
  164. },
  165. {
  166. "type": "spaces",
  167. "value": ""
  168. }
  169. ]
  170. },
  171. {
  172. "desc": "If disallowWildcard is true and a custom reason is provided, it shall be shown",
  173. "query": "rele*ase",
  174. "additionalConfig": {
  175. "disallowWildcard": true,
  176. "invalidMessages": {
  177. "wildcard-not-allowed": "Release queries don't support wildcards"
  178. }
  179. },
  180. "result": [
  181. {"type": "spaces", "value": ""},
  182. {
  183. "type": "freeText",
  184. "value": "rele*ase",
  185. "quoted": false,
  186. "invalid": {
  187. "type": "wildcard-not-allowed",
  188. "reason": "Release queries don't support wildcards"
  189. }
  190. },
  191. {"type": "spaces", "value": ""}
  192. ]
  193. }
  194. ]