domaindrivendev / Swashbuckle.WebApi

Seamlessly adds a swagger to WebApi projects!
BSD 3-Clause "New" or "Revised" License
3.07k stars 679 forks source link

Dictionary<string,string> represented as inline_model in swagger ui #1158

Open jongear opened 7 years ago

jongear commented 7 years ago
  <package id="Swashbuckle" version="5.6.0" targetFramework="net452" />
  <package id="Swashbuckle.Core" version="5.6.0" targetFramework="net452" />

I have a model property that is of type Dictionary<string, string>, when swashbuckle generates the swagger UI for this property it results in a object type of inline_model

public class MyObject{
    public Dictionary<string, string> MyProperty {get;set;}
    public List<MyInnerObject> MyInnerObjects {get;set;}
}

public class MyInnerObject{
    public Dictionary<string, string> MyInnerProperty {get;set;}
}

results in

MyObject{
   MyProperty(inline_model_0, optional)
}
inline_model_0 {}
MyInnerObject{
   MyInnerProperty(inline_model, optional)
}
inline_model {}
k-vekos commented 6 years ago

I am having the same issue - but with a Dictionary<int, bool>

IonutStef commented 6 years ago

Hei! I have the same problem.. I see that there is no solution yet...