Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable extract partial response in sample client code unlike API Explorer #1494

Closed
bhsiaoNFLX opened this issue Sep 25, 2019 · 2 comments
Closed
Assignees
Labels
type: question Request for information or clarification. Not an issue.

Comments

@bhsiaoNFLX
Copy link

bhsiaoNFLX commented Sep 25, 2019

The API Explorer lets you specify the fields request parameter (under "Show standard parameters") to specify which fields to include in the partial response. In particular, I am interested in getting back the spellCorrection partial response using the sample code provided. My question applies to the broader issue that the sample client code doesn't seem to support extracting partial responses like the API explorer does, but I will use spellingCorrection for the following examples:

// passing "fields: spellCorrection" as a second argument
client.searchJob(request, { fields: "spellCorrection" })

// passing "spellCorrection: true" as a second argument
client.searchJob(request, { spellCorrection: true })

// passing "fields: spellCorrection" within the request
var request = {
   parent: "...",
   requestMetadata: {...}
   fields: {
      spellCorrection: true
   }
}
client.searchJob(request)

// passing "spellCorrection: true" within the request
var request = {
   ...
   spellCorrection: true
}
client.searchJob(request)

All the above the variations I've tried but they don't seem to work.

Looking at the implementation of searchJobs within job_service_client.js it is unclear how I can pass in spellingCorrection as a parameter.

Alternatively, is there an easy way I can modify job_service_client.js to return the spellingCorrection partial response, or am I out of luck?

Note: I am getting a proper response back with the matching jobs in the form of an array:

[
   [{<matching_job_1>},{<matching_job_2>}...],
   null,
   null
]

versus in the API Explorer I get a json:

{
  "matchingJobs:": [{<matching_job_1>},{<matching_job_2>}...]
  "spellCorrection": {
    "corrected": true,
    "correctedText": "engineer"
  }
}
@bhsiaoNFLX bhsiaoNFLX changed the title Unable to pass in fields to extract partial response like API Explorer Unable extract partial response in sample client code unlike API Explorer Sep 25, 2019
@fhinkel
Copy link
Contributor

fhinkel commented Oct 1, 2019

@bhsiaoNFLX 👋 Thanks for raising the issue. @happyhuman could you have a look at this talent question. Thanks.

@JustinBeckwith JustinBeckwith added triage me I really want to be triaged. 🚨 This issue needs some love. type: question Request for information or clarification. Not an issue. and removed triage me I really want to be triaged. 🚨 This issue needs some love. labels Oct 3, 2019
@fhinkel
Copy link
Contributor

fhinkel commented Nov 18, 2019

Closing this due to inactivity.

@fhinkel fhinkel closed this as completed Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

4 participants