Skip to content
Open
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
19 changes: 17 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,31 @@ def run
end

def list_apis_versions
return requested.map { |request| request.split(":") } unless all
excluded = excluded_apis

return requested.map { |request| request.split(":") }.reject do |(name, version)|
excluded.include?("#{name}.#{version}") || excluded.include?("#{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.include?("#{item['name']}.#{item['version']}") || excluded.include?("#{item['name']}:#{item['version']}")
next unless item["preferred"] || gem_exists?(item)
apis_versions << [item["name"], item["version"]]
end
apis_versions.shuffle
end

def excluded_apis
config_path = "#{context_directory}/api_list_config.yaml"
return [] unless File.file?(config_path)
Psych.load_file(config_path)["exclude"] || []
rescue StandardError
[]
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: []
exclude:
- discoveryengine.v1
- discoveryengine.v1alpha
- discoveryengine.v1beta
pause: []
Loading