NSwag icon indicating copy to clipboard operation
NSwag copied to clipboard

How to include additional models in swagger.json?

Open umutesen opened this issue 4 years ago • 1 comments

Hello,

I have a public class that are is not exposed in my API so it is not included in swagger.json specification.

Is there a way to manually add a namespace/baseclass to swagger?

The following 'dummy' controller action allows me to have these custom classes in the swagger spec but I would like to ideally register a namespace and have all classes included automatically.

        [HttpGet]
        [SwaggerResponse(typeof(MyCustomClass1))]
        [SwaggerResponse(typeof(MyCustomClass2))]
        public IActionResult DummyAction()
        {
            return Ok();
        }

umutesen avatar Feb 12 '21 08:02 umutesen

Here is answer:

https://github.com/RicoSuter/NSwag/issues/3441#issuecomment-906494763

Close issue?

goors avatar Jun 29 '22 20:06 goors