Search code examples
angularrestswaggerswagger-codegennswag

How to force NSwag and ng-swagger-gen to generate child class property in interface


I use NSwag to generate swagger document in .net core API and ng-swagger-gen for Angular client. The problem is that the generated interfaces ignore child class properties. See this example:

  //Backend classes
   public class Student:User{
        public DateTime EnrollDate{get;set;}
   }
   public class User {
      public string UserName{get;set;}
   }

and the client interfaces are

  export interface User{
   username:string
  }
  export interface Student extends User{
  }

as you can see, the EnrollDate property is ignored. Note that there's no SwaggerIgnore annotation on this property. How to solve this issue? how do I force Nswag or ng-swagger-gen to generate child properties?


Solution

  • Thank you but I updated to from version 11.18.7 to NSwag.AspNetCore Version="13.1.6" and the issue was solved!