swagger-api / swagger-api/swagger-codegen

[typescript-angularjs] Inheritance with $type

Open
#8,843 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Im using typescript-angularjs to generate typecript classes. Is there a way to generate typescript code for inherited classes which include a $type variable that discribes the class?

For example i have:

public class TestBase
{
    public string MyProp { get; set; }
}

public class Test1 : TestBase
{
    public int count { get; set; }
}

So in this case i would want a property $type generated in Test1 with a value set to Test1

I found the following which should do just that, but is this also possible with typescript-angularjs?
https://github.com/RSuter/NJsonSchema/wiki/Inheritance

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the typescript-angularjs generator and the linked NJsonSchema inheritance reference. Determine how inherited classes are currently represented, then verify that generated derived classes include a $type property identifying the derived class.

Written by the indexing model from the issue text.

Assessment

Tech stack
angularjs, typescript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.