Skip to content
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 #5609

Closed
wants to merge 8 commits into from

Conversation

Catherine-monk
Copy link

Introduction

A tool that automatically generates API documentation for kubeedge.

Implementation Method

  1. Generate OpenAPI definitions using openapi-gen: The openapi-gen tool generates Go template code containing OpenAPI definitions from comment information. By adding a specific annotation +k8s:openapigen=true in the doc.go file, openapi-gen will scan all types in the package to generate OpenAPI definitions, which are stored in the zz_generated.openapi.go file.

  2. Generate OpenAPI Specification:
    Write generateswagger.go referencing the generated OpenAPI definitions (zz_generated.openapi.go) to create the OpenAPI specification (swagger.json). The swagger.json file contains all the OpenAPI definition information of the apiserver.

Contents of generateswagger.go include:

  • Create a Schema object for type registration and object instantiation.
  • Create a REST Mapper for converting between GVR (Group Version Resource) and GVK (Group Version Kind).
  • Add specific mappings for various Kubeedge resources.
  • Set the information for the OpenAPI specification.

侯玲玉 and others added 6 commits May 13, 2024 22:52
Signed-off-by: lingyu.hou <lingyu.hou@daocloud.io>
Signed-off-by: lingyu.hou <lingyu.hou@daocloud.io>
Signed-off-by: lingyu.hou <lingyu.hou@daocloud.io>
Signed-off-by: lingyu.hou <lingyu.hou@daocloud.io>
Signed-off-by: lingyu.hou <lingyu.hou@daocloud.io>
Signed-off-by: lingyu.hou <lingyu.hou@daocloud.io>
@kubeedge-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign qizha after the PR has been reviewed.
You can assign the PR to them by writing /assign @qizha 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:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubeedge-bot kubeedge-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 13, 2024
@Catherine-monk Catherine-monk changed the title auto Tool that supports automatically generating API documentation May 14, 2024
Copy link
Contributor

@wbc6080 wbc6080 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that there is a problem with the CI test of make verify. You can run hack/update-codegen.sh and push again.

greensong and others added 2 commits May 15, 2024 19:38
Signed-off-by: lingyu.hou <lingyu.hou@daocloud.io>
Signed-off-by: lingyu.hou <lingyu.hou@daocloud.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants