Incorrect typing in @googleapis/healthcare
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- nodejs, typescript
- Lĩnh vực
- api
Hướng nghiên cứu
Bắt đầu với các định nghĩa healthcare được tạo trong src/apis/healthcare/v1.ts, đặc biệt là các kiểu request và response được tham chiếu trong báo cáo, rồi so sánh chúng với ví dụ FHIR được liên kết. Xác minh các kiểu đã sửa dựa trên lệnh gọi createFhirResource được hiển thị và dữ liệu mà lệnh gọi này trả về; được xem là hoàn tất khi ví dụ biên dịch được mà không cần workarounds và khớp với phản hồi API.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment details
- OS: macOS Sonoma 14.4.1
- Node.js version: 20.5.1
- npm version: 9.8.0
@googleapis/healthcareversion: 16.0.0
Hi there- following the example code for creating FHIR resources, it seems the generated types do not match what the api expects.
Running the example code indicates the requestBody is mistyped and should be of type Scehma$HttpBody.
The response is also mistyped as it seems to return a BLOB. Below is the example code with comments added. This was tested using valid config variables.
const google = require('@googleapis/healthcare');
const healthcare = google.healthcare({
version: 'v1',
auth: new google.auth.GoogleAuth({
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
}),
headers: { 'Content-Type': 'application/fhir+json' },
});
async function createFhirResource() {
// Replace the following body with the data for the resource you want to
// create.
const body = {
name: [{ use: 'official', family: 'Smith', given: ['Darcy'] }],
gender: 'female',
birthDate: '1970-01-01',
resourceType: 'Patient',
};
// TODO(developer): uncomment these lines before running the sample
// const cloudRegion = 'us-central1';
// const projectId = 'adjective-noun-123';
// const datasetId = 'my-dataset';
// const fhirStoreId = 'my-fhir-store';
// const resourceType = 'Patient';
// Example code request - type errors for `requestBody`, returns 200
const request = { parent, type: resourceType, requestBody: body };
const resource = await healthcare.projects.locations.datasets.fhirStores.fhir.create(request);
// Modified to satisfy type errors, throws 400
// const request = { parent, type: resourceType, requestBody: { data: JSON.stringify(body) } };
// const resource = await healthcare.projects.locations.datasets.fhirStores.fhir.create(request);
// Example code response - `id` is undefined, `resource.data` is a BLOB. Type error: Property 'id' does not exist on type 'Schema$HttpBody'.
// console.log(`Created FHIR resource with ID ${resource.data.id}`);
// console.log(resource.data);
// Modified to parse response correctly, throws type errors
const textData = await resource.data.text();
const parsedData = JSON.parse(textData);
console.log(`Created FHIR resource with ID ${parsedData.id}`);
console.log(parsedData);
}
createFhirResource();
It seems there have been a couple other similar issues in the other api libraries.
See: #1944 and #1168
- Ngôn ngữ chính
- TypeScript
- Star
- 12.3k
- Fork
- 2k
- Merge trung bình
- 2 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 23
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của googleapis/google-api-nodejs-client
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 32/100
googleapis/google-api-nodejs-client#3932 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Discovery Engine] streamAnswer is typed as one AnswerQueryResponse, but REST returns frame arraysCó thể đã có người làm @AmariahAK đã nhận 100 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
googleapis/google-api-nodejs-client#3930 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
size: l type: feature request
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
googleapis/google-api-nodejs-client#3926 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type: feature request
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
googleapis/google-api-nodejs-client#3903 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
If a service is deprecated and its the last version fo the library, we need to fully deprecate itĐang mởtype: process
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
googleapis/google-api-nodejs-client#3898 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của googleapis/google-api-nodejs-client
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
awslabs/visual-asset-management-system#804 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
restatedev/sdk-typescript#813 ·
-
bug desktop P1 session XS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Merit-Systems/x402scan#1312 ·
-
type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Azure/apiops-cli#331 ·
Maintainer thường phản hồi trong vòng 3 ngày