Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQ] Support TypeScript Server generation #4183

Open
HiromiShikata opened this issue Oct 19, 2019 · 11 comments
Open

[REQ] Support TypeScript Server generation #4183

HiromiShikata opened this issue Oct 19, 2019 · 11 comments

Comments

@HiromiShikata
Copy link

Is your feature request related to a problem? Please describe.

I want to make a server generator of Node using typescript with koa.js.
There is a very nice useful class AbstructTypeScriptClientCodegen for clients, but not for servers.

Describe the solution you'd like

  1. Rename AbstructTypeScriptClientCodegen to AbstructTypeScriptCodegen, and remove getTag() from this
  2. Create AbstructTypeScriptClientCodegen again, add getTag() to this.
  3. Create AbstructTypeScriptServerCodegen, add getTag() to this.

Provably this is a minimal impact and maintainable solution because there are some client generators.
(And we need to change TypeScriptNodeClientCodegen to extends AbstractTypeScriptServerCodegen from AbstractTypeScriptClientCodegen maybe.)

Describe alternatives you've considered

Have only AbstractTypeScriptCodegen

  • Need to add getTag() to all typescript client generators.
  • If increase method for typescript client, we need to change all typescript client generators.

Copy AbstractTypeScriptServerCodegen from AbstructTypeScriptClientCodegen.

  • Almost all functions will overlap with those of client.
    • There are many codes that dependencies TypeScript. It's pretty hard to maintain both codes, I think.

Create AbstractTypeScriptServerCodegen that extends AbstructTypeScriptClientCodegen.

  • if new medhod added to AbstractTypeScriptClientCodegen, it may occur probrem in server.
    • But difficult to notice those problems when working because the name is misleading.

Additional context

TypeScript is used by clients and servers. But other Languages also can have servers and clients.
I would be happy to discuss the good balance of abstraction in this nice project.

@HiromiShikata
Copy link
Author

getTag() was generated by new.sh, 🤔
so best solution may be "Have only AbstractTypeScriptCodegen"....

@macjohnny
Copy link
Member

sounds like a good idea. would you be willing to contribute such a generator?

@wing328
Copy link
Member

wing328 commented Oct 19, 2019

Similar request: #3011

@HiromiShikata is that what you'd in mind as well?

@HiromiShikata
Copy link
Author

@macjohnny

sounds like a good idea. would you be willing to contribute such a generator?

Of course I want to contribute, I want to use this generator in other projects (not only current project) in the future, so the new generator is good for me.

@HiromiShikata
Copy link
Author

@wing328

Similar request: #3011@HiromiShikata is that what you'd in mind as well?

I didn't notice #3011, thank you tell me.
I agree with your opinion. TypeScript & Koa2 Server generator is very useful for me.

@mrmeku
Copy link
Contributor

mrmeku commented Oct 29, 2019

@HiromiShikata I've produced a typescript generator in a closed source repo. My approach was to extend AbstractTypeScriptClientCodegen

For example, I made one for the HAPI node server: public class TypescriptHapiServerGenerator extends AbstractTypeScriptClientCodegen

I didn't feel like any functionality was missing from this approach other than using an in-corrrect tag as you've mentioned.

I like your approach here. If you'd like me to contribute the changes you outlined let me know. Otherwise I'll leave it to you. When we have this core functionality inplace I can port my HapiServer generator to the open source community and start working on one for NestJs next

What do you think? Do you want to make a PR or would you rather me take over? I'm fine either way

@wing328
Copy link
Member

wing328 commented Nov 5, 2019

I've created https://github.com/OpenAPITools/openapi-generator/tree/ts_server with a new TypeScriptServerCodegen as a starting point: https://github.com/OpenAPITools/openapi-generator/compare/ts_server?expand=1

Please feel free to submit PRs for this branch or submit a PR based on what you've created so far.

@wing328 wing328 modified the milestone: 4.2.1 Nov 5, 2019
@Kiikurage
Copy link

Hi. I'm interested in this. What's the current status? If anyone isn't working on this actively, can I take over this?

@yorhodes
Copy link

Any updates? How can I use the ts_server branch's generator?

@wing328
Copy link
Member

wing328 commented May 5, 2020

@Kiikurage please go ahead as I don't think anyone is actively working on it at the moment.

If you need help, please PM me via Slack (https://join.slack.com/t/openapi-generator/shared_invite/enQtNzAyNDMyOTU0OTE1LTY5ZDBiNDI5NzI5ZjQ1Y2E5OWVjMjZkYzY1ZGM2MWQ4YWFjMzcyNDY5MGI4NjQxNDBiMTlmZTc5NjY2ZTQ5MGM)

@HiromiShikata
Copy link
Author

I'm sorry I haven't replied for a long time 🙇
I'm not working this issue. I don't have much time enough right now.
I want to back on here but if someone can take this task, please don't mind about me.
I'm sorry about this 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants