You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apologies if this is somewhat cross-posted from NSwag; I've been working on an OpenAPI project that is using NSwag to convert the OpenAPI spec into C# contracts and controllers; however, I've hit a snag where I want to apply security attributes to individual controller actions, and that requires me to create a custom Fluid template.
The model type being passed to Fluid has a property of type IEnumerable<OpenApiSecurityRequirement>, where OpenApiSecurityRequirement inherits from Dictionary<string, IEnumerable<string>>; that has all the information I need in my Fluid template, but the problem is that Fluid doesn't know how to handle dictionaries. Give that dictionaries are fairly important in the JSON world, I was hoping that there might be some sort of easy workaround that I could apply?
The text was updated successfully, but these errors were encountered:
Never mind, I find out the answer in [a closed issue[(https://github.com/sebastienros/fluid/issues/173) on the Fluid.Core site; in short, Fluid treats a dictionary as an array of tuples, so instead of using item.Key and item.Value as I was expecting, you use item[0] and item[1] to access the key and the value respectively.
Apologies if this is somewhat cross-posted from NSwag; I've been working on an OpenAPI project that is using NSwag to convert the OpenAPI spec into C# contracts and controllers; however, I've hit a snag where I want to apply security attributes to individual controller actions, and that requires me to create a custom Fluid template.
The model type being passed to Fluid has a property of type
IEnumerable<OpenApiSecurityRequirement>
, whereOpenApiSecurityRequirement
inherits fromDictionary<string, IEnumerable<string>>
; that has all the information I need in my Fluid template, but the problem is that Fluid doesn't know how to handle dictionaries. Give that dictionaries are fairly important in the JSON world, I was hoping that there might be some sort of easy workaround that I could apply?The text was updated successfully, but these errors were encountered: