Closed davidkeaveny closed 2 years ago
Hi @davidkeaveny, There is support for collections of primitive types, however, you will not be able to distinguish examples for multiple methods with this return type. I think we should add support to be able to define controller+method specific example provider. What do you think? Would that solve your problem?
Yes, I think that that's what I was heading towards when I said I could write an operation processor. Although I still like the idea of parsing the <example>
tags, which would reduce the overall amount of code needed.
Yeah, I think both approaches will be useful. However, we should limit the example tag to only collections of primitive types. Are you able to create PR by yourself? Or do you want me to implement it?
Closing due to inactivity. Please reopen when needed.
I have some API endpoints that return string arrays; these obviously won't work with the NSwag.Examples provider model, which is looking for complex types. Do you have any thoughts/suggestions on how to provide (possibly inline) example values?
I was hoping that the
<example>
tag would be picked up and parsed as a JSON object, but that doesn't seem to happen whenNSwag.Examples
is present e.g.:I could write my own operation processor easily enough, but I was hoping there might be something more obvious that I might have overlooked?