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