From da7adbe415c13591df95d599de016a2da83e5b57 Mon Sep 17 00:00:00 2001 From: Archi Date: Wed, 30 Jun 2021 23:04:36 +0200 Subject: [PATCH] Make custom swagger attributes also work with parameter info If somebody ever uses it as such, that is --- .../IPC/Integration/CustomAttributesSchemaFilter.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ArchiSteamFarm/IPC/Integration/CustomAttributesSchemaFilter.cs b/ArchiSteamFarm/IPC/Integration/CustomAttributesSchemaFilter.cs index 07195c69e..0ca57ef90 100644 --- a/ArchiSteamFarm/IPC/Integration/CustomAttributesSchemaFilter.cs +++ b/ArchiSteamFarm/IPC/Integration/CustomAttributesSchemaFilter.cs @@ -37,11 +37,17 @@ namespace ArchiSteamFarm.IPC.Integration { throw new ArgumentNullException(nameof(context)); } - if (context.MemberInfo == null) { + ICustomAttributeProvider customSwaggerAttributes; + + if (context.MemberInfo != null) { + customSwaggerAttributes = context.MemberInfo; + } else if (context.ParameterInfo != null) { + customSwaggerAttributes = context.ParameterInfo; + } else { return; } - foreach (CustomSwaggerAttribute customSwaggerAttribute in context.MemberInfo.GetCustomAttributes()) { + foreach (CustomSwaggerAttribute customSwaggerAttribute in customSwaggerAttributes.GetCustomAttributes(typeof(CustomSwaggerAttribute), true)) { customSwaggerAttribute.Apply(schema); } }