APS 2.X - Adding Custom Endpoints to Swagger API

cancel
Showing results for 
Search instead for 
Did you mean: 
egilsoncabral
Member II

APS 2.X - Adding Custom Endpoints to Swagger API

Hi,

We are trying to make Alfresco's swagger-ui (api-explore.html) also able to scan our custom-created API. We could enable for example OpenApi to scan our APIs importing the springdoc-openapi-ui dependency and creating new definitions with GroupedOpenApi configuration like this:

@Bean
    public GroupedOpenApi customOpenApi() {
        String packagesToscan[] = {"com.activiti.extension.api.runtime"};
        return GroupedOpenApi.builder().group("custom").packagesToScan(packagesToscan)
                .build();
    }

But the native APS swagger page (api-explorer) stops working, is there any way for them to coexist? That is, is it possible to define that via api-explorer, it can display the documentation of the new APIs created?

2 Replies
nicolasraynaud
Customer

Re: APS 2.X - Adding Custom Endpoints to Swagger API

Have you find solution ?
I tried also to generate other swagger-ui page (with springfox, then with springdoc), but without success for instance. (dependencies compatibility problems)

Yvonne901
Active Member II

Re: APS 2.X - Adding Custom Endpoints to Swagger API

Hello

I have suggestion don't know it will helpful or not but let see

Define the endpoint: Define the HTTP method, path, and any parameters or request body for your new endpoint. You can do this in your API code, using a framework like Express or Flask.

Add the endpoint to Swagger: You can use Swagger annotations to add the new endpoint to your Swagger documentation. For example, in Java with Spring, you can use the @ApiOperation annotation to document the endpoint, and the @RequestMapping annotation to map the endpoint to a URL.  BenefitsCal App

Generate the Swagger documentation: Once you have defined the endpoint and added it to Swagger, you can use a tool like Swagger UI or Swagger Codegen to generate the Swagger documentation. This documentation will include the new endpoint along with any other endpoints you have documented using Swagger annotations.

Test the new endpoint: Finally, you should test the new endpoint to ensure that it works as expected. You can use a tool like Postman to send requests to the endpoint and verify the response.