gr2m / gr2m/github-openapi-graphql-query

Fails when an endpoint has no `requestBody` schema defined

Đang mở
#195 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
7
Fork
3
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

It seems that there has been a change in the OpenAPI spec from GitHub, and the package now fails because an endpoint has a requestBody property but no schema defined.

In this case, it's the `GET /repos/{owner}/{repo}/contents/{path}` endpoint

```
$ VERSION="23.0.0" npm run update-endpoints:fetch-json
> node scripts/update-endpoints/fetch-json.mjs

Downloading releases from https://api.github.com/repos/octokit/openapi/releases?per_page=100&page=1
Downloading releases from https://api.github.com/repos/octokit/openapi/releases?per_page=100&page=2
downloading https://raw.githubusercontent.com/octokit/openapi/v23.0.0/generated/api.github.com.deref.json ...
{
errors: [
TypeError: Cannot read properties of undefined (reading 'oneOf')
at schemaToParameters (file://types.ts/node_modules/github-openapi-graphql-query/lib/schema-to-parameters.js:4:14)
at definitionToEndpoint (file://types.ts/node_modules/github-openapi-graphql-query/lib/definition-to-endpoint.js:66:7)
at schemaToEndpoints (file://types.ts/node_modules/github-openapi-graphql-query/lib/schema-to-endpoints.js:10:24)
at getEndpoints (file://types.ts/node_modules/github-openapi-graphql-query/lib/get-endpoints.js:32:16)
at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
at async Promise.all (index 0)
at async main (file://types.ts/scripts/update-endpoints/fetch-json.mjs:40:18) {
path: [ 'endpoints' ],
locations: [ { line: 3, column: 5 } ],
extensions: [Object: null prototype] {}
}
],
data: null
}
Waiting for the debugger to disconnect...
file://types.ts/scripts/update-endpoints/fetch-json.mjs:48
data: { endpoints },
^

TypeError: Cannot read properties of null (reading 'endpoints')
at main (file://types.ts/scripts/update-endpoints/fetch-json.mjs:48:13)
at process.processTicksAndRejections (node:internal/process/task_queues:103:5)

Node.js v22.22.2
```

```json
{

}

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start by running VERSION="23.0.0" npm run update-endpoints:fetch-json and inspect scripts/update-endpoints/fetch-json.mjs together with the schemaToParameters and definitionToEndpoint stack frames. Trace how the GET /repos/{owner}/{repo}/contents/{path} requestBody is handled when no schema exists. Done means endpoint generation completes without the undefined oneOf error and includes this endpoint correctly.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, openapi
Lĩnh vực
api, tooling
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
64/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.