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

Name not being passed into discovery.createCollection( #457

Closed
chughts opened this issue May 19, 2017 · 3 comments
Closed

Name not being passed into discovery.createCollection( #457

chughts opened this issue May 19, 2017 · 3 comments

Comments

@chughts
Copy link
Member

chughts commented May 19, 2017

If this is a usage problem, then let me know and I will post a question in the appropriate forum, but I have had a look and I think that its a problem with the SDK.

The discovery.createCollection builds the body for the underlying REST API as
body: JSON.stringify(pick(params, ['collection_name', 'description', 'configuration_id', 'language_code']))

but the API is expecting a body of

{
  "name": "{collection_name}",
  "description": "{description}",
  "configuration_id": "{configuration_id}"
}

which means that name is never getting set. So every time I try to invoke the method through the SDK I get

"Invalid or missing collection name, name is a required parameter"

@nfriedly
Copy link
Contributor

I suspect you're right, can you send a PR with the change and a test?

@chughts
Copy link
Member Author

chughts commented May 19, 2017

Yes I can. I would propose the change to

body: JSON.stringify(pick(params, ['name', 'description', 'configuration_id', 'language_code']))

would that be OK ?

@nfriedly
Copy link
Contributor

Yep. Make sure the JSDoc is also updated

chughts added a commit to chughts/node-sdk that referenced this issue May 21, 2017
nfriedly added a commit that referenced this issue May 22, 2017
Fix for #457 Collection Name Parameter for create collection

[semver patch]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants