swaggerwcf icon indicating copy to clipboard operation
swaggerwcf copied to clipboard

Generating a friendly model name for generic dictionary

Open HolisticDeveloper opened this issue 6 years ago • 1 comments

Some of our classes have properties of type IDictionary<string, string>. The generated swagger.json file then creates and references the following definition:

System.Collections.Generic.KeyValuePair`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]: {
    properties: {
        Key: {
            type: "string",
            uniqueItems: false
        },
        Value: {
            type: "string",
            uniqueItems: false
        }
    },
    type: "object",
    format: "System.Collections.Generic.KeyValuePair`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"
}

This, of course, is not rendered very nicely by Swagger UI. Any suggestions on how to provide a friendly name for this?

HolisticDeveloper avatar Feb 12 '18 19:02 HolisticDeveloper

can't see any way of doing it

abelsilva avatar Jun 27 '18 00:06 abelsilva