-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Tool that supports automatically generating API documentation for KubeEdge #5582
Conversation
Signed-off-by: ‘greensong’ <‘15079795005@163.com’>
Signed-off-by: ‘greensong’ <‘15079795005@163.com’>
Signed-off-by: ‘greensong’ <‘15079795005@163.com’>
Signed-off-by: ‘greensong’ <‘15079795005@163.com’>
Signed-off-by: ‘greensong’ <‘15079795005@163.com’>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thank you for your contribution, you need to pass the DCO check first. |
"k8s.io/kube-openapi/pkg/validation/spec" | ||
) | ||
|
||
func main() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These source codes of a openapi generation tool that does not fit in the hack/ directory, is there a better choice?
"strings" | ||
) | ||
|
||
func main() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a shell script would be more appropriate then the gofile for execute openapi-gen command. BTW, we can use the compiled binary openapi-gen.
1. Generate OpenAPI Definitions with openapi-gen:
Use the openapi-gen tool to generate Go template code containing OpenAPI definitions based on annotation information. By adding a specific annotation
+k8s:openapigen=true
in thedoc.go
file, openapi-gen scans all types under that package and generates OpenAPI definitions for them, stored in thezz_generated.openapi.go
file.2. Generate OpenAPI Specification:
Write
generateswagger.go
to reference the generated OpenAPI definitions (zz_generated.openapi.go
) and generate the OpenAPI specification (swagger.json
). Theswagger.json
file contains all the OpenAPI definition information for the API server.The contents of
generateswagger.go
are as follows:The specific process is as follows: