Incorrect typing in @googleapis/healthcare
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- nodejs, typescript
- 领域
- api
调研方向
从 src/apis/healthcare/v1.ts 中生成的 healthcare 定义开始,尤其是报告中引用的 request 和 response 类型,并将它们与链接的 FHIR 示例进行比较。根据所示的 createFhirResource 调用及其返回的数据验证修正后的类型;当示例无需 workarounds 即可编译并与 API 响应匹配时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- TypeScript
- 星标
- 12.3k
- 派生
- 2k
- 平均合并
- 2 天 19 小时
- 30 天内合并 PR
- 23
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
googleapis/google-api-nodejs-client 的其他 Issue
-
难度 5/5 一周以上 新手友好度 32/100
googleapis/google-api-nodejs-client#3932 · 1 条评论 ·
维护者通常 1 天内回复
-
[Discovery Engine] streamAnswer is typed as one AnswerQueryResponse, but REST returns frame arrays可能已有人在做 @AmariahAK 于 101 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 64/100
googleapis/google-api-nodejs-client#3930 ·
维护者通常 1 天内回复
-
size: l type: feature request
难度 4/5 3-5 天 新手友好度 35/100
googleapis/google-api-nodejs-client#3926 ·
维护者通常 1 天内回复
-
type: feature request
难度 5/5 一周以上 新手友好度 15/100
googleapis/google-api-nodejs-client#3903 ·
维护者通常 1 天内回复
-
If a service is deprecated and its the last version fo the library, we need to fully deprecate it未关闭type: process
难度 4/5 3-5 天 新手友好度 42/100
googleapis/google-api-nodejs-client#3898 ·
维护者通常 1 天内回复
查看 googleapis/google-api-nodejs-client 的全部 Issue
相似的 Issue
-
category::task code priority::normal
难度 2/5 1-3 小时 新手友好度 78/100
e0ipso/strikethroo#145 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 85/100
cocos/cocos-docs#3333 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
RevenueCat/react-native-purchases#2079 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
RevenueCat/purchases-hybrid-common#2039 ·
维护者通常 1 天内回复
-
agent-reported area/react bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复