-
Notifications
You must be signed in to change notification settings - Fork 538
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
Example of using IDL with hertz and javascript/typescript #726
Comments
My understanding is that IDL is not very friendly to JavaScript, so I use IDL to convert to OpenAPI, and then convert to JavaScript. |
thanks for your reply. are you using protobuf with https://www.cloudwego.io/docs/hertz/tutorials/toolkit/plugin to gen openapi? how to do with thrift, I understand that thriftgo seems only support go language now... and could you share which tool you used to covert openapi to js/ts? |
Right now thriftgo does not have a plugin that generates openapi for "thrift", but you can investigate if there are other similar tools. We don't currently offer a thrift to typescript conversion. Can you be more specific about the scenario? I'll do a research. |
Previously we were using documentation to communicate API changes, now we want to use the features of hertz and IDL to do this. hertz adds some annotations to IDL to generate Method and Path etc. in the code, this feature I understand should be achieved through hz as a protoc plugin. Currently we find some protoc plugins that generate js/ts but none of them support hz annotations, resulting in only being able to use the models generated by these plugins, and not the Service. I hope to use this scenario as an example to add support for other language generation, for example, in the refactoring process, which may be refactored module by module, then microservices in other languages now only could use the idl generated model when using the idl provided by hertz, without the ability to have a client-like encapsulation. |
Describe the Question
Hello, thanks for your excellent work. I'm using hertz to build systems with IDL. It works well on the backend, but when IDL changed, I have to manually modify the js/ts code of frontend. I want to know if there is some way we could do this work more automatically. I searched the world and find some repos which can generate js/ts with IDL, but hz annotation does not works.
Reproducible Code
Give examples for generating js/ts code with using thrift/protobuf as IDL, and annotation should work.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your question.
Hertz version:
Please provide the version of Hertz you are using.
Environment:
The output of
go env
.Additional context
Add any other context about the question here.
The text was updated successfully, but these errors were encountered: