/// <summary> /// Creates a new instance of <see cref="InternalOpenApiGenerator"/>. /// </summary> /// <param name="openApiGeneratorFilterConfig">The configuration encapsulating all the filters /// that will be applied while generating/processing OpenAPI document from C# annotations.</param> public InternalOpenApiGenerator(OpenApiGeneratorFilterConfig openApiGeneratorFilterConfig) { if (openApiGeneratorFilterConfig == null) { throw new ArgumentNullException(nameof(openApiGeneratorFilterConfig)); } _documentFilters = TypeCastFilters <IDocumentFilter>(openApiGeneratorFilterConfig.Filters); _documentConfigFilters = TypeCastFilters <IDocumentConfigFilter>(openApiGeneratorFilterConfig.Filters); _operationFilters = TypeCastFilters <IOperationFilter>(openApiGeneratorFilterConfig.Filters); _operationConfigFilters = TypeCastFilters <IOperationConfigFilter>(openApiGeneratorFilterConfig.Filters); _preProcessingOperationFilters = TypeCastFilters <IPreProcessingOperationFilter>( openApiGeneratorFilterConfig.Filters); _postProcessingDocumentFilters = TypeCastFilters <IPostProcessingDocumentFilter>( openApiGeneratorFilterConfig.Filters); }
/// <summary> /// Creates a new instance of <see cref="OpenApiGeneratorConfig"/>. /// </summary> /// <param name="annotationXmlDocuments">The XDocuments representing the annotation xmls.</param> /// <param name="assemblyPaths">The list of relative or absolute paths to the assemblies that will be used to /// reflect into the types provided in the xml. /// </param> /// <param name="openApiDocumentVersion">The version of the OpenAPI document.</param> /// <param name="openApiGeneratorFilterConfig">The configuration encapsulating all the filters /// that will be applied while generating/processing OpenAPI document from C# annotations.</param> public OpenApiGeneratorConfig( IList <XDocument> annotationXmlDocuments, IList <string> assemblyPaths, string openApiDocumentVersion, OpenApiGeneratorFilterConfig openApiGeneratorFilterConfig) { AnnotationXmlDocuments = annotationXmlDocuments ?? throw new ArgumentNullException(nameof(annotationXmlDocuments)); AssemblyPaths = assemblyPaths ?? throw new ArgumentNullException(nameof(assemblyPaths)); OpenApiGeneratorFilterConfig = openApiGeneratorFilterConfig ?? throw new ArgumentNullException(nameof(openApiGeneratorFilterConfig)); if (string.IsNullOrWhiteSpace(openApiDocumentVersion)) { throw new ArgumentNullException(nameof(openApiDocumentVersion)); } OpenApiDocumentVersion = openApiDocumentVersion; }