Search code examples
typescriptasp.net-coreopenapinswag

Force openapi generator to generate a class


I am using .NET Core API with nswag, which generates my typescript client. The generator generates all models that are used in the controllers, unfortunately I have some models that are not used there but would be useful in the typescript client to use. Is there an annotation or, command which forces the generator to generate these files too. Maybe set a folder to be generated always.


Solution

  • I got an answer on another forum, which is that I have to add [KnownType(typeof())] attribute on a class which is accessed by the generator.