Make custom swagger attributes also work with parameter info

If somebody ever uses it as such, that is
This commit is contained in:
Archi
2021-06-30 23:04:36 +02:00
parent 19bd497362
commit da7adbe415

View File

@@ -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<CustomSwaggerAttribute>()) {
foreach (CustomSwaggerAttribute customSwaggerAttribute in customSwaggerAttributes.GetCustomAttributes(typeof(CustomSwaggerAttribute), true)) {
customSwaggerAttribute.Apply(schema);
}
}