Make the generator deterministic (#601)
This commit is contained in:
parent
511c676593
commit
74c0242266
|
@ -90,7 +90,7 @@ module Google
|
|||
end
|
||||
|
||||
def dump
|
||||
YAML.dump(@names)
|
||||
YAML.dump(Hash[@names.sort])
|
||||
end
|
||||
|
||||
def key
|
||||
|
@ -161,10 +161,6 @@ module Google
|
|||
include NameHelpers
|
||||
include Google::Apis::Core::Logging
|
||||
|
||||
# Don't expose these in the API directly.
|
||||
PARAMETER_BLACKLIST = %w(alt access_token bearer_token oauth_token pp prettyPrint
|
||||
$.xgafv callback upload_protocol uploadType)
|
||||
|
||||
# Prepare the API for the templates.
|
||||
# @param [Google::Apis::DiscoveryV1::RestDescription] description
|
||||
# API Description
|
||||
|
@ -196,7 +192,6 @@ module Google
|
|||
end
|
||||
end
|
||||
@rest_description.force_alt_json = @names.option('force_alt_json')
|
||||
@rest_description.parameters.reject! { |k, _v| PARAMETER_BLACKLIST.include?(k) }
|
||||
annotate_parameters(@rest_description.parameters)
|
||||
annotate_resource(@rest_description.name, @rest_description)
|
||||
@rest_description.schemas.each do |k, v|
|
||||
|
|
|
@ -39,7 +39,7 @@ module Google
|
|||
attr_accessor :path
|
||||
|
||||
def properties
|
||||
@properties ||= {}
|
||||
Hash[(@properties || {}).sort]
|
||||
end
|
||||
|
||||
def qualified_name
|
||||
|
@ -68,6 +68,10 @@ module Google
|
|||
attr_accessor :generated_name
|
||||
attr_accessor :parent
|
||||
|
||||
def parameters
|
||||
Hash[(@parameters || {}).sort]
|
||||
end
|
||||
|
||||
def path_parameters
|
||||
return [] if parameter_order.nil? || parameters.nil?
|
||||
parameter_order.map { |name| parameters[name] }.select { |param| param.location == 'path' }
|
||||
|
@ -92,6 +96,14 @@ module Google
|
|||
class RestResource
|
||||
attr_accessor :parent
|
||||
|
||||
def api_methods
|
||||
Hash[(@api_methods || {}).sort]
|
||||
end
|
||||
|
||||
def resources
|
||||
Hash[(@resources || {}).sort]
|
||||
end
|
||||
|
||||
def all_methods
|
||||
m = []
|
||||
m << api_methods.values unless api_methods.nil?
|
||||
|
@ -104,6 +116,10 @@ module Google
|
|||
attr_accessor :force_alt_json
|
||||
alias_method :force_alt_json?, :force_alt_json
|
||||
|
||||
# Don't expose these in the API directly.
|
||||
PARAMETER_BLACKLIST = %w(alt access_token bearer_token oauth_token pp prettyPrint
|
||||
$.xgafv callback upload_protocol uploadType)
|
||||
|
||||
def version
|
||||
ActiveSupport::Inflector.camelize(@version.gsub(/\W/, '-')).gsub(/-/, '_')
|
||||
end
|
||||
|
@ -125,6 +141,14 @@ module Google
|
|||
ActiveSupport::Inflector.camelize(sprintf('%sService', class_name))
|
||||
end
|
||||
|
||||
def api_methods
|
||||
Hash[(@api_methods || {}).sort]
|
||||
end
|
||||
|
||||
def resources
|
||||
Hash[(@resources || {}).sort]
|
||||
end
|
||||
|
||||
def all_methods
|
||||
m = []
|
||||
m << api_methods.values unless api_methods.nil?
|
||||
|
@ -132,11 +156,23 @@ module Google
|
|||
m.flatten
|
||||
end
|
||||
|
||||
def parameters
|
||||
Hash[(@parameters || {}).sort].reject! { |k, _v| PARAMETER_BLACKLIST.include?(k) }
|
||||
end
|
||||
|
||||
def schemas
|
||||
Hash[(@schemas || {}).sort]
|
||||
end
|
||||
|
||||
class Auth
|
||||
class Oauth2
|
||||
class Scope
|
||||
attr_accessor :constant
|
||||
end
|
||||
|
||||
def scopes
|
||||
Hash[(@scopes || {}).sort]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue