|
| 1 | +/* eslint-disable sonarjs/no-duplicate-string */ |
| 2 | +export const breakingChanges = [ |
| 3 | + { |
| 4 | + action: 'remove', |
| 5 | + path: '/channels/mychannel', |
| 6 | + type: 'breaking', |
| 7 | + before: { |
| 8 | + publish: { |
| 9 | + message: { |
| 10 | + headers: { |
| 11 | + properties: { |
| 12 | + 'some-common-header': { |
| 13 | + type: 'string', |
| 14 | + 'x-parser-schema-id': '<anonymous-schema-2>', |
| 15 | + }, |
| 16 | + }, |
| 17 | + type: 'object', |
| 18 | + 'x-parser-schema-id': '<anonymous-schema-1>', |
| 19 | + }, |
| 20 | + schemaFormat: 'application/vnd.aai.asyncapi;version=2.0.0', |
| 21 | + 'x-parser-message-name': 'channelMessage', |
| 22 | + 'x-parser-message-parsed': true, |
| 23 | + 'x-parser-original-traits': [ |
| 24 | + { |
| 25 | + headers: { |
| 26 | + properties: { |
| 27 | + 'some-common-header': { |
| 28 | + type: 'string', |
| 29 | + }, |
| 30 | + }, |
| 31 | + type: 'object', |
| 32 | + }, |
| 33 | + 'x-some-extension': 'some extension', |
| 34 | + }, |
| 35 | + ], |
| 36 | + 'x-some-extension': 'some extension', |
| 37 | + }, |
| 38 | + }, |
| 39 | + }, |
| 40 | + }, |
| 41 | + { |
| 42 | + action: 'edit', |
| 43 | + path: '/info/version', |
| 44 | + type: 'breaking', |
| 45 | + after: '1.1.0', |
| 46 | + before: '1.0.0', |
| 47 | + }, |
| 48 | +]; |
| 49 | + |
| 50 | +export const nonBreakingChanges = [ |
| 51 | + { |
| 52 | + action: 'add', |
| 53 | + path: '/channels/anotherChannel', |
| 54 | + type: 'non-breaking', |
| 55 | + after: { |
| 56 | + publish: { |
| 57 | + message: { |
| 58 | + headers: { |
| 59 | + properties: { |
| 60 | + 'some-common-header': { |
| 61 | + type: 'string', |
| 62 | + 'x-parser-schema-id': '<anonymous-schema-2>', |
| 63 | + }, |
| 64 | + }, |
| 65 | + type: 'object', |
| 66 | + 'x-parser-schema-id': '<anonymous-schema-1>', |
| 67 | + }, |
| 68 | + schemaFormat: 'application/vnd.aai.asyncapi;version=2.0.0', |
| 69 | + 'x-parser-message-name': 'channelMessage', |
| 70 | + 'x-parser-message-parsed': true, |
| 71 | + 'x-parser-original-traits': [ |
| 72 | + { |
| 73 | + headers: { |
| 74 | + properties: { |
| 75 | + 'some-common-header': { |
| 76 | + type: 'string', |
| 77 | + }, |
| 78 | + }, |
| 79 | + type: 'object', |
| 80 | + }, |
| 81 | + 'x-some-extension': 'some extension', |
| 82 | + }, |
| 83 | + ], |
| 84 | + 'x-some-extension': 'some extension', |
| 85 | + }, |
| 86 | + }, |
| 87 | + }, |
| 88 | + }, |
| 89 | +]; |
| 90 | + |
| 91 | +export const diffOutput = { |
| 92 | + changes: [ |
| 93 | + { |
| 94 | + action: 'remove', |
| 95 | + path: '/channels/mychannel', |
| 96 | + type: 'breaking', |
| 97 | + before: { |
| 98 | + publish: { |
| 99 | + message: { |
| 100 | + headers: { |
| 101 | + properties: { |
| 102 | + 'some-common-header': { |
| 103 | + type: 'string', |
| 104 | + 'x-parser-schema-id': '<anonymous-schema-2>', |
| 105 | + }, |
| 106 | + }, |
| 107 | + type: 'object', |
| 108 | + 'x-parser-schema-id': '<anonymous-schema-1>', |
| 109 | + }, |
| 110 | + schemaFormat: 'application/vnd.aai.asyncapi;version=2.0.0', |
| 111 | + 'x-parser-message-name': 'channelMessage', |
| 112 | + 'x-parser-message-parsed': true, |
| 113 | + 'x-parser-original-traits': [ |
| 114 | + { |
| 115 | + headers: { |
| 116 | + properties: { |
| 117 | + 'some-common-header': { |
| 118 | + type: 'string', |
| 119 | + }, |
| 120 | + }, |
| 121 | + type: 'object', |
| 122 | + }, |
| 123 | + 'x-some-extension': 'some extension', |
| 124 | + }, |
| 125 | + ], |
| 126 | + 'x-some-extension': 'some extension', |
| 127 | + }, |
| 128 | + }, |
| 129 | + }, |
| 130 | + }, |
| 131 | + { |
| 132 | + action: 'add', |
| 133 | + path: '/channels/anotherChannel', |
| 134 | + type: 'non-breaking', |
| 135 | + after: { |
| 136 | + publish: { |
| 137 | + message: { |
| 138 | + headers: { |
| 139 | + properties: { |
| 140 | + 'some-common-header': { |
| 141 | + type: 'string', |
| 142 | + 'x-parser-schema-id': '<anonymous-schema-2>', |
| 143 | + }, |
| 144 | + }, |
| 145 | + type: 'object', |
| 146 | + 'x-parser-schema-id': '<anonymous-schema-1>', |
| 147 | + }, |
| 148 | + schemaFormat: 'application/vnd.aai.asyncapi;version=2.0.0', |
| 149 | + 'x-parser-message-name': 'channelMessage', |
| 150 | + 'x-parser-message-parsed': true, |
| 151 | + 'x-parser-original-traits': [ |
| 152 | + { |
| 153 | + headers: { |
| 154 | + properties: { |
| 155 | + 'some-common-header': { |
| 156 | + type: 'string', |
| 157 | + }, |
| 158 | + }, |
| 159 | + type: 'object', |
| 160 | + }, |
| 161 | + 'x-some-extension': 'some extension', |
| 162 | + }, |
| 163 | + ], |
| 164 | + 'x-some-extension': 'some extension', |
| 165 | + }, |
| 166 | + }, |
| 167 | + }, |
| 168 | + }, |
| 169 | + { |
| 170 | + action: 'edit', |
| 171 | + path: '/info/version', |
| 172 | + type: 'breaking', |
| 173 | + after: '1.1.0', |
| 174 | + before: '1.0.0', |
| 175 | + }, |
| 176 | + ], |
| 177 | +}; |
| 178 | + |
| 179 | +export const overrides = { |
| 180 | + '/channels/*': { |
| 181 | + add: 'breaking', |
| 182 | + remove: 'non-breaking', |
| 183 | + edit: 'unclassified', |
| 184 | + }, |
| 185 | + '/info/version': { |
| 186 | + add: 'breaking', |
| 187 | + remove: 'non-breaking', |
| 188 | + edit: 'unclassified', |
| 189 | + }, |
| 190 | +}; |
| 191 | + |
| 192 | +export const changesWithOverrides = { |
| 193 | + changes: [ |
| 194 | + { |
| 195 | + action: 'remove', |
| 196 | + path: '/channels/mychannel', |
| 197 | + type: 'non-breaking', |
| 198 | + before: { |
| 199 | + publish: { |
| 200 | + message: { |
| 201 | + headers: { |
| 202 | + properties: { |
| 203 | + 'some-common-header': { |
| 204 | + type: 'string', |
| 205 | + 'x-parser-schema-id': '<anonymous-schema-2>', |
| 206 | + }, |
| 207 | + }, |
| 208 | + type: 'object', |
| 209 | + 'x-parser-schema-id': '<anonymous-schema-1>', |
| 210 | + }, |
| 211 | + schemaFormat: 'application/vnd.aai.asyncapi;version=2.0.0', |
| 212 | + 'x-parser-message-name': 'channelMessage', |
| 213 | + 'x-parser-message-parsed': true, |
| 214 | + 'x-parser-original-traits': [ |
| 215 | + { |
| 216 | + headers: { |
| 217 | + properties: { |
| 218 | + 'some-common-header': { |
| 219 | + type: 'string', |
| 220 | + }, |
| 221 | + }, |
| 222 | + type: 'object', |
| 223 | + }, |
| 224 | + 'x-some-extension': 'some extension', |
| 225 | + }, |
| 226 | + ], |
| 227 | + 'x-some-extension': 'some extension', |
| 228 | + }, |
| 229 | + }, |
| 230 | + }, |
| 231 | + }, |
| 232 | + { |
| 233 | + action: 'add', |
| 234 | + path: '/channels/anotherChannel', |
| 235 | + type: 'breaking', |
| 236 | + after: { |
| 237 | + publish: { |
| 238 | + message: { |
| 239 | + headers: { |
| 240 | + properties: { |
| 241 | + 'some-common-header': { |
| 242 | + type: 'string', |
| 243 | + 'x-parser-schema-id': '<anonymous-schema-2>', |
| 244 | + }, |
| 245 | + }, |
| 246 | + type: 'object', |
| 247 | + 'x-parser-schema-id': '<anonymous-schema-1>', |
| 248 | + }, |
| 249 | + schemaFormat: 'application/vnd.aai.asyncapi;version=2.0.0', |
| 250 | + 'x-parser-message-name': 'channelMessage', |
| 251 | + 'x-parser-message-parsed': true, |
| 252 | + 'x-parser-original-traits': [ |
| 253 | + { |
| 254 | + headers: { |
| 255 | + properties: { |
| 256 | + 'some-common-header': { |
| 257 | + type: 'string', |
| 258 | + }, |
| 259 | + }, |
| 260 | + type: 'object', |
| 261 | + }, |
| 262 | + 'x-some-extension': 'some extension', |
| 263 | + }, |
| 264 | + ], |
| 265 | + 'x-some-extension': 'some extension', |
| 266 | + }, |
| 267 | + }, |
| 268 | + }, |
| 269 | + }, |
| 270 | + { |
| 271 | + action: 'edit', |
| 272 | + path: '/info/version', |
| 273 | + type: 'unclassified', |
| 274 | + after: '1.1.0', |
| 275 | + before: '1.0.0', |
| 276 | + }, |
| 277 | + ], |
| 278 | +}; |
| 279 | + |
| 280 | +export const specDocument1 = { |
| 281 | + servers: { |
| 282 | + google: { |
| 283 | + variables: { |
| 284 | + port: { |
| 285 | + enum: [1, 2], |
| 286 | + }, |
| 287 | + }, |
| 288 | + }, |
| 289 | + }, |
| 290 | +}; |
| 291 | + |
| 292 | +export const specDocument2 = { |
| 293 | + servers: { |
| 294 | + google: { |
| 295 | + variables: { |
| 296 | + port: { |
| 297 | + enum: [1], |
| 298 | + }, |
| 299 | + }, |
| 300 | + }, |
| 301 | + }, |
| 302 | +}; |
| 303 | + |
| 304 | +export const arrayChanges = { |
| 305 | + changes: [ |
| 306 | + { |
| 307 | + path: '/servers/google/variables/port/enum/1', |
| 308 | + type: 'breaking', |
| 309 | + isArrayIndex: true, |
| 310 | + action: 'remove', |
| 311 | + before: 2, |
| 312 | + }, |
| 313 | + ], |
| 314 | +}; |
0 commit comments