Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
NSwag Typescript Proxy custom property annotations/decorators

I am using NSwag.CodeGeneration.Typescript to generate an angular 2 typescript proxy from a .net-core backend and the swagger.json. This works like a charm.

Now I would like to be able to automatically generate custom decorators for my typescript client. Something like this:

The C# class:

public class Point {
   // a configurable annotation here
   [configurable]
   private int X
   {
      get; set;
   }
   // a configurable annotation here
   [configurable]
   private int Y
   {
      get; set;
   }        
}

The generated typescript proxy...

class Point {
private _x: number;
private _y: number;
constructor(data?: any) {
    // set data
}

@configurable(false)
get x() { return this._x; }

@configurable(false)
get y() { return this._y; }
}

...with the custom decorator function

function configurable(value: boolean) {
    return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
        descriptor.configurable = value;
    };
}

It's my first project with swagger, so I'm not entirely sure where to start. Any help is greatly appreciated.

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!