jixuan1989 opened a new pull request #2497:
URL: https://github.com/apache/iotdb/pull/2497


   ## Description
   
   OpenAPI is a uniform DSL for describing the restful interface. 
   And, when developing a restful framework, we have to write many trivial 
codes (that will be also written in almost all restful services). So, 
generating such of codes is a good solution as we just need to develop the real 
logic and do not need to care to maintain the generated codes.
   
   This PR defines several restful APIs for serving Grafana and Prometheus, and 
uses openapi-generator to generate the source codes of the restful framework in 
Go and Java. (The generator can also generate client-sdk, but I have not time 
to try it and we have no requirements).
   
   So, just run `mvn generate-sources` in `openapi' module, and then develop 
your logic in 
   
`openapi/java-rest/src/main/java/org/apache/iotdb/openapi/gen/handler/impl/V1ApiServiceImpl.java`
  (for java) and `openapi/go-rest/src/iotdbrestimpl/api_service_impl.go`(for 
Go).
   
   The only two things are, 
   
   1. current openapi-generator has some bug for go-server codes, see: 
https://github.com/OpenAPITools/openapi-generator/issues/8448 and I have write 
how to fix it manually in go-rest/README.md
   
   2. current openapi-generator can not generate java codes using native Netty. 
But it seems developing such a generator is not easy for openapi-generator.
   
   The author of PR https://github.com/apache/iotdb/pull/2400 can consider to 
using this generated Go-server codes. (or, do some experiments to check whether 
the generated codes have an acceptable performance).
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to