kubeedge / kubeedge

Kubernetes Native Edge Computing Framework (project under CNCF)
https://kubeedge.io
Apache License 2.0
6.51k stars 1.68k forks source link

Tool that supports automatically generating API documentation for KubeEdge #5581

Closed greensong closed 1 month ago

greensong commented 1 month ago

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 the doc.go file, openapi-gen scans all types under that package and generates OpenAPI definitions for them, stored in the zz_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). The swagger.json file contains all the OpenAPI definition information for the API server.

The contents of generateswagger.go are as follows:

kubeedge-bot commented 1 month ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: To complete the pull request process, please assign kevin-wangzefeng after the PR has been reviewed. You can assign the PR to them by writing /assign @kevin-wangzefeng in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/kubeedge/kubeedge/blob/master/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment