Class CSharpFileGenerator

Abstract file generator which each file generator much implement.

Hierarchy

Implements

Constructors

  • Parameters

    • Optional options: {
          autoImplementedProperties?: boolean;
          collectionType?: "List" | "Array";
          constraints?: { enumKey?: EnumKeyConstraint<CSharpOptions> | undefined; enumValue?: EnumValueConstraint<CSharpOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; };
          defaultPreset?: { class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | undefined; };
          dependencyManager?: (() => AbstractDependencyManager) | ({ dependencies?: (string | undefined)[] | undefined; addDependency?: ((dependency: string) => void) | undefined; });
          handleNullable?: boolean;
          indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; };
          modelType?: "class" | "record";
          presets?: (undefined | ({ class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | undefined; }) | ({ preset?: { class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | u...))[];
          processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...;
          typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, CSharpOptions, CSharpDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; };
      }
      • Optional autoImplementedProperties?: boolean
      • Optional collectionType?: "List" | "Array"
      • Optional constraints?: { enumKey?: EnumKeyConstraint<CSharpOptions> | undefined; enumValue?: EnumValueConstraint<CSharpOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; }
      • Optional defaultPreset?: { class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | undefined; }
      • Optional dependencyManager?: (() => AbstractDependencyManager) | ({ dependencies?: (string | undefined)[] | undefined; addDependency?: ((dependency: string) => void) | undefined; })

        This dependency manager type serves two functions.

        1. It can be used to provide a factory for generate functions
        2. It can be used to provide a single instance of a dependency manager, to add all dependencies together

        This depends on context and where it's used.

      • Optional handleNullable?: boolean
      • Optional indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; }
      • Optional modelType?: "class" | "record"
      • Optional presets?: (undefined | ({ class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | undefined; }) | ({ preset?: { class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | u...))[]
      • Optional processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...
      • Optional typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, CSharpOptions, CSharpDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; }

    Returns CSharpFileGenerator

Properties

languageName: string
options: CSharpOptions
defaultCompleteModelOptions: CSharpRenderCompleteModelOptions = ...
defaultOptions: CSharpOptions = ...

Methods

  • Parameters

    • model: MetaModel
    • options: {
          autoImplementedProperties?: boolean;
          collectionType?: "List" | "Array";
          constraints?: { enumKey?: EnumKeyConstraint<CSharpOptions> | undefined; enumValue?: EnumValueConstraint<CSharpOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; };
          defaultPreset?: { class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | undefined; };
          dependencyManager?: (() => AbstractDependencyManager) | ({ dependencies?: (string | undefined)[] | undefined; addDependency?: ((dependency: string) => void) | undefined; });
          handleNullable?: boolean;
          indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; };
          modelType?: "class" | "record";
          presets?: (undefined | ({ class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | undefined; }) | ({ preset?: { class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | u...))[];
          processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...;
          typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, CSharpOptions, CSharpDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; };
      }
      • Optional autoImplementedProperties?: boolean
      • Optional collectionType?: "List" | "Array"
      • Optional constraints?: { enumKey?: EnumKeyConstraint<CSharpOptions> | undefined; enumValue?: EnumValueConstraint<CSharpOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; }
      • Optional defaultPreset?: { class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | undefined; }
      • Optional dependencyManager?: (() => AbstractDependencyManager) | ({ dependencies?: (string | undefined)[] | undefined; addDependency?: ((dependency: string) => void) | undefined; })

        This dependency manager type serves two functions.

        1. It can be used to provide a factory for generate functions
        2. It can be used to provide a single instance of a dependency manager, to add all dependencies together

        This depends on context and where it's used.

      • Optional handleNullable?: boolean
      • Optional indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; }
      • Optional modelType?: "class" | "record"
      • Optional presets?: (undefined | ({ class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | undefined; }) | ({ preset?: { class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | u...))[]
      • Optional processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...
      • Optional typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, CSharpOptions, CSharpDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; }

    Returns ConstrainedMetaModel

  • Generates all the models to an output directory each model with their own separate files.

    Parameters

    • input: any
    • outputDirectory: string

      where you want the models generated to

    • options: {
          namespace?: string;
      }
      • Optional namespace?: string
    • ensureFilesWritten: boolean = false

      verify that the files is completely written before returning, this can happen if the file system is swamped with write requests.

    Returns Promise<OutputModel[]>

  • Returns the CSharp options by merging custom options with default ones.

    Parameters

    • Optional options: {
          autoImplementedProperties?: boolean;
          collectionType?: "List" | "Array";
          constraints?: { enumKey?: EnumKeyConstraint<CSharpOptions> | undefined; enumValue?: EnumValueConstraint<CSharpOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; };
          defaultPreset?: { class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | undefined; };
          dependencyManager?: (() => AbstractDependencyManager) | ({ dependencies?: (string | undefined)[] | undefined; addDependency?: ((dependency: string) => void) | undefined; });
          handleNullable?: boolean;
          indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; };
          modelType?: "class" | "record";
          presets?: (undefined | ({ class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | undefined; }) | ({ preset?: { class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | u...))[];
          processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...;
          typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, CSharpOptions, CSharpDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; };
      }
      • Optional autoImplementedProperties?: boolean
      • Optional collectionType?: "List" | "Array"
      • Optional constraints?: { enumKey?: EnumKeyConstraint<CSharpOptions> | undefined; enumValue?: EnumValueConstraint<CSharpOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; }
      • Optional defaultPreset?: { class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | undefined; }
      • Optional dependencyManager?: (() => AbstractDependencyManager) | ({ dependencies?: (string | undefined)[] | undefined; addDependency?: ((dependency: string) => void) | undefined; })

        This dependency manager type serves two functions.

        1. It can be used to provide a factory for generate functions
        2. It can be used to provide a single instance of a dependency manager, to add all dependencies together

        This depends on context and where it's used.

      • Optional handleNullable?: boolean
      • Optional indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; }
      • Optional modelType?: "class" | "record"
      • Optional presets?: (undefined | ({ class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | undefined; }) | ({ preset?: { class?: { accessor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel> & PropertyArgs) => string | Promise<...>) | undefined; ... 5 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; record?: { ...; } | undefined; enum?: { ...; } | u...))[]
      • Optional processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...
      • Optional typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, CSharpOptions, CSharpDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; }

    Returns CSharpOptions

Generated using TypeDoc