Incorrect typing in @googleapis/healthcare
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- nodejs, typescript
- Domain
- api
Research direction
Start with the generated healthcare definitions in src/apis/healthcare/v1.ts, especially the request and response types referenced in the report, and compare them with the linked FHIR example. Verify the corrected types against the shown createFhirResource call and its returned data; done means the example compiles without workarounds and matches the API response.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- TypeScript
- Stars
- 12.3k
- Forks
- 2k
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 9
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from googleapis/google-api-nodejs-client
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
googleapis/google-api-nodejs-client#4064 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 1-2 days Newbie friendliness 5/100
googleapis/google-api-nodejs-client#4067 ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 1/100
googleapis/google-api-nodejs-client#4063 ·
Maintainers usually reply within 2 days
-
eMudhra/emSign CA compromise (October 2026): what Cloud SDK Node.js Libraries developers need to doOpen
Difficulty 1/5 Under an hour Newbie friendliness 10/100
googleapis/google-api-nodejs-client#4062 ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
googleapis/google-api-nodejs-client#4061 ·
Maintainers usually reply within 2 days
All issues in googleapis/google-api-nodejs-client
Similar issues
-
bug UI
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
wardian-app/Wardian#1746 ·
Maintainers usually reply within 1 day
-
area: interop area: sip-core v3
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
fonoster/routr#705 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
openclaw/openclaw#198551 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day