@@ -222,11 +222,6 @@ def value
222222 end
223223
224224 # @return [String] - # What parameter values are allowed by the CRD.
225- #
226- # Old implementation:
227- # def schema_pretty_crd_merged_with_param_db
228- # Schema.new(@param_db.schema).merge!(@schema_crd).to_pretty_s
229- # end
230225 def allowed_values
231226 if ( @schema_crd . empty? )
232227 # CRD doesn't add any constraints on parameter's value.
@@ -236,11 +231,9 @@ def allowed_values
236231 # Create a Schema object just using information in the parameter database.
237232 schema_obj = @param_db . schema
238233
239- # Merge in constraints imposed by the CRD on the parameter.
240- schema_obj . merge! ( @schema_crd )
241-
242- # Create string showing allowed values of parameter with CRD constraints added
243- schema_obj . to_pretty_s
234+ # Merge in constraints imposed by the CRD on the parameter and then
235+ # create string showing allowed values of parameter with CRD constraints added
236+ schema_obj . merge ( @schema_crd ) . to_pretty_s
244237 end
245238
246239 # sorts by name
@@ -273,6 +266,11 @@ def all_in_scope_ext_params
273266 param_db = ext_db . params . find { |p | p . name == param_name }
274267 raise "There is no param '#{ param_name } ' in extension '#{ ext_crd [ "name" ] } " if param_db . nil?
275268
269+ next unless ext_db . versions . any? do |ver |
270+ Gem ::Requirement . new ( ext_crd [ "version" ] ) . satisfied_by? ( Gem ::Version . new ( ver [ "version" ] ) ) &&
271+ param_db . defined_in_extension_version? ( ver [ "version" ] )
272+ end
273+
276274 @all_in_scope_ext_params <<
277275 InScopeExtensionParameter . new ( param_db , param_data [ "schema" ] , param_data [ "note" ] )
278276 end
@@ -302,6 +300,11 @@ def in_scope_ext_params(ext_req)
302300 ext_param_db = ext_db . params . find { |p | p . name == param_name }
303301 raise "There is no param '#{ param_name } ' in extension '#{ ext_crd [ "name" ] } " if ext_param_db . nil?
304302
303+ next unless ext_db . versions . any? do |ver |
304+ Gem ::Requirement . new ( ext_crd [ "version" ] ) . satisfied_by? ( Gem ::Version . new ( ver [ "version" ] ) ) &&
305+ ext_param_db . defined_in_extension_version? ( ver [ "version" ] )
306+ end
307+
305308 ext_params <<
306309 InScopeExtensionParameter . new ( ext_param_db , param_data [ "schema" ] , param_data [ "note" ] )
307310 end
@@ -315,8 +318,15 @@ def all_out_of_scope_params
315318
316319 @all_out_of_scope_params = [ ]
317320 in_scope_ext_reqs . each do |ext_req |
318- @arch_def . extension ( ext_req . name ) . params . each do |param_db |
321+ ext_db = @arch_def . extension ( ext_req . name )
322+ ext_db . params . each do |param_db |
319323 next if all_in_scope_ext_params . any? { |c | c . param_db . name == param_db . name }
324+
325+ next unless ext_db . versions . any? do |ver |
326+ Gem ::Requirement . new ( ext_req . version_requirement ) . satisfied_by? ( Gem ::Version . new ( ver [ "version" ] ) ) &&
327+ param_db . defined_in_extension_version? ( ver [ "version" ] )
328+ end
329+
320330 @all_out_of_scope_params << param_db
321331 end
322332 end
0 commit comments