Skip to content

Commit

Permalink
feat: add manual list of extra allowed api shortnames (#5037)
Browse files Browse the repository at this point in the history
Going with the manually curated list of extra allowed api_shortname
entries because this scenario is so rare. If we allow every product
entry, we could get false negatives where we happen to match a "product"
but we don't have protos for it.

Fixes #5036
  • Loading branch information
chingor13 committed Apr 25, 2023
1 parent 9dbfa7f commit e107a8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/repo-metadata-lint/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"extends": "./node_modules/gts"
"extends": "./node_modules/gts",
"root": true
}
7 changes: 6 additions & 1 deletion packages/repo-metadata-lint/src/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ const API_LIBRARY_TYPES = [
'GAPIC_COMBO',
];

// Manually curated list of allowed api_shortname entries
const EXTRA_ALLOWED_API_SHORTNAMES = [
'bigquery', // handwritten client that has no protos
];

interface ApiIndex {
apis: {hostName: string}[];
}
Expand Down Expand Up @@ -101,7 +106,7 @@ export class Validate {
// on googleapis/googleapis:
async validApiShortNames() {
const apiIndex = await this.getApiIndex();
const apiShortNames = new Set<string>();
const apiShortNames = new Set<string>(EXTRA_ALLOWED_API_SHORTNAMES);
for (const api of apiIndex.apis) {
const match = api.hostName.match(/(?<service>[^.]+)/);
if (match && match.groups) {
Expand Down

0 comments on commit e107a8d

Please sign in to comment.