Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

API Explorer - move from Grand.Web.Common to Grand.Api project

support707b7d5b3b89
diff --git a/src/Web/Grand.Web.Common/ApiExplorer/ApiParameterContext.cs b/src/API/Grand.Api/ApiExplorer/ApiParameterContext.cs
similarity index 96%
rename from src/Web/Grand.Web.Common/ApiExplorer/ApiParameterContext.cs
rename to src/API/Grand.Api/ApiExplorer/ApiParameterContext.cs
index 5750271a4..6a791136b 100644
--- a/src/Web/Grand.Web.Common/ApiExplorer/ApiParameterContext.cs
+++ b/src/API/Grand.Api/ApiExplorer/ApiParameterContext.cs
@@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Routing.Template;
-namespace Grand.Web.Common.ApiExplorer;
+namespace Grand.Api.ApiExplorer;
public class ApiParameterContext
{
diff --git a/src/Web/Grand.Web.Common/ApiExplorer/ApiResponseTypeProvider.cs b/src/API/Grand.Api/ApiExplorer/ApiResponseTypeProvider.cs
similarity index 99%
rename from src/Web/Grand.Web.Common/ApiExplorer/ApiResponseTypeProvider.cs
rename to src/API/Grand.Api/ApiExplorer/ApiResponseTypeProvider.cs
index 0b1021a9b..48924d70b 100644
--- a/src/Web/Grand.Web.Common/ApiExplorer/ApiResponseTypeProvider.cs
+++ b/src/API/Grand.Api/ApiExplorer/ApiResponseTypeProvider.cs
@@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
-namespace Grand.Web.Common.ApiExplorer;
+namespace Grand.Api.ApiExplorer;
public class ApiResponseTypeProvider
{
diff --git a/src/Web/Grand.Web.Common/ApiExplorer/MetadataApiDescriptionProvider.cs b/src/API/Grand.Api/ApiExplorer/MetadataApiDescriptionProvider.cs
similarity index 99%
rename from src/Web/Grand.Web.Common/ApiExplorer/MetadataApiDescriptionProvider.cs
rename to src/API/Grand.Api/ApiExplorer/MetadataApiDescriptionProvider.cs
index 288ede726..9a1e50a06 100644
--- a/src/Web/Grand.Web.Common/ApiExplorer/MetadataApiDescriptionProvider.cs
+++ b/src/API/Grand.Api/ApiExplorer/MetadataApiDescriptionProvider.cs
@@ -4,7 +4,6 @@
using Grand.SharedKernel.Attributes;
using Grand.SharedKernel.Extensions;
-using Grand.Web.Common.Controllers;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
@@ -19,7 +18,7 @@ using Microsoft.AspNetCore.Routing.Template;
using Microsoft.Extensions.Options;
using System.Reflection;
-namespace Grand.Web.Common.ApiExplorer;
+namespace Grand.Api.ApiExplorer;
public class MetadataApiDescriptionProvider : IApiDescriptionProvider
{
@@ -66,7 +65,7 @@ public class MetadataApiDescriptionProvider : IApiDescriptionProvider
foreach (var action in context.Actions.OfType<ControllerActionDescriptor>())
{
- if (action.ControllerTypeInfo.BaseType != typeof(BasePublicController))
+ if (!action.ControllerTypeInfo.GetCustomAttributes<Grand.SharedKernel.Attributes.ApiControllerAttribute>(true).Any())
continue;
if (action.MethodInfo.GetCustomAttributes<IgnoreApiAttribute>(true).Any())
diff --git a/src/Web/Grand.Web.Common/Startup/ApiProviderStartup.cs b/src/API/Grand.Api/Infrastructure/ApiProviderStartup.cs
similarity index 95%
rename from src/Web/Grand.Web.Common/Startup/ApiProviderStartup.cs
rename to src/API/Grand.Api/Infrastructure/ApiProviderStartup.cs
index 1f46f0bdd..bed0895d0 100644
--- a/src/Web/Grand.Web.Common/Startup/ApiProviderStartup.cs
+++ b/src/API/Grand.Api/Infrastructure/ApiProviderStartup.cs
@@ -1,5 +1,5 @@
using Grand.Infrastructure;
-using Grand.Web.Common.ApiExplorer;
+using Grand.Api.ApiExplorer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
@@ -7,7 +7,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
-namespace Grand.Web.Common.Startup
+namespace Grand.Api.Infrastructure
{
/// <summary>
/// Represents object for the configuring api description provider on application