+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/alecthomas/kong v0.8.1
github.com/getkin/kin-openapi v0.120.0
github.com/getkin/kin-openapi v0.122.0
github.com/google/go-cmp v0.6.0
github.com/google/go-github/v57 v57.0.0
golang.org/x/sync v0.5.0
Expand Down
4 changes: 2 additions & 2 deletions tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/getkin/kin-openapi v0.120.0 h1:MqJcNJFrMDFNc07iwE8iFC5eT2k/NPUFDIpNeiZv8Jg=
github.com/getkin/kin-openapi v0.120.0/go.mod h1:PCWw/lfBrJY4HcdqE3jj+QFkaFK8ABoqo7PvqVhXXqw=
github.com/getkin/kin-openapi v0.122.0 h1:WB9Jbl0Hp/T79/JF9xlSW5Kl9uYdk/AWD0yAd9HOM10=
github.com/getkin/kin-openapi v0.122.0/go.mod h1:PCWw/lfBrJY4HcdqE3jj+QFkaFK8ABoqo7PvqVhXXqw=
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
Expand Down
35 changes: 15 additions & 20 deletions tools/metadata/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,59 +66,54 @@ GET /undocumented/{undocumented_id}
func TestUpdateOpenAPI(t *testing.T) {
testServer := newTestServer(t, "main", map[string]interface{}{
"api.github.com/api.github.com.json": openapi3.T{
Paths: openapi3.Paths{
"/a/{a_id}": &openapi3.PathItem{
Paths: openapi3.NewPaths(
openapi3.WithPath("/a/{a_id}", &openapi3.PathItem{
Get: &openapi3.Operation{
ExternalDocs: &openapi3.ExternalDocs{
URL: "https://docs.github.com/rest/reference/a",
},
},
},
},
})),
},
"ghec/ghec.json": openapi3.T{
Paths: openapi3.Paths{
"/a/b/{a_id}": &openapi3.PathItem{
Paths: openapi3.NewPaths(
openapi3.WithPath("/a/b/{a_id}", &openapi3.PathItem{
Get: &openapi3.Operation{
ExternalDocs: &openapi3.ExternalDocs{
URL: "https://docs.github.com/rest/reference/a",
},
},
},
},
})),
},
"ghes-3.9/ghes-3.9.json": openapi3.T{
Paths: openapi3.Paths{
"/a/b/{a_id}": &openapi3.PathItem{
Paths: openapi3.NewPaths(
openapi3.WithPath("/a/b/{a_id}", &openapi3.PathItem{
Get: &openapi3.Operation{
ExternalDocs: &openapi3.ExternalDocs{
URL: "https://docs.github.com/rest/reference/a",
},
},
},
},
})),
},
"ghes-3.10/ghes-3.10.json": openapi3.T{
Paths: openapi3.Paths{
"/a/b/{a_id}": &openapi3.PathItem{
Paths: openapi3.NewPaths(
openapi3.WithPath("/a/b/{a_id}", &openapi3.PathItem{
Get: &openapi3.Operation{
ExternalDocs: &openapi3.ExternalDocs{
URL: "https://docs.github.com/rest/reference/a",
},
},
},
},
})),
},
"ghes-2.22/ghes-2.22.json": openapi3.T{
Paths: openapi3.Paths{
"/a/b/{a_id}": &openapi3.PathItem{
Paths: openapi3.NewPaths(
openapi3.WithPath("/a/b/{a_id}", &openapi3.PathItem{
Get: &openapi3.Operation{
ExternalDocs: &openapi3.ExternalDocs{
URL: "https://docs.github.com/rest/reference/a",
},
},
},
},
})),
},
})

Expand Down
2 changes: 1 addition & 1 deletion tools/metadata/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func getOpsFromGithub(ctx context.Context, client *github.Client, gitRef string)
}
var ops []*operation
for _, desc := range descs {
for p, pathItem := range desc.description.Paths {
for p, pathItem := range desc.description.Paths.Map() {
for method, op := range pathItem.Operations() {
docURL := ""
if op.ExternalDocs != nil {
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载