From f2726f4627a7260dd42485ec83896a3c0b8c371f Mon Sep 17 00:00:00 2001 From: Daniel Azuma Date: Mon, 13 Apr 2020 09:09:58 -0700 Subject: [PATCH] fix: temporarily disable Apigee V1 and resolve conflicts in Spanner V1. --- api_list_config.yaml | 2 ++ api_names.yaml | 2 ++ bin/generate-api | 10 +++++++++- lib/google/apis/generator/annotator.rb | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 api_list_config.yaml diff --git a/api_list_config.yaml b/api_list_config.yaml new file mode 100644 index 000000000..f2c8e573d --- /dev/null +++ b/api_list_config.yaml @@ -0,0 +1,2 @@ +exclude: + - apigee.v1 diff --git a/api_names.yaml b/api_names.yaml index f52efab71..3f1458f0c 100644 --- a/api_names.yaml +++ b/api_names.yaml @@ -965,6 +965,8 @@ "/sheets:v4/sheets.spreadsheets.sheets.copyTo": copy_spreadsheet "/sheets:v4/sheets.spreadsheets.values.batchGet": batch_get_spreadsheet_values "/sheets:v4/sheets.spreadsheets.values.get": get_spreadsheet_values +"/spanner:v1/spanner.projects.instances.backupOperations.list": list_project_instance_backupoperations +"/spanner:v1/spanner.projects.instances.databaseOperations.list": list_project_instance_databaseoperations "/sqladmin:v1beta4/BackupRunsListResponse": list_backup_runs_response "/sqladmin:v1beta4/DatabasesListResponse": list_databases_response "/sqladmin:v1beta4/FlagsListResponse": list_flags_response diff --git a/bin/generate-api b/bin/generate-api index e91a1a26f..baca54b0f 100755 --- a/bin/generate-api +++ b/bin/generate-api @@ -10,6 +10,7 @@ end require 'open-uri' require 'google/apis/discovery_v1' require 'logger' +require 'psych' module Google class ApiGenerator < Thor @@ -77,8 +78,11 @@ module Google def generate_from_discovery(preferred_only: false) say 'Fetching API list' apis = discovery.list_apis + exclude_apis = api_list_config["exclude"] || [] apis.items.each do |api| - if (preferred_only && !api.preferred?) + if exclude_apis.include? "#{api.name}.#{api.version}" + say "Ignoring excluded API #{api.name} #{api.version}" + elsif (preferred_only && !api.preferred?) say sprintf('Ignoring disoverable API %s', api.id) else # The Discovery service may returned cached versions of a Discovery document that are @@ -109,6 +113,10 @@ module Google @generator ||= Google::Apis::Generator.new(api_names: options[:names], api_names_out: options[:names_out]) end + def api_list_config + @api_list_config ||= Psych.load_file(__dir__ + "/../api_list_config.yaml") + end + def ensure_active_support begin require 'active_support/inflector' diff --git a/lib/google/apis/generator/annotator.rb b/lib/google/apis/generator/annotator.rb index db3b38840..20b6ffa37 100644 --- a/lib/google/apis/generator/annotator.rb +++ b/lib/google/apis/generator/annotator.rb @@ -76,7 +76,7 @@ module Google def pick_name(alt_name) preferred_name = @names[key] if preferred_name && preferred_name == alt_name - logger.warn { sprintf("Unnecessary name override '%s': %s", key, alt_name) } + # logger.warn { sprintf("Unnecessary name override '%s': %s", key, alt_name) } elsif preferred_name.nil? preferred_name = @names[key] = alt_name end