0

There are not clear documentation on how to extend the auto-generated TS file using NSwag. I mean the extension methods with a protector access modifier

here a discussion with the NSwag's owner:

https://github.com/RicoSuter/NSwag/issues/1012

but there is some uncertainty among the steps followed. especially in the case when adding a static suffix and/or prefix to the controller's name.

Can someone provide a clear explanation of how can we extend the auto-generated methods?

AbuDawood
  • 745
  • 7
  • 22
  • The docs are here: https://github.com/RicoSuter/NJsonSchema/wiki/TypeScriptGenerator#extended-classes-and-extension-code and here: https://github.com/RicoSuter/NSwag/wiki/TypeScriptClientGenerator#extended-classes-and-extension-code – Rico Suter Sep 30 '20 at 20:18
  • 1
    Thank you for your pass, I have found that classes who have a prefix and/or suffix to the will not follow the same convention as it is in the documentation, please check my answer below – AbuDawood Oct 02 '20 at 22:51

1 Answers1

0

Finally, the correct convention to extend the auto-generated classes with prefixes and/or suffixes is to follow the rule as below

  { prefixIfExists} + {classname} + {suffixIfExists} extends generated.{classnameOnly} {

}

Example:

enter image description here

class FilesApplicationsManagerService extends generated.FilesApplicationsManager {
}
AbuDawood
  • 745
  • 7
  • 22