diff --git a/tools/go.mod b/tools/go.mod index 25cef1fd110..ce710420ec3 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -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 diff --git a/tools/go.sum b/tools/go.sum index 099ce0450dd..29b5dfebe54 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -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= diff --git a/tools/metadata/main_test.go b/tools/metadata/main_test.go index 17de07d79a0..a00c11ba090 100644 --- a/tools/metadata/main_test.go +++ b/tools/metadata/main_test.go @@ -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", }, }, - }, - }, + })), }, }) diff --git a/tools/metadata/openapi.go b/tools/metadata/openapi.go index 0804a47020b..327b7afba87 100644 --- a/tools/metadata/openapi.go +++ b/tools/metadata/openapi.go @@ -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 {