Skip to content

Commit

Permalink
文档添加parseOpenAPISchema函数示例
Browse files Browse the repository at this point in the history
在kubectl的doc.go文件中,为parseOpenAPISchema函数添加了注释示例,展示了OpenAPI Schema JSON字符串的结构和内容,包括name、value、properties、vendor_extension等字段,以帮助开发者理解和使用该函数。
  • Loading branch information
weibaohui committed Oct 15, 2024
1 parent 89f771d commit e3073e0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/kubectl/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ type Definitions struct {
var definitionsMap map[string]SchemaDefinition

// parseOpenAPISchema 解析 OpenAPI Schema JSON 字符串并返回根 TreeNode
// Example:
//
// JSON样例
// "name": "com.example.stable.v1.CronTab",
// "value": { },
// "properties": {
// "additional_properties": [ {},{}]
// },
// "vendor_extension": [ {},{}]
// }
func parseOpenAPISchema(schemaJSON string) (TreeNode, error) {
var def SchemaDefinition
err := json.Unmarshal([]byte(schemaJSON), &def)
Expand Down

0 comments on commit e3073e0

Please sign in to comment.