我试图在我的项目中使用Swagger,但是它没有检测到我的控制器。
这是我Startup.cs中大摇大摆的配置
/****
*this is .h file
*****/
#pragma once
#include "CoreMinimal.h"
#include "AIController.h"
#include "Engine.h"
#include "AI_Controller.generated.h"
UCLASS()
class TEST_API AAI_Controller : public AAIController
{
GENERATED_BODY()
public:
AAI_Controller();
virtual void BeginPlay() override;
virtual void Possess(APawn* Pawn) override;
virtual void Tick(float DeltaSeconds) override;
virtual FRotator GetControlRotation() const override;
UFUNCTION()
void OnPawnDetected(const TArray<AActor*> &DetectedPawns);
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = AI)
float AISightRadius = 500.0f;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = AI)
float AISightAge = 5.0f;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = AI)
float AILoseSightRadius = AISightRadius + 50.0f;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = AI)
float AIFieldOfView = 90.0f;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = AI)
class UAISenseConfig_Sight* SightConfig;
};
this is the structure of my code
如果我有一个名称为“ Controllers”的文件夹,并且我内部有一个控制器,则摇摇晃晃地找到该控制器并在摇摇晃晃的页面中将其打印出来,但是如果该控制器位于Feature文件夹中,则找不到它
答案 0 :(得分:0)
Swashbuckle使用Microsoft.AspNetCore.Mvc.ApiExplorer,因此,如果asp网络核心找到您的控制器,Swashbuckle也将使用。不管您使用什么文件夹。 如果您的控制器位于启动项目中,则无需执行任何操作。只需遵循可用的教程即可。请参阅G et started with Swashbuckle and ASP.NET Core