(fieldName, withId = true)
| 532 | |
| 533 | it('exempts the envelope `result` position but flags any other correlated reference', () => { |
| 534 | const make = (fieldName, withId = true) => ({ |
| 535 | schemaVersion: 1, |
| 536 | commands: [], |
| 537 | events: [], |
| 538 | types: { |
| 539 | Envelope: { |
| 540 | kind: 'record', |
| 541 | fields: [ |
| 542 | ...(withId ? [{ name: 'id', wire: 'id', required: true, type: { primitive: 'integer' } }] : []), |
| 543 | { name: fieldName, wire: fieldName, required: true, type: { ref: 'x.ResultData' } }, |
| 544 | ], |
| 545 | }, |
| 546 | 'x.ResultData': { kind: 'union', variants: ['x.A'], selector: { correlated: true } }, |
| 547 | 'x.A': { kind: 'record', fields: [] }, |
| 548 | }, |
| 549 | }) |
| 550 | assert.deepEqual(checkSchema(make('result')), []) // the envelope's correlation point — allowed |
| 551 | assert.deepEqual(checkSchema(make('payload')), [ |
| 552 | 'Envelope.payload: correlated union x.ResultData is reachable as a value (needs a payload selector)', |
no outgoing calls
no test coverage detected