Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to merge multiple api-definitions in a single point #9405

Closed
hikalkan opened this issue Jun 23, 2021 · 2 comments
Closed

Provide a way to merge multiple api-definitions in a single point #9405

hikalkan opened this issue Jun 23, 2021 · 2 comments
Labels

Comments

@hikalkan
Copy link
Member

Dynamic client proxies (c# and js) relies on an endpoint on the server that is provided by the ABP Framework: api/abp/api-definition.
That endpoint returns a model of HTTP APIs provided from the server application. In this way, dynamic client proxies can understand how to call them.

Another great ABP feature is Auto API Controllers, which exposes your application services as HTTP APIs.

These two system works great normally, but it can't work for MVC-tiered applications. Consider that scenario:

JS client ---> MVC website application ---> Backend HTTP API application

In this case, MVC website application's api/abp/api-definition endpoint can not return APIs provided by the Backend HTTP API application, because these APIs are not available in the process of the MVC website application. To make that possible, we currently should define proxy controllers (example). In this way, MVC website application can have these APIs and api/abp/api-definition returns all the APIs. In practical, application services are hosted in the Backend HTTP API application, so the controllers actually injects dynamic c# proxies of the target app services. Finally, the Backend HTTP API application has the real implementation of the app services.

With this issue, I want to create a way of returning Backend HTTP API endpoint from the api/abp/api-definition endpoint of the MVC websites application (by somehow getting the api definition of the backend and merging with its own api-definitions). This even makes possible to create simple API gateways. In this case, we still need to a redirection of requests to the backend API, maybe using a middleware or API gateway library like Ocelot. One drawback is when we open Swagger UI in the MVC app, we can't see the APIs of the backend app, but this is already like that if we don't use the ABP Framework.

@xyfy
Copy link
Contributor

xyfy commented Sep 6, 2021

With Atuo-API,How can I set the document in the swagger?

the GenerateDocumentationFile property in *.HttpAPi.csproj and *.Application.Contracts.csproj has set to True

*.HttpAPi.csproj generate xml ,but contains none comments.

that caught I can only see the dto's XmlComments,not the api method.

How can I resolve this problem?

                    // 为 Swagger JSON and UI设置xml文档注释路径
                    var directory = System.IO.Directory.GetFiles(AppContext.BaseDirectory, "*.xml");
                    foreach (var xmlPath in directory)
                    {
                        options.IncludeXmlComments(xmlPath);
                    }

微信图片_20210906110537

@hikalkan
Copy link
Member Author

We won't make this since #9905 solves the main problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants