Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions .toys/generate-updates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

require "uri"
require "psych"

desc "Run standard Google client generation."

Expand Down Expand Up @@ -75,17 +76,38 @@ def run
end

def list_apis_versions
return requested.map { |request| request.split(":") } unless all
return requested.map { |request| request.split(":") }.reject do |(name, version)|
excluded_api?(name, version)
end unless all

path = git_cache.find("https://github.com/googleapis/discovery-artifact-manager.git",
path: "discoveries/index.json", update: true)
apis_versions = []
JSON.parse(File.read path)["items"].each do |item|
JSON.parse(File.read(path))["items"].each do |item|
next if excluded_api?(item['name'], item['version'])
next unless item["preferred"] || gem_exists?(item)
apis_versions << [item["name"], item["version"]]
end
apis_versions.shuffle
end

def excluded_api? name, version
excluded_apis.include?("#{name}.#{version}") || excluded_apis.include?("#{name}:#{version}")
end

def excluded_apis
@excluded_apis ||= begin
config_path = "#{context_directory}/api_list_config.yaml"
return [] unless File.file?(config_path)
list = Psych.load_file(config_path)["exclude"] || []
puts "Loaded exclusion list: #{list.join(', ')}" if list.any?
list
rescue StandardError => e
puts "Failed to load exclusion list from #{config_path}: #{e.message}"
[]
end
end

def gem_exists? item
name = item["name"]
version = item["version"]
Expand Down
5 changes: 4 additions & 1 deletion api_list_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ include:
- name: youtubePartner
version: v1
discovery_rest_url: https://content.googleapis.com/discovery/v1/apis/youtubePartner/v1/rest
exclude: []
Comment thread
torreypayne marked this conversation as resolved.
exclude:
# 📝 Exclusions logged and tracked by b/542740217
- discoveryengine.v1
- discoveryengine.v1alpha
pause: []
Loading