Open Closed

API Document #8765


User avatar
0
fgao@primarypartnercare.com created

Check the docs before asking a question: https://abp.io/docs/latest Check the samples to see the basic tasks: https://abp.io/docs/latest/samples The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info: 🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration button.

  • ABP Framework version: v8.0
  • UI Type: Blazor WASM
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I need to make an API Document for my application. I wonder if the Swagger page contains ALL of APIs? For example, where is the definition for API "/connect/token"?

Thanks,


1 Answer(s)
  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hello, some endpoints of ABP are ignored using ApiExplorerSettings attribute for security reasons. For example TokenController : https://github.com/abpframework/abp/blob/8d1d89ac7fe3082e342add226e97f417e7f9d287/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.cs#L12

    If you want to see them in the swagger, you can follow these steps:

    1-) Create class ForceApiExplorerVisibilityConvention in the AuthServer like the below:

    public class ForceApiExplorerVisibilityConvention : IApplicationModelConvention
    {
        public void Apply(ApplicationModel application)
        {
            foreach (var controller in application.Controllers)
            {
                // Controller seviyesinde Ignore edilmişse
                if (controller.ApiExplorer != null && controller.ApiExplorer.IsVisible == false)
                {
                    controller.ApiExplorer.IsVisible = true;
                }
    
                // Aksiyon seviyesinde Ignore edilmişse
                foreach (var action in controller.Actions)
                {
                    if (action.ApiExplorer != null && action.ApiExplorer.IsVisible == false)
                    {
                        action.ApiExplorer.IsVisible = true;
                    }
                }
            }
        }
    }
    

    2-) Add the following code blocks to the ConfigureServices method of module class in AuthServer project:

            context.Services.AddControllers(options =>
            {
                options.Conventions.Add(new ForceApiExplorerVisibilityConvention());
            });
    

    If swagger is added in your AuthServer project, you can see the related endpoints as in the picture below:

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 13, 2025, 04:08