[AMORO-3256] Amoro Open Api with Swagger in Ams#3296
Conversation
amoro-ams/pom.xml
Outdated
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> |
There was a problem hiding this comment.
we can use ${swagger.version} replace 2.2.10
There was a problem hiding this comment.
Yes, we may define the versions in properties.
There was a problem hiding this comment.
Thank you for your suggestion. I have removed that part of the dependency.
amoro-ams/pom.xml
Outdated
|
|
||
| <plugin> | ||
| <groupId>org.openapitools</groupId> | ||
| <artifactId>openapi-generator-maven-plugin</artifactId> |
There was a problem hiding this comment.
the latest version is 7.9.0 why we don't use it?
There was a problem hiding this comment.
the latest version is 7.9.0 why we don't use it?
Thank you for your suggestion. The latest version has dependency conflicts, and I believe the current version should be stable enough to meet the requirements.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3296 +/- ##
============================================
- Coverage 30.17% 21.60% -8.57%
+ Complexity 3840 2311 -1529
============================================
Files 580 426 -154
Lines 48020 39719 -8301
Branches 6207 5623 -584
============================================
- Hits 14488 8582 -5906
+ Misses 32542 30409 -2133
+ Partials 990 728 -262
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
zhoujinsong
left a comment
There was a problem hiding this comment.
@mansonliwh Thanks for the contribution! I left some comments.
amoro-ams/pom.xml
Outdated
| <url>https://amoro.apache.org</url> | ||
|
|
||
| <properties> | ||
| <skip-generate-sdk>false</skip-generate-sdk> |
There was a problem hiding this comment.
IMO, we should not generate the SDK by default as it is not required for everyone.
But the doc is necessary for the dashboard.
So we may need to separate the properties for SDK and DOC.
amoro-ams/pom.xml
Outdated
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> |
There was a problem hiding this comment.
Yes, we may define the versions in properties.
amoro-ams/pom.xml
Outdated
| <version>2.2.10</version> | ||
| </dependency> | ||
|
|
||
| <dependency> |
There was a problem hiding this comment.
Do we need the dependency by default?
Or should we separate them for the doc and the SDK?
There was a problem hiding this comment.
Do we need the dependency by default? Or should we separate them for the doc and the SDK?
Thank you for your suggestion. I have already enabled the default 'skip' option while separated the 'doc' and the 'sdk'.
amoro-ams/pom.xml
Outdated
| <version>4.1.1</version> | ||
| </dependency> | ||
|
|
||
| <dependency> |
There was a problem hiding this comment.
We already had httpclient:5.2 and httpcore:5.2 dependencies in runtime scope, do we still need this?
2e4fa1d to
ae5b371
Compare
ae5b371 to
b169a1f
Compare
ae5b21e to
b136b28
Compare
| mounted() { | ||
| SwaggerUI({ | ||
| dom_id: '#swagger-ui', | ||
| url: '/swagger-docs', // 这里是你的 OpenAPI 规范文件的路径 |
There was a problem hiding this comment.
Comments should be English.
b136b28 to
97f4ee5
Compare
czy006
left a comment
There was a problem hiding this comment.
At present, we have no relevant descriptive documents for this section. Maybe we need to supplement them.
cbd34de to
49a35cf
Compare
zhoujinsong
left a comment
There was a problem hiding this comment.
@mansonliwh I left some comments, PTAL.
fd62196 to
0c7516a
Compare
f740008 to
e972fc1
Compare
zhoujinsong
left a comment
There was a problem hiding this comment.
LGTM.
Thanks for the contribution!
Why are the changes needed?
Close #3256.
Brief change log
This PR introduces Swagger and OpenAPI Generator. To avoid intrusive development, this design does not use a large number of annotations on the controller. Instead, it predefines the openapi.yaml. The interface specifications defined in openapi.yaml are used to generate the Swagger page, API docs, and an SDK using the Apache HttpClient framework.
In the Maven build, you can use the generate-sdk profile to specify whether to generate the SDK.
How was this patch tested?
Swagger Page:

Auth Setting:

Generated API docs & SDK demo:
