googleapis / googleapis/google-cloud-node

feat!: Normalize `#scopes` args and properties to `string[]`

Open
#7,732 0 comments 0 reactions 0 assignees View on GitHub
library: google-cloud-node-core next major: breaking change priority: p3 semver: major type: feature request
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

Today, some `AuthClient`s have a `scopes` property with of `string | string[]`:

https://github.com/googleapis/google-auth-library-nodejs/blob/4f94ffe474ee41b560813b81e8d621be848d38d0/src/auth/baseexternalclient.ts#L140-L145

And we have to normalize in other places like this with code like this:

https://github.com/googleapis/google-auth-library-nodejs/blob/4f94ffe474ee41b560813b81e8d621be848d38d0/src/auth/computeclient.ts#L51-L55

This is pretty inconsistency throughout the library. Additionally, this change will clarify to customers that may be confused as to if a `string`-typed `scopes` property will be parsed into multiple scopes are not.

Implementation Notes:
- Ensure samples are providing the recommended `string[]` as parameters
- It might be worth looking into storing internally as a `Set`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.