forked from Azure/azure-functions-openapi-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
AzureFunctionOpenAPI 진행 상황 ‐ 우삼
Woosam Hwang edited this page Aug 27, 2023
·
6 revisions
- IOpenApiConfigurationOptions 인터페이스에 Boolean 타입의 UseFullName 속성 추가
- DefaultOpenApiConfigurationOptions 클래스에 위 속성 구현 및 정적 메소드,boolean 타입의 UseFullNamespace() 구현
- UseFullNamespace() 메소드는 Local.setting.json 파일에서 OpenApi__UseFullNamespace 값을 읽어
True이면 True 반환, false 이면 false 반환하며 Default 값은 false 설정 - 위 속성 값이 true이면 type.FullName을 반환하고 false이면 type.Name을 반환
- /Abstractions/IOpenApiConfigurationOptions.cs 파일에서 UseFullName 속성 추가
bool UseFullName { get; set; }
- /Configurations/DefaultOpenApiConfigurationOptions 클래스에서 속성 구현 및 정적 메소드 추가
private const string FullnameKey = "OpenApi__UseFullNamespace";
public override bool UseFullName {get; set; }= UseFullNamespace();
public static bool UseFullNamespace(){
var development = bool.TryParse(Environment.GetEnvironmentVariable(FullnameKey), out var rvvesult) ? result : false;
return development;
}
bool.TryParse를 사용하여 local.settings.json파일에서 Fullname 값을 읽어오는 과정에서
변수 development에 성공적으로 읽어올 경우 result에 해당 bool 값이 저장되어 result 값으로 설정, 아닐 경우 false 값으로 설정
- Dotnet build를 하기 위한 추가 정의 필요 확인
- /Configuration/OpenApiSettings.cs에 UseFullName 속성 추가
public bool UseFullName { get; set; }
- /Configuration/OpenApiConfigurationOptions.cs 추가
public virtual bool UseFullName { get; set; }
- type.Name을 조건에 따라 Fullname or short Name으로 Return
- TypeExtensions.cs에 기존 Return type.Name 부분 존재
- UseFullName을 확인하여 type.FullName 또는 type.Name 리턴하는 메소드 선언 in TypeExtensions.cs(line 731)
public static string GetTypeName(this Type type ,IOpenApiConfigurationOptions options = default){
var name = options.UseFullName ? type.FullName : type.Name;
return name;
}
- 기존 type.Name을 사용하는 부분 변경
public static string GetOpenApiReferenceId(this Type type, bool isDictionary, bool isList, NamingStrategy namingStrategy = null,IOpenApiConfigurationOptions options = default)
public static string GetOpenApiRootReferenceId(this Type type, IOpenApiConfigurationOptions options = default)
public static string GetOpenApiDescription(this Type type,IOpenApiConfigurationOptions options = default)
public static string GetOpenApiGenericRootName(this Type type,IOpenApiConfigurationOptions options = default)
public static string GetOpenApiTypeName(this Type type, NamingStrategy namingStrategy = null,IOpenApiConfigurationOptions options = default)
public static string GetOpenApiSubTypeNames(this Type type,IOpenApiConfigurationOptions options = default)