diff --git a/examples/file-uri-input/README.md b/examples/file-uri-input/README.md new file mode 100644 index 0000000000..92f3825ff5 --- /dev/null +++ b/examples/file-uri-input/README.md @@ -0,0 +1,17 @@ +# Generate models using file URI as input + +A basic example of how to generate models using file URI as input for AsyncAPI + +## How to run this example + +Run this example using: + +```sh +npm i && npm run start +``` + +If you are on Windows, use the `start:windows` script instead: + +```sh +npm i && npm run start:windows +``` diff --git a/examples/file-uri-input/__snapshots__/index.spec.ts.snap b/examples/file-uri-input/__snapshots__/index.spec.ts.snap new file mode 100644 index 0000000000..a563fe8ae8 --- /dev/null +++ b/examples/file-uri-input/__snapshots__/index.spec.ts.snap @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Should be able to generate models using file URI as input to output folder and should log expected output to console 1`] = ` +Array [ + "class AnonymousSchema_1 { + private _displayName?: string; + private _email?: string; + private _additionalProperties?: Map; + + constructor(input: { + displayName?: string, + email?: string, + additionalProperties?: Map, + }) { + this._displayName = input.displayName; + this._email = input.email; + this._additionalProperties = input.additionalProperties; + } + + get displayName(): string | undefined { return this._displayName; } + set displayName(displayName: string | undefined) { this._displayName = displayName; } + + get email(): string | undefined { return this._email; } + set email(email: string | undefined) { this._email = email; } + + get additionalProperties(): Map | undefined { return this._additionalProperties; } + set additionalProperties(additionalProperties: Map | undefined) { this._additionalProperties = additionalProperties; } +}", +] +`; + +exports[`Should be able to render models using file URI as input and should log expected output to console 1`] = ` +Array [ + "class AnonymousSchema_1 { + private _displayName?: string; + private _email?: string; + private _additionalProperties?: Map; + + constructor(input: { + displayName?: string, + email?: string, + additionalProperties?: Map, + }) { + this._displayName = input.displayName; + this._email = input.email; + this._additionalProperties = input.additionalProperties; + } + + get displayName(): string | undefined { return this._displayName; } + set displayName(displayName: string | undefined) { this._displayName = displayName; } + + get email(): string | undefined { return this._email; } + set email(email: string | undefined) { this._email = email; } + + get additionalProperties(): Map | undefined { return this._additionalProperties; } + set additionalProperties(additionalProperties: Map | undefined) { this._additionalProperties = additionalProperties; } +}", +] +`; diff --git a/examples/file-uri-input/index.spec.ts b/examples/file-uri-input/index.spec.ts new file mode 100644 index 0000000000..428b0cf504 --- /dev/null +++ b/examples/file-uri-input/index.spec.ts @@ -0,0 +1,26 @@ +const spy = jest.spyOn(global.console, 'log').mockImplementation(() => { + return; +}); +import { generate, generateToFiles } from './index'; + +describe('Should be able to render models using file URI as input', () => { + afterAll(() => { + jest.restoreAllMocks(); + }); + test('and should log expected output to console', async () => { + await generate(); + expect(spy.mock.calls.length).toEqual(1); + expect(spy.mock.calls[0]).toMatchSnapshot(); + }); +}); + +describe('Should be able to generate models using file URI as input to output folder', () => { + afterAll(() => { + jest.restoreAllMocks(); + }); + test('and should log expected output to console', async () => { + await generateToFiles(); + expect(spy.mock.calls.length).toEqual(1); + expect(spy.mock.calls[0]).toMatchSnapshot(); + }); +}); diff --git a/examples/file-uri-input/index.ts b/examples/file-uri-input/index.ts new file mode 100644 index 0000000000..30fd45356a --- /dev/null +++ b/examples/file-uri-input/index.ts @@ -0,0 +1,26 @@ +import path from 'path'; +import { TypeScriptFileGenerator, TypeScriptGenerator } from '../../src'; + +const generator = new TypeScriptGenerator(); +const fileGenerator = new TypeScriptFileGenerator(); + +export async function generate(): Promise { + const fileUri = `file://${path.resolve(__dirname, './testasyncapi.yml')}`; + const models = await generator.generate(fileUri); + for (const model of models) { + console.log(model.result); + } +} + +export async function generateToFiles(): Promise { + const outputFolder = './examples/file-uri-input/output'; + const fileUri = `file://${path.resolve(__dirname, './testasyncapi.yml')}`; + const models = await fileGenerator.generateToFiles(fileUri, outputFolder); + for (const model of models) { + console.log(model.result); + } +} +if (require.main === module) { + generate(); + generateToFiles(); +} diff --git a/examples/file-uri-input/package-lock.json b/examples/file-uri-input/package-lock.json new file mode 100644 index 0000000000..56ab4e873b --- /dev/null +++ b/examples/file-uri-input/package-lock.json @@ -0,0 +1,10 @@ +{ + "name": "typescript-interface", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "hasInstallScript": true + } + } +} diff --git a/examples/file-uri-input/package.json b/examples/file-uri-input/package.json new file mode 100644 index 0000000000..4dd081d2e1 --- /dev/null +++ b/examples/file-uri-input/package.json @@ -0,0 +1,10 @@ +{ + "config" : { "example_name" : "file-uri-input" }, + "scripts": { + "install": "cd ../.. && npm i", + "start": "../../node_modules/.bin/ts-node --cwd ../../ ./examples/$npm_package_config_example_name/index.ts", + "start:windows": "..\\..\\node_modules\\.bin\\ts-node --cwd ..\\..\\ .\\examples\\%npm_package_config_example_name%\\index.ts", + "test": "../../node_modules/.bin/jest --config=../../jest.config.js ./examples/$npm_package_config_example_name/index.spec.ts", + "test:windows": "..\\..\\node_modules\\.bin\\jest --config=..\\..\\jest.config.js examples/%npm_package_config_example_name%/index.spec.ts" + } +} diff --git a/examples/file-uri-input/testasyncapi.yml b/examples/file-uri-input/testasyncapi.yml new file mode 100644 index 0000000000..fbb3f891b7 --- /dev/null +++ b/examples/file-uri-input/testasyncapi.yml @@ -0,0 +1,23 @@ +asyncapi: '2.6.0' +info: + title: Account Service + version: 1.0.0 + description: This service is in charge of processing user signups +channels: + user/signedup: + subscribe: + message: + $ref: '#/components/messages/UserSignedUp' +components: + messages: + UserSignedUp: + payload: + type: object + properties: + displayName: + type: string + description: Name of the user + email: + type: string + format: email + description: Email of the user \ No newline at end of file diff --git a/src/generators/AbstractFileGenerator.ts b/src/generators/AbstractFileGenerator.ts index 6ce8c1801e..75da970fd6 100644 --- a/src/generators/AbstractFileGenerator.ts +++ b/src/generators/AbstractFileGenerator.ts @@ -7,7 +7,7 @@ export type FileGenerator = (content: string, toFile: string) => Promise; */ export interface AbstractFileGenerator { generateToFiles( - input: Record | InputMetaModel, + input: any | InputMetaModel, outputDirectory: string, options: RenderCompleteModelOptions ): Promise; diff --git a/src/generators/cplusplus/CplusplusFileGenerator.ts b/src/generators/cplusplus/CplusplusFileGenerator.ts index d57022af85..71281a7ccb 100644 --- a/src/generators/cplusplus/CplusplusFileGenerator.ts +++ b/src/generators/cplusplus/CplusplusFileGenerator.ts @@ -16,7 +16,7 @@ export class CplusplusFileGenerator * @param options */ public async generateToFiles( - input: Record | InputMetaModel, + input: any | InputMetaModel, outputDirectory: string, options?: CplusplusRenderCompleteModelOptions, ensureFilesWritten = false diff --git a/src/generators/csharp/CSharpFileGenerator.ts b/src/generators/csharp/CSharpFileGenerator.ts index da32f8f90e..8ac2c618bb 100644 --- a/src/generators/csharp/CSharpFileGenerator.ts +++ b/src/generators/csharp/CSharpFileGenerator.ts @@ -18,7 +18,7 @@ export class CSharpFileGenerator * @param ensureFilesWritten verify that the files is completely written before returning, this can happen if the file system is swamped with write requests. */ public async generateToFiles( - input: Record | InputMetaModel, + input: any | InputMetaModel, outputDirectory: string, options: DeepPartial, ensureFilesWritten = false diff --git a/src/generators/dart/DartFileGenerator.ts b/src/generators/dart/DartFileGenerator.ts index f00a800a53..f85d0c374a 100644 --- a/src/generators/dart/DartFileGenerator.ts +++ b/src/generators/dart/DartFileGenerator.ts @@ -17,7 +17,7 @@ export class DartFileGenerator * @param ensureFilesWritten verify that the files is completely written before returning, this can happen if the file system is swamped with write requests. */ public async generateToFiles( - input: Record | InputMetaModel, + input: any | InputMetaModel, outputDirectory: string, options: DartRenderCompleteModelOptions, ensureFilesWritten = false diff --git a/src/generators/go/GoFileGenerator.ts b/src/generators/go/GoFileGenerator.ts index 785a47a0de..0324932955 100644 --- a/src/generators/go/GoFileGenerator.ts +++ b/src/generators/go/GoFileGenerator.ts @@ -17,7 +17,7 @@ export class GoFileGenerator * @param ensureFilesWritten verify that the files is completely written before returning, this can happen if the file system is swamped with write requests. */ public async generateToFiles( - input: Record | InputMetaModel, + input: any | InputMetaModel, outputDirectory: string, options: GoRenderCompleteModelOptions, ensureFilesWritten = false diff --git a/src/generators/java/JavaFileGenerator.ts b/src/generators/java/JavaFileGenerator.ts index e9c045fd0b..8aa224e40d 100644 --- a/src/generators/java/JavaFileGenerator.ts +++ b/src/generators/java/JavaFileGenerator.ts @@ -17,7 +17,7 @@ export class JavaFileGenerator * @param ensureFilesWritten verify that the files is completely written before returning, this can happen if the file system is swamped with write requests. */ public async generateToFiles( - input: Record | InputMetaModel, + input: any | InputMetaModel, outputDirectory: string, options: JavaRenderCompleteModelOptions, ensureFilesWritten = false diff --git a/src/generators/javascript/JavaScriptFileGenerator.ts b/src/generators/javascript/JavaScriptFileGenerator.ts index ddebdaae5d..cadfdc6406 100644 --- a/src/generators/javascript/JavaScriptFileGenerator.ts +++ b/src/generators/javascript/JavaScriptFileGenerator.ts @@ -17,7 +17,7 @@ export class JavaScriptFileGenerator * @param ensureFilesWritten verify that the files is completely written before returning, this can happen if the file system is swamped with write requests. */ public async generateToFiles( - input: Record | InputMetaModel, + input: any | InputMetaModel, outputDirectory: string, options?: JavaScriptRenderCompleteModelOptions, ensureFilesWritten = false diff --git a/src/generators/kotlin/KotlinFileGenerator.ts b/src/generators/kotlin/KotlinFileGenerator.ts index e0686ecae9..446a08738b 100644 --- a/src/generators/kotlin/KotlinFileGenerator.ts +++ b/src/generators/kotlin/KotlinFileGenerator.ts @@ -17,7 +17,7 @@ export class KotlinFileGenerator * @param ensureFilesWritten verify that the files is completely written before returning, this can happen if the file system is swamped with write requests. */ public async generateToFiles( - input: Record | InputMetaModel, + input: any | InputMetaModel, outputDirectory: string, options: KotlinRenderCompleteModelOptions, ensureFilesWritten = false diff --git a/src/generators/php/PhpFileGenerator.ts b/src/generators/php/PhpFileGenerator.ts index 377ba57cfe..90dc949295 100644 --- a/src/generators/php/PhpFileGenerator.ts +++ b/src/generators/php/PhpFileGenerator.ts @@ -17,7 +17,7 @@ export class PhpFileGenerator * @param ensureFilesWritten */ public async generateToFiles( - input: Record | InputMetaModel, + input: any | InputMetaModel, outputDirectory: string, options?: PhpRenderCompleteModelOptions, ensureFilesWritten = false diff --git a/src/generators/python/PythonFileGenerator.ts b/src/generators/python/PythonFileGenerator.ts index 79854bec8b..46b2fecbc4 100644 --- a/src/generators/python/PythonFileGenerator.ts +++ b/src/generators/python/PythonFileGenerator.ts @@ -17,7 +17,7 @@ export class PythonFileGenerator * @param ensureFilesWritten verify that the files is completely written before returning, this can happen if the file system is swamped with write requests. */ public async generateToFiles( - input: Record | InputMetaModel, + input: any | InputMetaModel, outputDirectory: string, options: PythonRenderCompleteModelOptions, ensureFilesWritten = false diff --git a/src/generators/rust/RustFileGenerator.ts b/src/generators/rust/RustFileGenerator.ts index 5264aad16b..8a6b8609c3 100644 --- a/src/generators/rust/RustFileGenerator.ts +++ b/src/generators/rust/RustFileGenerator.ts @@ -17,7 +17,7 @@ export class RustFileGenerator * @param ensureFilesWritten verify that the files is completely written before returning, this can happen if the file system is swamped with write requests. */ public async generateToFiles( - input: Record | InputMetaModel, + input: any | InputMetaModel, outputDirectory: string, options: RustRenderCompleteModelOptions, ensureFilesWritten = false @@ -50,7 +50,7 @@ export class RustFileGenerator * @param ensureFilesWritten verify that the files is completely written before returning, this can happen if the file system is swamped with write requests. */ public async generateToPackage( - input: Record | InputMetaModel, + input: any | InputMetaModel, outputDirectory: string, options: RustRenderCompleteModelOptions, ensureFilesWritten = false diff --git a/src/generators/rust/RustGenerator.ts b/src/generators/rust/RustGenerator.ts index 758f5e2d60..c979bebbaa 100644 --- a/src/generators/rust/RustGenerator.ts +++ b/src/generators/rust/RustGenerator.ts @@ -419,7 +419,7 @@ export class RustGenerator extends AbstractGenerator< } async generateCompleteSupport( - input: Record | InputMetaModel, + input: any | InputMetaModel, completeModelOptions: Partial, options?: DeepPartial ): Promise { diff --git a/src/generators/template/TemplateFileGenerator.ts b/src/generators/template/TemplateFileGenerator.ts index 495a3851ad..cc92e87e1f 100644 --- a/src/generators/template/TemplateFileGenerator.ts +++ b/src/generators/template/TemplateFileGenerator.ts @@ -16,7 +16,7 @@ export class TemplateFileGenerator * @param options */ public async generateToFiles( - input: Record | InputMetaModel, + input: any | InputMetaModel, outputDirectory: string, options?: TemplateRenderCompleteModelOptions, ensureFilesWritten = false diff --git a/src/generators/typescript/TypeScriptFileGenerator.ts b/src/generators/typescript/TypeScriptFileGenerator.ts index 345937d4e4..06b59aa43d 100644 --- a/src/generators/typescript/TypeScriptFileGenerator.ts +++ b/src/generators/typescript/TypeScriptFileGenerator.ts @@ -13,7 +13,7 @@ export class TypeScriptFileGenerator extends TypeScriptGenerator { * @param ensureFilesWritten verify that the files is completely written before returning, this can happen if the file system is swamped with write requests. */ public async generateToFiles( - input: Record | InputMetaModel, + input: any | InputMetaModel, outputDirectory: string, options?: TypeScriptRenderCompleteModelOptions, ensureFilesWritten = false diff --git a/src/processors/AsyncAPIInputProcessor.ts b/src/processors/AsyncAPIInputProcessor.ts index ffb1cfcdd5..1ec4469439 100644 --- a/src/processors/AsyncAPIInputProcessor.ts +++ b/src/processors/AsyncAPIInputProcessor.ts @@ -1,11 +1,12 @@ /* eslint-disable no-undef */ /* eslint-disable @typescript-eslint/no-var-requires */ -import { +import Parser, { isAsyncAPIDocument, isOldAsyncAPIDocument, AsyncAPIDocumentInterface, SchemaInterface as AsyncAPISchemaInterface, SchemaV2 as AsyncAPISchema, + fromFile, createAsyncAPIDocument } from '@asyncapi/parser'; @@ -15,6 +16,8 @@ import { InputMetaModel, ProcessorOptions } from '../models'; import { Logger } from '../utils'; import { AsyncapiV2Schema } from '../models/AsyncapiV2Schema'; import { convertToMetaModel } from '../helpers'; +import fs from 'fs'; +import { fileURLToPath } from 'url'; import { NewParser } from '@smoya/multi-parser'; import { createDetailedAsyncAPI } from '@asyncapi/parser/cjs/utils'; @@ -44,7 +47,12 @@ export class AsyncAPIInputProcessor extends AbstractInputProcessor { input?: any, options?: ProcessorOptions ): Promise { - if (!this.shouldProcess(input)) { + let rawInput = input; + if (this.isFileInput(input)) { + rawInput = await this.getParsedFileInput(input); + } + + if (!this.shouldProcess(rawInput)) { throw new Error( 'Input is not an AsyncAPI document so it cannot be processed.' ); @@ -53,9 +61,9 @@ export class AsyncAPIInputProcessor extends AbstractInputProcessor { Logger.debug('Processing input as an AsyncAPI document'); let doc: AsyncAPIDocumentInterface | undefined; const inputModel = new InputMetaModel(); - if (isOldAsyncAPIDocument(input)) { + if (isOldAsyncAPIDocument(rawInput)) { // Is from old parser - const parsedJSON = input.json(); + const parsedJSON = rawInput.json(); const detailed = createDetailedAsyncAPI(parsedJSON, parsedJSON); doc = createAsyncAPIDocument(detailed); } else { @@ -65,7 +73,7 @@ export class AsyncAPIInputProcessor extends AbstractInputProcessor { includeSchemaParsers: true }); const { document, diagnostics } = await parser.parse( - input, + rawInput, parserOptions ); if (document) { @@ -365,6 +373,9 @@ export class AsyncAPIInputProcessor extends AbstractInputProcessor { if (!input) { return false; } + if (this.isFileInput(input)) { + return true; + } const version = this.tryGetVersionOfDocument(input); if (!version) { return false; @@ -404,4 +415,27 @@ export class AsyncAPIInputProcessor extends AbstractInputProcessor { static isFromNewParser(input?: any): boolean { return isAsyncAPIDocument(input); } + + isFileInput(input: any): boolean { + // prettier-ignore + return typeof input === 'string' && (/^file:\/\//g).test(input); + } + + async getParsedFileInput(input: string): Promise { + const filePath = fileURLToPath(input); + /* eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe as it just checks file existance */ + if (!fs.existsSync(filePath)) { + throw new Error('File does not exists.'); + } + const parser = new Parser(); + const { document, diagnostics } = await fromFile(parser, filePath).parse(); + if (!document) { + const err = new Error( + 'Input is not an correct AsyncAPI document so it cannot be processed.' + ); + (err as any).diagnostics = diagnostics; + throw err; + } + return document; + } } diff --git a/test/processors/AsyncAPIInputProcessor.spec.ts b/test/processors/AsyncAPIInputProcessor.spec.ts index b88d2343bf..6ff561be93 100644 --- a/test/processors/AsyncAPIInputProcessor.spec.ts +++ b/test/processors/AsyncAPIInputProcessor.spec.ts @@ -2,6 +2,7 @@ import * as fs from 'fs'; import * as path from 'path'; import { Parser } from '@asyncapi/parser'; import { AsyncAPIInputProcessor } from '../../src/processors/AsyncAPIInputProcessor'; +import { InputMetaModel } from '../../src/models'; const basicDocString = fs.readFileSync( path.resolve(__dirname, './AsyncAPIInputProcessor/basic.json'), @@ -19,6 +20,10 @@ const operationOneOf2DocString = fs.readFileSync( path.resolve(__dirname, './AsyncAPIInputProcessor/operation_oneof2.json'), 'utf8' ); +const ymlFileURI = `file://${path.resolve( + __dirname, + './AsyncAPIInputProcessor/testasyncapi.yml' +)}`; jest.mock('../../src/utils/LoggingInterface'); describe('AsyncAPIInputProcessor', () => { @@ -34,6 +39,9 @@ describe('AsyncAPIInputProcessor', () => { const { document } = await parser.parse(basicDocString); expect(processor.shouldProcess(document)).toEqual(true); }); + test('should be able to detect file', () => { + expect(processor.shouldProcess(ymlFileURI)).toEqual(true); + }); test('should be able to process AsyncAPI 2.0.0', () => { const parsedObject = { asyncapi: '2.0.0' }; expect(processor.shouldProcess(parsedObject)).toEqual(true); @@ -117,6 +125,13 @@ describe('AsyncAPIInputProcessor', () => { ); }); + test('should throw error when file does not exists', async () => { + const processor = new AsyncAPIInputProcessor(); + await expect(processor.process(`${ymlFileURI}test`)).rejects.toThrow( + 'File does not exists.' + ); + }); + test('should be able to process pure object', async () => { const basicDoc = JSON.parse(basicDocString); const processor = new AsyncAPIInputProcessor(); @@ -137,6 +152,13 @@ describe('AsyncAPIInputProcessor', () => { expect(commonInputModel).toMatchSnapshot(); }); + test('should be able to process file', async () => { + const processor = new AsyncAPIInputProcessor(); + const commonInputModel = await processor.process(ymlFileURI); + expect(commonInputModel instanceof InputMetaModel).toBeTruthy(); + expect(commonInputModel.models).toMatchSnapshot(); + }); + test('should be able to process operation with oneOf #1', async () => { const { document } = await parser.parse(operationOneOf1DocString); const processor = new AsyncAPIInputProcessor(); diff --git a/test/processors/AsyncAPIInputProcessor/testasyncapi.yml b/test/processors/AsyncAPIInputProcessor/testasyncapi.yml new file mode 100644 index 0000000000..fbb3f891b7 --- /dev/null +++ b/test/processors/AsyncAPIInputProcessor/testasyncapi.yml @@ -0,0 +1,23 @@ +asyncapi: '2.6.0' +info: + title: Account Service + version: 1.0.0 + description: This service is in charge of processing user signups +channels: + user/signedup: + subscribe: + message: + $ref: '#/components/messages/UserSignedUp' +components: + messages: + UserSignedUp: + payload: + type: object + properties: + displayName: + type: string + description: Name of the user + email: + type: string + format: email + description: Email of the user \ No newline at end of file diff --git a/test/processors/__snapshots__/AsyncAPIInputProcessor.spec.ts.snap b/test/processors/__snapshots__/AsyncAPIInputProcessor.spec.ts.snap index 44d5ca5890..2b7fab40bb 100644 --- a/test/processors/__snapshots__/AsyncAPIInputProcessor.spec.ts.snap +++ b/test/processors/__snapshots__/AsyncAPIInputProcessor.spec.ts.snap @@ -1,5 +1,102 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`AsyncAPIInputProcessor process() should be able to process file 1`] = ` +Object { + "anonymous_schema_1": ObjectModel { + "name": "anonymous_schema_1", + "options": Object { + "isNullable": false, + }, + "originalInput": AsyncapiV2Schema { + "properties": Object { + "displayName": AsyncapiV2Schema { + "description": "Name of the user", + "type": "string", + "x-modelgen-inferred-name": "anonymous_schema_2", + "x-parser-schema-id": "", + }, + "email": AsyncapiV2Schema { + "description": "Email of the user", + "format": "email", + "type": "string", + "x-modelgen-inferred-name": "anonymous_schema_3", + "x-parser-schema-id": "", + }, + }, + "type": "object", + "x-modelgen-inferred-name": "anonymous_schema_1", + "x-parser-schema-id": "", + }, + "properties": Object { + "additionalProperties": ObjectPropertyModel { + "property": DictionaryModel { + "key": StringModel { + "name": "additionalProperties", + "options": Object { + "isNullable": false, + }, + "originalInput": Array [ + true, + ], + }, + "name": "additionalProperties", + "options": Object { + "isNullable": false, + }, + "originalInput": Array [ + true, + ], + "serializationType": "unwrap", + "value": AnyModel { + "name": "undefined", + "options": Object { + "isNullable": true, + }, + "originalInput": true, + }, + }, + "propertyName": "additionalProperties", + "required": false, + }, + "displayName": ObjectPropertyModel { + "property": StringModel { + "name": "anonymous_schema_2", + "options": Object { + "isNullable": false, + }, + "originalInput": AsyncapiV2Schema { + "description": "Name of the user", + "type": "string", + "x-modelgen-inferred-name": "anonymous_schema_2", + "x-parser-schema-id": "", + }, + }, + "propertyName": "displayName", + "required": false, + }, + "email": ObjectPropertyModel { + "property": StringModel { + "name": "anonymous_schema_3", + "options": Object { + "format": "email", + "isNullable": false, + }, + "originalInput": AsyncapiV2Schema { + "description": "Email of the user", + "format": "email", + "type": "string", + "x-modelgen-inferred-name": "anonymous_schema_3", + "x-parser-schema-id": "", + }, + }, + "propertyName": "email", + "required": false, + }, + }, + }, +} +`; + exports[`AsyncAPIInputProcessor process() should be able to process operation with oneOf #1 1`] = ` InputMetaModel { "models": Object {