11/* eslint-disable security/detect-object-injection */
22import { AsyncAPIDocumentInterface } from '@asyncapi/parser' ;
3- import { defaultCodegenTypescriptModelinaOptions , pascalCase } from '../../../generators/typescript/utils' ;
3+ import {
4+ defaultCodegenTypescriptModelinaOptions ,
5+ pascalCase
6+ } from '../../../generators/typescript/utils' ;
47import { findNameFromChannel } from '../../../utils' ;
5- import { ConstrainedEnumModel , ConstrainedObjectModel , ConstrainedReferenceModel , TS_DESCRIPTION_PRESET , TypeScriptFileGenerator } from '@asyncapi/modelina' ;
8+ import {
9+ ConstrainedEnumModel ,
10+ ConstrainedObjectModel ,
11+ ConstrainedReferenceModel ,
12+ TS_DESCRIPTION_PRESET ,
13+ TypeScriptFileGenerator
14+ } from '@asyncapi/modelina' ;
615
716// Interface for processed parameter schema data
817export interface ProcessedParameterSchemaData {
@@ -20,7 +29,7 @@ export async function processAsyncAPIParameters(
2029 if ( parameters . length > 0 ) {
2130 const channelName = findNameFromChannel ( channel ) ;
2231 const schemaId = pascalCase ( `${ channelName } _parameters` ) ;
23-
32+
2433 const schemaObj : any = {
2534 type : 'object' ,
2635 $id : schemaId ,
@@ -46,7 +55,7 @@ export async function processAsyncAPIParameters(
4655 return {
4756 channelParameters
4857 } ;
49- }
58+ }
5059
5160/**
5261 * Component which contains the parameter unwrapping functionality.
@@ -103,12 +112,10 @@ return parameters;`;
103112 * Generate additional content for AsyncAPI channel parameter classes
104113 */
105114function generateAsyncAPIParameterMethods ( model : ConstrainedObjectModel ) {
106- const parameters = Object . entries ( model . properties ) . map (
107- ( [ , parameter ] ) => {
108- return `channel = channel.replace(/\\{${ parameter . unconstrainedPropertyName } \\}/g, this.${ parameter . propertyName } )` ;
109- }
110- ) ;
111-
115+ const parameters = Object . entries ( model . properties ) . map ( ( [ , parameter ] ) => {
116+ return `channel = channel.replace(/\\{${ parameter . unconstrainedPropertyName } \\}/g, this.${ parameter . propertyName } )` ;
117+ } ) ;
118+
112119 return `/**
113120 * Realize the channel/topic with the parameters added to this class.
114121 */
0 commit comments