From b67744a40367ab606460aaebcff9208dfd376032 Mon Sep 17 00:00:00 2001 From: masad-frost Date: Fri, 23 Aug 2024 17:13:28 -0700 Subject: [PATCH] Use snapshot testing for schema serialization --- .../__snapshots__/serialize.test.ts.snap | 977 ++++++++++++++++++ __tests__/serialize.test.ts | 805 +-------------- 2 files changed, 982 insertions(+), 800 deletions(-) create mode 100644 __tests__/__snapshots__/serialize.test.ts.snap diff --git a/__tests__/__snapshots__/serialize.test.ts.snap b/__tests__/__snapshots__/serialize.test.ts.snap new file mode 100644 index 00000000..fdab421f --- /dev/null +++ b/__tests__/__snapshots__/serialize.test.ts.snap @@ -0,0 +1,977 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`serialize server to jsonschema > serialize entire service schema 1`] = ` +{ + "handshakeSchema": { + "properties": { + "token": { + "type": "string", + }, + }, + "required": [ + "token", + ], + "type": "object", + }, + "services": { + "test": { + "procedures": { + "add": { + "errors": { + "not": {}, + }, + "init": { + "properties": { + "n": { + "type": "number", + }, + }, + "required": [ + "n", + ], + "type": "object", + }, + "output": { + "properties": { + "result": { + "type": "number", + }, + }, + "required": [ + "result", + ], + "type": "object", + }, + "type": "rpc", + }, + "array": { + "errors": { + "not": {}, + }, + "init": { + "properties": { + "n": { + "type": "number", + }, + }, + "required": [ + "n", + ], + "type": "object", + }, + "output": { + "items": { + "type": "number", + }, + "type": "array", + }, + "type": "rpc", + }, + "arrayStream": { + "errors": { + "not": {}, + }, + "init": { + "properties": {}, + "type": "object", + }, + "input": { + "properties": { + "n": { + "type": "number", + }, + }, + "required": [ + "n", + ], + "type": "object", + }, + "output": { + "items": { + "type": "number", + }, + "type": "array", + }, + "type": "stream", + }, + "echo": { + "errors": { + "not": {}, + }, + "init": { + "properties": {}, + "type": "object", + }, + "input": { + "properties": { + "ignore": { + "type": "boolean", + }, + "msg": { + "type": "string", + }, + }, + "required": [ + "msg", + "ignore", + ], + "type": "object", + }, + "output": { + "properties": { + "response": { + "type": "string", + }, + }, + "required": [ + "response", + ], + "type": "object", + }, + "type": "stream", + }, + "echoUnion": { + "description": "Echos back whatever we sent", + "errors": { + "not": {}, + }, + "init": { + "anyOf": [ + { + "description": "A", + "properties": { + "a": { + "description": "A number", + "type": "number", + }, + }, + "required": [ + "a", + ], + "type": "object", + }, + { + "description": "B", + "properties": { + "b": { + "description": "A string", + "type": "string", + }, + }, + "required": [ + "b", + ], + "type": "object", + }, + ], + }, + "output": { + "anyOf": [ + { + "description": "A", + "properties": { + "a": { + "description": "A number", + "type": "number", + }, + }, + "required": [ + "a", + ], + "type": "object", + }, + { + "description": "B", + "properties": { + "b": { + "description": "A string", + "type": "string", + }, + }, + "required": [ + "b", + ], + "type": "object", + }, + ], + }, + "type": "rpc", + }, + "echoWithPrefix": { + "errors": { + "not": {}, + }, + "init": { + "properties": { + "prefix": { + "type": "string", + }, + }, + "required": [ + "prefix", + ], + "type": "object", + }, + "input": { + "properties": { + "ignore": { + "type": "boolean", + }, + "msg": { + "type": "string", + }, + }, + "required": [ + "msg", + "ignore", + ], + "type": "object", + }, + "output": { + "properties": { + "response": { + "type": "string", + }, + }, + "required": [ + "response", + ], + "type": "object", + }, + "type": "stream", + }, + "unimplementedSubscription": { + "errors": { + "not": {}, + }, + "init": { + "properties": {}, + "type": "object", + }, + "output": { + "properties": {}, + "type": "object", + }, + "type": "subscription", + }, + "unimplementedUpload": { + "errors": { + "not": {}, + }, + "init": { + "properties": {}, + "type": "object", + }, + "input": { + "properties": {}, + "type": "object", + }, + "output": { + "properties": {}, + "type": "object", + }, + "type": "upload", + }, + }, + }, + }, +} +`; + +exports[`serialize service to jsonschema > serialize backwards compatible with v1 1`] = ` +{ + "procedures": { + "add": { + "errors": { + "not": {}, + }, + "input": { + "properties": { + "n": { + "type": "number", + }, + }, + "required": [ + "n", + ], + "type": "object", + }, + "output": { + "properties": { + "result": { + "type": "number", + }, + }, + "required": [ + "result", + ], + "type": "object", + }, + "type": "rpc", + }, + "array": { + "errors": { + "not": {}, + }, + "input": { + "properties": { + "n": { + "type": "number", + }, + }, + "required": [ + "n", + ], + "type": "object", + }, + "output": { + "items": { + "type": "number", + }, + "type": "array", + }, + "type": "rpc", + }, + "arrayStream": { + "errors": { + "not": {}, + }, + "init": { + "properties": {}, + "type": "object", + }, + "input": { + "properties": { + "n": { + "type": "number", + }, + }, + "required": [ + "n", + ], + "type": "object", + }, + "output": { + "items": { + "type": "number", + }, + "type": "array", + }, + "type": "stream", + }, + "echo": { + "errors": { + "not": {}, + }, + "init": { + "properties": {}, + "type": "object", + }, + "input": { + "properties": { + "ignore": { + "type": "boolean", + }, + "msg": { + "type": "string", + }, + }, + "required": [ + "msg", + "ignore", + ], + "type": "object", + }, + "output": { + "properties": { + "response": { + "type": "string", + }, + }, + "required": [ + "response", + ], + "type": "object", + }, + "type": "stream", + }, + "echoUnion": { + "description": "Echos back whatever we sent", + "errors": { + "not": {}, + }, + "input": { + "anyOf": [ + { + "description": "A", + "properties": { + "a": { + "description": "A number", + "type": "number", + }, + }, + "required": [ + "a", + ], + "type": "object", + }, + { + "description": "B", + "properties": { + "b": { + "description": "A string", + "type": "string", + }, + }, + "required": [ + "b", + ], + "type": "object", + }, + ], + }, + "output": { + "anyOf": [ + { + "description": "A", + "properties": { + "a": { + "description": "A number", + "type": "number", + }, + }, + "required": [ + "a", + ], + "type": "object", + }, + { + "description": "B", + "properties": { + "b": { + "description": "A string", + "type": "string", + }, + }, + "required": [ + "b", + ], + "type": "object", + }, + ], + }, + "type": "rpc", + }, + "echoWithPrefix": { + "errors": { + "not": {}, + }, + "init": { + "properties": { + "prefix": { + "type": "string", + }, + }, + "required": [ + "prefix", + ], + "type": "object", + }, + "input": { + "properties": { + "ignore": { + "type": "boolean", + }, + "msg": { + "type": "string", + }, + }, + "required": [ + "msg", + "ignore", + ], + "type": "object", + }, + "output": { + "properties": { + "response": { + "type": "string", + }, + }, + "required": [ + "response", + ], + "type": "object", + }, + "type": "stream", + }, + "unimplementedSubscription": { + "errors": { + "not": {}, + }, + "input": { + "properties": {}, + "type": "object", + }, + "output": { + "properties": {}, + "type": "object", + }, + "type": "subscription", + }, + "unimplementedUpload": { + "errors": { + "not": {}, + }, + "init": { + "properties": {}, + "type": "object", + }, + "input": { + "properties": {}, + "type": "object", + }, + "output": { + "properties": {}, + "type": "object", + }, + "type": "upload", + }, + }, +} +`; + +exports[`serialize service to jsonschema > serialize basic service 1`] = ` +{ + "procedures": { + "add": { + "errors": { + "not": {}, + }, + "init": { + "properties": { + "n": { + "type": "number", + }, + }, + "required": [ + "n", + ], + "type": "object", + }, + "output": { + "properties": { + "result": { + "type": "number", + }, + }, + "required": [ + "result", + ], + "type": "object", + }, + "type": "rpc", + }, + "array": { + "errors": { + "not": {}, + }, + "init": { + "properties": { + "n": { + "type": "number", + }, + }, + "required": [ + "n", + ], + "type": "object", + }, + "output": { + "items": { + "type": "number", + }, + "type": "array", + }, + "type": "rpc", + }, + "arrayStream": { + "errors": { + "not": {}, + }, + "init": { + "properties": {}, + "type": "object", + }, + "input": { + "properties": { + "n": { + "type": "number", + }, + }, + "required": [ + "n", + ], + "type": "object", + }, + "output": { + "items": { + "type": "number", + }, + "type": "array", + }, + "type": "stream", + }, + "echo": { + "errors": { + "not": {}, + }, + "init": { + "properties": {}, + "type": "object", + }, + "input": { + "properties": { + "ignore": { + "type": "boolean", + }, + "msg": { + "type": "string", + }, + }, + "required": [ + "msg", + "ignore", + ], + "type": "object", + }, + "output": { + "properties": { + "response": { + "type": "string", + }, + }, + "required": [ + "response", + ], + "type": "object", + }, + "type": "stream", + }, + "echoUnion": { + "description": "Echos back whatever we sent", + "errors": { + "not": {}, + }, + "init": { + "anyOf": [ + { + "description": "A", + "properties": { + "a": { + "description": "A number", + "type": "number", + }, + }, + "required": [ + "a", + ], + "type": "object", + }, + { + "description": "B", + "properties": { + "b": { + "description": "A string", + "type": "string", + }, + }, + "required": [ + "b", + ], + "type": "object", + }, + ], + }, + "output": { + "anyOf": [ + { + "description": "A", + "properties": { + "a": { + "description": "A number", + "type": "number", + }, + }, + "required": [ + "a", + ], + "type": "object", + }, + { + "description": "B", + "properties": { + "b": { + "description": "A string", + "type": "string", + }, + }, + "required": [ + "b", + ], + "type": "object", + }, + ], + }, + "type": "rpc", + }, + "echoWithPrefix": { + "errors": { + "not": {}, + }, + "init": { + "properties": { + "prefix": { + "type": "string", + }, + }, + "required": [ + "prefix", + ], + "type": "object", + }, + "input": { + "properties": { + "ignore": { + "type": "boolean", + }, + "msg": { + "type": "string", + }, + }, + "required": [ + "msg", + "ignore", + ], + "type": "object", + }, + "output": { + "properties": { + "response": { + "type": "string", + }, + }, + "required": [ + "response", + ], + "type": "object", + }, + "type": "stream", + }, + "unimplementedSubscription": { + "errors": { + "not": {}, + }, + "init": { + "properties": {}, + "type": "object", + }, + "output": { + "properties": {}, + "type": "object", + }, + "type": "subscription", + }, + "unimplementedUpload": { + "errors": { + "not": {}, + }, + "init": { + "properties": {}, + "type": "object", + }, + "input": { + "properties": {}, + "type": "object", + }, + "output": { + "properties": {}, + "type": "object", + }, + "type": "upload", + }, + }, +} +`; + +exports[`serialize service to jsonschema > serialize service with binary 1`] = ` +{ + "procedures": { + "getFile": { + "errors": { + "not": {}, + }, + "init": { + "properties": { + "file": { + "type": "string", + }, + }, + "required": [ + "file", + ], + "type": "object", + }, + "output": { + "properties": { + "contents": { + "type": "Uint8Array", + }, + }, + "required": [ + "contents", + ], + "type": "object", + }, + "type": "rpc", + }, + }, +} +`; + +exports[`serialize service to jsonschema > serialize service with errors 1`] = ` +{ + "procedures": { + "divide": { + "errors": { + "anyOf": [ + { + "properties": { + "code": { + "const": "DIV_BY_ZERO", + "type": "string", + }, + "extras": { + "properties": { + "test": { + "type": "string", + }, + }, + "required": [ + "test", + ], + "type": "object", + }, + "message": { + "type": "string", + }, + }, + "required": [ + "code", + "message", + "extras", + ], + "type": "object", + }, + { + "properties": { + "code": { + "const": "INFINITY", + "type": "string", + }, + "message": { + "type": "string", + }, + }, + "required": [ + "code", + "message", + ], + "type": "object", + }, + ], + }, + "init": { + "properties": { + "a": { + "type": "number", + }, + "b": { + "type": "number", + }, + }, + "required": [ + "a", + "b", + ], + "type": "object", + }, + "output": { + "properties": { + "result": { + "type": "number", + }, + }, + "required": [ + "result", + ], + "type": "object", + }, + "type": "rpc", + }, + "echo": { + "errors": { + "properties": { + "code": { + "const": "STREAM_ERROR", + "type": "string", + }, + "message": { + "type": "string", + }, + }, + "required": [ + "code", + "message", + ], + "type": "object", + }, + "init": { + "properties": {}, + "type": "object", + }, + "input": { + "properties": { + "msg": { + "type": "string", + }, + "throwError": { + "type": "boolean", + }, + "throwResult": { + "type": "boolean", + }, + }, + "required": [ + "msg", + "throwResult", + "throwError", + ], + "type": "object", + }, + "output": { + "properties": { + "response": { + "type": "string", + }, + }, + "required": [ + "response", + ], + "type": "object", + }, + "type": "stream", + }, + }, +} +`; diff --git a/__tests__/serialize.test.ts b/__tests__/serialize.test.ts index f830c567..d751b913 100644 --- a/__tests__/serialize.test.ts +++ b/__tests__/serialize.test.ts @@ -14,819 +14,24 @@ describe('serialize server to jsonschema', () => { token: Type.String(), }); - expect(serializeSchema(schema, handshakeSchema)).toStrictEqual({ - handshakeSchema: { - properties: { - token: { type: 'string' }, - }, - required: ['token'], - type: 'object', - }, - services: { - test: { - procedures: { - add: { - init: { - properties: { - n: { type: 'number' }, - }, - required: ['n'], - type: 'object', - }, - output: { - properties: { - result: { type: 'number' }, - }, - required: ['result'], - type: 'object', - }, - errors: { - not: {}, - }, - type: 'rpc', - }, - array: { - errors: { - not: {}, - }, - init: { - properties: { - n: { - type: 'number', - }, - }, - required: ['n'], - type: 'object', - }, - output: { - items: { - type: 'number', - }, - type: 'array', - }, - type: 'rpc', - }, - arrayStream: { - errors: { - not: {}, - }, - init: { - properties: {}, - type: 'object', - }, - input: { - properties: { - n: { - type: 'number', - }, - }, - required: ['n'], - type: 'object', - }, - output: { - items: { - type: 'number', - }, - type: 'array', - }, - type: 'stream', - }, - echo: { - init: { - properties: {}, - type: 'object', - }, - input: { - properties: { - msg: { type: 'string' }, - ignore: { type: 'boolean' }, - }, - required: ['msg', 'ignore'], - type: 'object', - }, - output: { - properties: { - response: { type: 'string' }, - }, - required: ['response'], - type: 'object', - }, - errors: { - not: {}, - }, - type: 'stream', - }, - echoWithPrefix: { - errors: { - not: {}, - }, - init: { - properties: { - prefix: { - type: 'string', - }, - }, - required: ['prefix'], - type: 'object', - }, - input: { - properties: { - ignore: { - type: 'boolean', - }, - msg: { - type: 'string', - }, - }, - required: ['msg', 'ignore'], - type: 'object', - }, - output: { - properties: { - response: { - type: 'string', - }, - }, - required: ['response'], - type: 'object', - }, - type: 'stream', - }, - echoUnion: { - description: 'Echos back whatever we sent', - errors: { - not: {}, - }, - init: { - anyOf: [ - { - description: 'A', - properties: { - a: { - description: 'A number', - type: 'number', - }, - }, - required: ['a'], - type: 'object', - }, - { - description: 'B', - properties: { - b: { - description: 'A string', - type: 'string', - }, - }, - required: ['b'], - type: 'object', - }, - ], - }, - output: { - anyOf: [ - { - description: 'A', - properties: { - a: { - description: 'A number', - type: 'number', - }, - }, - required: ['a'], - type: 'object', - }, - { - description: 'B', - properties: { - b: { - description: 'A string', - type: 'string', - }, - }, - required: ['b'], - type: 'object', - }, - ], - }, - type: 'rpc', - }, - unimplementedSubscription: { - errors: { - not: {}, - }, - init: { - properties: {}, - type: 'object', - }, - output: { - properties: {}, - type: 'object', - }, - type: 'subscription', - }, - unimplementedUpload: { - errors: { - not: {}, - }, - init: { - properties: {}, - type: 'object', - }, - input: { - properties: {}, - type: 'object', - }, - output: { - properties: {}, - type: 'object', - }, - type: 'upload', - }, - }, - }, - }, - }); + expect(serializeSchema(schema, handshakeSchema)).toMatchSnapshot(); }); }); describe('serialize service to jsonschema', () => { test('serialize basic service', () => { - expect(TestServiceSchema.serialize()).toStrictEqual({ - procedures: { - add: { - init: { - properties: { - n: { type: 'number' }, - }, - required: ['n'], - type: 'object', - }, - output: { - properties: { - result: { type: 'number' }, - }, - required: ['result'], - type: 'object', - }, - errors: { - not: {}, - }, - type: 'rpc', - }, - array: { - errors: { - not: {}, - }, - init: { - properties: { - n: { - type: 'number', - }, - }, - required: ['n'], - type: 'object', - }, - output: { - items: { - type: 'number', - }, - type: 'array', - }, - type: 'rpc', - }, - arrayStream: { - errors: { - not: {}, - }, - init: { - properties: {}, - type: 'object', - }, - input: { - properties: { - n: { - type: 'number', - }, - }, - required: ['n'], - type: 'object', - }, - output: { - items: { - type: 'number', - }, - type: 'array', - }, - type: 'stream', - }, - echo: { - init: { - properties: {}, - type: 'object', - }, - input: { - properties: { - msg: { type: 'string' }, - ignore: { type: 'boolean' }, - }, - required: ['msg', 'ignore'], - type: 'object', - }, - output: { - properties: { - response: { type: 'string' }, - }, - required: ['response'], - type: 'object', - }, - errors: { - not: {}, - }, - type: 'stream', - }, - echoWithPrefix: { - errors: { - not: {}, - }, - init: { - properties: { - prefix: { - type: 'string', - }, - }, - required: ['prefix'], - type: 'object', - }, - input: { - properties: { - ignore: { - type: 'boolean', - }, - msg: { - type: 'string', - }, - }, - required: ['msg', 'ignore'], - type: 'object', - }, - output: { - properties: { - response: { - type: 'string', - }, - }, - required: ['response'], - type: 'object', - }, - type: 'stream', - }, - echoUnion: { - description: 'Echos back whatever we sent', - errors: { - not: {}, - }, - init: { - anyOf: [ - { - description: 'A', - properties: { - a: { - description: 'A number', - type: 'number', - }, - }, - required: ['a'], - type: 'object', - }, - { - description: 'B', - properties: { - b: { - description: 'A string', - type: 'string', - }, - }, - required: ['b'], - type: 'object', - }, - ], - }, - output: { - anyOf: [ - { - description: 'A', - properties: { - a: { - description: 'A number', - type: 'number', - }, - }, - required: ['a'], - type: 'object', - }, - { - description: 'B', - properties: { - b: { - description: 'A string', - type: 'string', - }, - }, - required: ['b'], - type: 'object', - }, - ], - }, - type: 'rpc', - }, - unimplementedSubscription: { - errors: { - not: {}, - }, - init: { - properties: {}, - type: 'object', - }, - output: { - properties: {}, - type: 'object', - }, - type: 'subscription', - }, - unimplementedUpload: { - errors: { - not: {}, - }, - init: { - properties: {}, - type: 'object', - }, - input: { - properties: {}, - type: 'object', - }, - output: { - properties: {}, - type: 'object', - }, - type: 'upload', - }, - }, - }); + expect(TestServiceSchema.serialize()).toMatchSnapshot(); }); test('serialize service with binary', () => { - expect(BinaryFileServiceSchema.serialize()).toStrictEqual({ - procedures: { - getFile: { - errors: { - not: {}, - }, - init: { - properties: { - file: { - type: 'string', - }, - }, - required: ['file'], - type: 'object', - }, - output: { - properties: { - contents: { - type: 'Uint8Array', - }, - }, - required: ['contents'], - type: 'object', - }, - type: 'rpc', - }, - }, - }); + expect(BinaryFileServiceSchema.serialize()).toMatchSnapshot(); }); test('serialize service with errors', () => { - expect(FallibleServiceSchema.serialize()).toStrictEqual({ - procedures: { - divide: { - init: { - properties: { - a: { type: 'number' }, - b: { type: 'number' }, - }, - required: ['a', 'b'], - type: 'object', - }, - output: { - properties: { - result: { type: 'number' }, - }, - required: ['result'], - type: 'object', - }, - errors: { - anyOf: [ - { - properties: { - code: { const: 'DIV_BY_ZERO', type: 'string' }, - message: { type: 'string' }, - extras: { - properties: { - test: { - type: 'string', - }, - }, - required: ['test'], - type: 'object', - }, - }, - required: ['code', 'message', 'extras'], - type: 'object', - }, - { - properties: { - code: { const: 'INFINITY', type: 'string' }, - message: { type: 'string' }, - }, - required: ['code', 'message'], - type: 'object', - }, - ], - }, - type: 'rpc', - }, - echo: { - errors: { - properties: { - code: { - const: 'STREAM_ERROR', - type: 'string', - }, - message: { - type: 'string', - }, - }, - required: ['code', 'message'], - type: 'object', - }, - init: { - properties: {}, - type: 'object', - }, - input: { - properties: { - msg: { - type: 'string', - }, - throwError: { - type: 'boolean', - }, - throwResult: { - type: 'boolean', - }, - }, - required: ['msg', 'throwResult', 'throwError'], - type: 'object', - }, - output: { - properties: { - response: { - type: 'string', - }, - }, - required: ['response'], - type: 'object', - }, - type: 'stream', - }, - }, - }); + expect(FallibleServiceSchema.serialize()).toMatchSnapshot(); }); test('serialize backwards compatible with v1', () => { - expect(TestServiceSchema.serializeV1Compat()).toStrictEqual({ - procedures: { - add: { - input: { - properties: { - n: { type: 'number' }, - }, - required: ['n'], - type: 'object', - }, - output: { - properties: { - result: { type: 'number' }, - }, - required: ['result'], - type: 'object', - }, - errors: { - not: {}, - }, - type: 'rpc', - }, - array: { - errors: { - not: {}, - }, - input: { - properties: { - n: { - type: 'number', - }, - }, - required: ['n'], - type: 'object', - }, - output: { - items: { - type: 'number', - }, - type: 'array', - }, - type: 'rpc', - }, - arrayStream: { - errors: { - not: {}, - }, - init: { - properties: {}, - type: 'object', - }, - input: { - properties: { - n: { - type: 'number', - }, - }, - required: ['n'], - type: 'object', - }, - output: { - items: { - type: 'number', - }, - type: 'array', - }, - type: 'stream', - }, - echo: { - init: { - properties: {}, - type: 'object', - }, - input: { - properties: { - msg: { type: 'string' }, - ignore: { type: 'boolean' }, - }, - required: ['msg', 'ignore'], - type: 'object', - }, - output: { - properties: { - response: { type: 'string' }, - }, - required: ['response'], - type: 'object', - }, - errors: { - not: {}, - }, - type: 'stream', - }, - echoWithPrefix: { - errors: { - not: {}, - }, - init: { - properties: { - prefix: { - type: 'string', - }, - }, - required: ['prefix'], - type: 'object', - }, - input: { - properties: { - ignore: { - type: 'boolean', - }, - msg: { - type: 'string', - }, - }, - required: ['msg', 'ignore'], - type: 'object', - }, - output: { - properties: { - response: { - type: 'string', - }, - }, - required: ['response'], - type: 'object', - }, - type: 'stream', - }, - echoUnion: { - description: 'Echos back whatever we sent', - errors: { - not: {}, - }, - input: { - anyOf: [ - { - description: 'A', - properties: { - a: { - description: 'A number', - type: 'number', - }, - }, - required: ['a'], - type: 'object', - }, - { - description: 'B', - properties: { - b: { - description: 'A string', - type: 'string', - }, - }, - required: ['b'], - type: 'object', - }, - ], - }, - output: { - anyOf: [ - { - description: 'A', - properties: { - a: { - description: 'A number', - type: 'number', - }, - }, - required: ['a'], - type: 'object', - }, - { - description: 'B', - properties: { - b: { - description: 'A string', - type: 'string', - }, - }, - required: ['b'], - type: 'object', - }, - ], - }, - type: 'rpc', - }, - unimplementedSubscription: { - errors: { - not: {}, - }, - input: { - properties: {}, - type: 'object', - }, - output: { - properties: {}, - type: 'object', - }, - type: 'subscription', - }, - unimplementedUpload: { - errors: { - not: {}, - }, - init: { - properties: {}, - type: 'object', - }, - input: { - properties: {}, - type: 'object', - }, - output: { - properties: {}, - type: 'object', - }, - type: 'upload', - }, - }, - }); + expect(TestServiceSchema.serializeV1Compat()).toMatchSnapshot(); }); });