Activities of "suresht"

  • ABP Framework version: v8.3.0
  • UI Type: Angular
  • Database System: SQL Server
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace: The type or namespace name 'ConfigureSwaggerOptions' could not be found (are you missing a using directive or an assembly reference?) The type or namespace name 'SwaggerDefaultValues' could not be found (are you missing a using directive or an assembly reference?)
  • Steps to reproduce the issue:
    • We are using Auto API Controller implementation and trying to make use of versioning. We are following the example provided at:
    • https://abp.io/docs/latest/framework/api-development/versioning
    • Following is the code in the module class of HttpApi project
using Asp.Versioning;
using Asp.Versioning.ApplicationModels;
using Localization.Resources.AbpUi;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Swashbuckle.AspNetCore.SwaggerGen;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;



[DependsOn(
    typeof(ProjectApplicationContractsModule),
    typeof(ProjectApplicationModule),
    typeof(AbpAspNetCoreMvcModule))]
public class ProjectHttpApiModule : AbpModule
{
    public override void PreConfigureServices(ServiceConfigurationContext context)
    {
        //PreConfigure<IMvcBuilder>(mvcBuilder =>
        //{
        //    mvcBuilder.AddApplicationPartIfNotExists(typeof(ProjectHttpApiModule).Assembly);
        //});

        PreConfigure<AbpAspNetCoreMvcOptions>(options =>
        {
            //2.0 Version
            options
                .ConventionalControllers
                .Create(typeof(ProjectApplicationModule).Assembly, opts =>
                {
                    opts.TypePredicate = t => t.Namespace == typeof(CapsPay.v2.CapspayprojectAppService).Namespace;
                    opts.ApiVersions.Add(new ApiVersion(2, 0));
                });

            //1.0 Compatibility version
            options
                .ConventionalControllers
                .Create(typeof(ProjectApplicationModule).Assembly, opts =>
                {
                    opts.TypePredicate = t => t.Namespace == typeof(CapsPay.v1.CapspayprojectAppService).Namespace;
                    opts.ApiVersions.Add(new ApiVersion(1, 0));
                });
        });
    }

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        Configure<AbpLocalizationOptions>(options =>
        {
            options.Resources
                .Get<ProjectResource>()
                .AddBaseTypes(typeof(AbpUiResource));
        });

        var preActions = context.Services.GetPreConfigureActions<AbpAspNetCoreMvcOptions>();

        Configure<AbpAspNetCoreMvcOptions>(options =>
        {
            options.ConventionalControllers
                .Create(typeof(ProjectApplicationModule).Assembly, opts =>
                {
                    opts.RootPath = "project";
                });

            preActions.Configure(options);
        });

        // Show neutral/versionless APIs.
        context.Services.AddTransient<IApiControllerFilter, NoControllerFilter>();

        context.Services.AddAbpApiVersioning(options =>
        {
            options.ReportApiVersions = true;

            options.AssumeDefaultVersionWhenUnspecified = true;

            //options.ConfigureAbp(preActions.Configure());
        }).AddApiExplorer(options => {
            // add the versioned api explorer, which also adds IApiVersionDescriptionProvider service
            // note: the specified format code will format the version as "'v'major[.minor][-status]"
            options.GroupNameFormat = "'v'VVV";

            // note: this option is only necessary when versioning by url segment. the SubstitutionFormat
            // can also be used to control the format of the API version in route templates
            options.SubstituteApiVersionInUrl = true;
        });

        context.Services.AddTransient<IConfigureOptions<SwaggerGenOptions>, ConfigureSwaggerOptions>();

        context.Services.AddAbpSwaggerGen(options =>
        {
            // add a custom operation filter which sets default values
            options.OperationFilter<SwaggerDefaultValues>();

            options.CustomSchemaIds(type => type.FullName);
        });

        Configure<AbpAspNetCoreMvcOptions>(options =>
        {
            options.ChangeControllerModelApiExplorerGroupName = false;
        });
    }
}

What package(s) need to be installed to resolve errors for "ConfigureSwaggerOptions" and "SwaggerDefaultValues"?

Thanks.

Showing 1 to 1 of 1 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on October 22, 2024, 09:35